From 560170a0ee1d31a97442e723e4f8af5556a9313c Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Mon, 29 Aug 2016 13:09:05 +0200 Subject: [PATCH 001/308] update cmakefile to support split messages and scripts to manage the protobuf --- cmake_targets/CMakeLists.txt | 53 ++++++++++++++++++++++++++++++++ cmake_targets/tools/build_helper | 32 +++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a5a8cff807..9834d19266 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -635,6 +635,9 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchang add_boolean_option(ENB_AGENT True "enable eNB agent to inteface with a SDN contrller") +# temporary FLAG +add_boolean_option(PDCP_SPLIT True "enable PDCP split") + ######################## # Include order ########################## @@ -849,6 +852,56 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ +if (PDCP_SPLIT) + # set the version of protobuf messages, V3 not supported yet + add_list1_option(FSPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3) + + if (${FSPT_VERSION} STREQUAL "V2") + set (FSPTDIR V2) + elseif (${FSPT_VERSION} STREQUAL "V3") + set (FSPTDIR V3) + endif(${FSPT_VERSION} STREQUAL "V2") + + set(FSPT_MSG_DIR ${OPENAIR_DIR}/targets/COMMON/MESSAGES/${FSPTDIR} ) + set(FSPT_MSG_FILES + ${FSPT_MSG_DIR}/header.proto + ${FSPT_MSG_DIR}/flexsplit.proto + ) + + set(FSPT_C_DIR ${protobuf_generated_dir}/${FSPTDIR}) + message("calling protoc_call=${protoc_call} FSPT_C_DIR=${FSPT_C_DIR} FSPT_MSG_FILES=${FSPT_MSG_FILES}") + execute_process(COMMAND ${protoc_call} ${FSPT_C_DIR} ${FSPT_MSG_DIR} ${FSPT_MSG_FILES}) + file(GLOB PRPT_source ${FSPT_C_DIR}/*.c) + set(FSPT_OAI_generated + ${FSPT_C_DIR}/header.pb-c.c + ${FSPT_C_DIR}/flexsplit.pb-c.c + ) + + file(GLOB fspt_h ${FSPT_C_DIR}/*.h) + set(fspt_h ${fspt_h} ) + + add_library(FSPT_MSG + ${FSPT_OAI_generated} + ${FSPT_source} + ) + set(FSPT_MSG_LIB FSPT_MSG) + message("fspt c dir is : ${FSPT_C_DIR}") + include_directories (${FSPT_C_DIR}) + + add_library(ASYNC_IF + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c + ) + set(ASYNC_IF_LIB ASYNC_IF) + include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + + set(PROTOBUF_LIB "protobuf-c") + + #set(PROTOBUF_LIB "protobuf") #for Cpp +endif() + add_library(HASHTABLE ${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c ${OPENAIR_DIR}/common/utils/collection/hashtable/obj_hashtable.c diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 0f87ce1ad3..284ec1e1a9 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -221,6 +221,35 @@ install_gnutls_from_source(){ )>& $gnutls_install_log } +install_protobuf_from_source(){ + cd /tmp + echo "Downloading protobuf" + rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 + wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz + tar -xzvf protobuf-2.6.1.tar.gz + cd protobuf-2.6.1/ + ./configure + echo "Compiling protobuf" + make -j`nproc` + $SUDO make install + rm -rf /tmp/protobuf-2.6.1.tar.gz /tmp/protobuf-2.6.1 + $SUDO ldconfig +} + +install_protobuf_c_from_source(){ + cd /tmp + echo "Downloading protobuf-c" + rm -rf /tmp/protobuf-c + git clone https://github.com/protobuf-c/protobuf-c.git + cd protobuf-c + ./autogen.sh + ./configure + echo "Compiling protobuf-c" + make -j`nproc` + $SUDO make install + rm -rf /tmp/protobuf-c + $SUDO ldconfig +} check_install_usrp_uhd_driver(){ @@ -392,6 +421,9 @@ check_install_oai_software() { install_gnutls_from_source install_asn1c_from_source + + install_protobuf_from_source + install_protobuf_c_from_source } install_asn1c_from_source(){ -- GitLab From e508be85d4561fef3b46c1fc76a891acead5bf8d Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Mon, 29 Aug 2016 16:04:07 +0200 Subject: [PATCH 002/308] add async interface and flexsplit messages --- cmake_targets/tools/generate_protobuf | 19 ++ openair2/UTIL/ASYNC_IF/link_manager.c | 261 +++++++++++++++ openair2/UTIL/ASYNC_IF/link_manager.h | 70 ++++ openair2/UTIL/ASYNC_IF/message_queue.c | 211 ++++++++++++ openair2/UTIL/ASYNC_IF/message_queue.h | 71 ++++ openair2/UTIL/ASYNC_IF/ringbuffer_queue.c | 143 ++++++++ openair2/UTIL/ASYNC_IF/ringbuffer_queue.h | 60 ++++ openair2/UTIL/ASYNC_IF/socket_link.c | 364 +++++++++++++++++++++ openair2/UTIL/ASYNC_IF/socket_link.h | 65 ++++ targets/COMMON/MESSAGES/V2/flexsplit.proto | 44 +++ targets/COMMON/MESSAGES/V2/header.proto | 13 + 11 files changed, 1321 insertions(+) create mode 100755 cmake_targets/tools/generate_protobuf create mode 100644 openair2/UTIL/ASYNC_IF/link_manager.c create mode 100644 openair2/UTIL/ASYNC_IF/link_manager.h create mode 100644 openair2/UTIL/ASYNC_IF/message_queue.c create mode 100644 openair2/UTIL/ASYNC_IF/message_queue.h create mode 100644 openair2/UTIL/ASYNC_IF/ringbuffer_queue.c create mode 100644 openair2/UTIL/ASYNC_IF/ringbuffer_queue.h create mode 100644 openair2/UTIL/ASYNC_IF/socket_link.c create mode 100644 openair2/UTIL/ASYNC_IF/socket_link.h create mode 100644 targets/COMMON/MESSAGES/V2/flexsplit.proto create mode 100644 targets/COMMON/MESSAGES/V2/header.proto diff --git a/cmake_targets/tools/generate_protobuf b/cmake_targets/tools/generate_protobuf new file mode 100755 index 0000000000..5c1b523f8c --- /dev/null +++ b/cmake_targets/tools/generate_protobuf @@ -0,0 +1,19 @@ +#!/bin/bash + +function main() +{ +mkdir -p $1 + +#echo generate protobuf messages inside $1 $2 + +c_out=$1 +shift +proto_path=$1 +shift + +protoc-c --c_out=$c_out --proto_path=$proto_path $* +#protoc --cpp_out=$c_out --proto_path=$proto_path $* + +} + +main "$@" diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c new file mode 100644 index 0000000000..0ab2ecc2b2 --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -0,0 +1,261 @@ +/******************************************************************************* + 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@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file link_manager.c + * \brief this is the implementation of a link manager + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#include "link_manager.h" +#include "log.h" + +#include <stdio.h> +#include <stdlib.h> +#include <pthread.h> + +/* that thread reads messages in the queue and sends them to the link */ +static void *link_manager_sender_thread(void *_manager) +{ + link_manager_t *manager = _manager; + void *data; + int size; + int priority; + + LOG_D(MAC, "starting link manager sender thread\n"); + + while (manager->run) { + while (message_get(manager->send_queue, &data, &size, &priority) == 0) { + link_send_packet(manager->socket_link, data, size); + free(data); + } + // if (message_get(manager->send_queue, &data, &size, &priority)) + // goto error; + //if (link_send_packet(manager->socket_link, data, size)) + // goto error; + //free(data); + } + + LOG_D(MAC, "link manager sender thread quits\n"); + + return NULL; + +error: + LOG_E(MAC, "%s: error\n", __FUNCTION__); + return NULL; +} + +/* that thread receives messages from the link and puts them in the queue */ +static void *link_manager_receiver_thread(void *_manager) +{ + link_manager_t *manager = _manager; + void *data; + int size; + + LOG_D(MAC, "starting link manager receiver thread\n"); + + while (manager->run) { + if (link_receive_packet(manager->socket_link, &data, &size)) + goto error; + /* todo: priority */ + if (message_put(manager->receive_queue, data, size, 0)) + goto error; + } + + LOG_D(MAC, "link manager receiver thread quits\n"); + + return NULL; + +error: + LOG_E(MAC, "%s: error\n", __FUNCTION__); + return NULL; +} + +link_manager_t *create_link_manager( + message_queue_t *send_queue, + message_queue_t *receive_queue, + socket_link_t *link) +{ + link_manager_t *ret = NULL; + pthread_attr_t attr; + pthread_t t; + + LOG_D(MAC, "create new link manager\n"); + + ret = calloc(1, sizeof(link_manager_t)); + if (ret == NULL) + goto error; + + ret->send_queue = send_queue; + ret->receive_queue = receive_queue; + ret->socket_link = link; + ret->run = 1; + + if (pthread_attr_init(&attr)) + goto error; + + // Make the async interface threads real-time + //#ifndef LOWLATENCY + struct sched_param sched_param_recv_thread; + struct sched_param sched_param_send_thread; + + sched_param_recv_thread.sched_priority = sched_get_priority_max(SCHED_RR) - 1; + pthread_attr_setschedparam(&attr, &sched_param_recv_thread); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + //#endif + + if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) + goto error; + + if (pthread_create(&t, &attr, link_manager_sender_thread, ret)) + goto error; + ret->sender = t; + + if (pthread_create(&t, &attr, link_manager_receiver_thread, ret)) + /* we should destroy the other thread here */ + goto error; + ret->receiver = t; + + if (pthread_attr_destroy(&attr)) + /* to be clean we should destroy the threads at this point, + * even if in practice we never reach it */ + goto error; + + return ret; + +error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + free(ret); + return NULL; +} + +void destroy_link_manager(link_manager_t *manager) +{ + LOG_D(MAC, "destroying link manager\n"); + manager->run = 0; + /* todo: force threads to stop (using a dummy message?) */ +} + +#ifdef SERVER_TEST + +#include <string.h> + +int main(void) +{ + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; + void *data; + int size; + int priority; + + printf("starting server\n"); + + link = new_link_server(2210); + if (link == NULL) goto error; + + send_queue = new_message_queue(); + if (send_queue == NULL) goto error; + receive_queue = new_message_queue(); + if (receive_queue == NULL) goto error; + + manager = create_link_manager(send_queue, receive_queue, link); + if (manager == NULL) goto error; + + data = strdup("hello"); if (data == NULL) goto error; + if (message_put(send_queue, data, 6, 100)) goto error; + + if (message_get(receive_queue, &data, &size, &priority)) goto error; + printf("received message:\n"); + printf(" data: %s\n", (char *)data); + printf(" size: %d\n", size); + printf(" priority: %d\n", priority); + + printf("server ends\n"); + return 0; + +error: + printf("there was an error\n"); + return 1; +} + +#endif + +#ifdef CLIENT_TEST + +#include <string.h> +#include <unistd.h> + +int main(void) +{ + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; + void *data; + int size; + int priority; + + printf("starting client\n"); + + link = new_link_client("127.0.0.1", 2210); + if (link == NULL) goto error; + + send_queue = new_message_queue(); + if (send_queue == NULL) goto error; + receive_queue = new_message_queue(); + if (receive_queue == NULL) goto error; + + manager = create_link_manager(send_queue, receive_queue, link); + if (manager == NULL) goto error; + + if (message_get(receive_queue, &data, &size, &priority)) goto error; + printf("received message:\n"); + printf(" data: %s\n", (char *)data); + printf(" size: %d\n", size); + printf(" priority: %d\n", priority); + + data = strdup("world"); if (data == NULL) goto error; + if (message_put(send_queue, data, 6, 200)) goto error; + + /* let's wait for the message to be sent (unreliable sleep, but does it for the test) */ + sleep(1); + + printf("client ends\n"); + return 0; + +error: + printf("there was an error\n"); + return 1; +} + +#endif diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h new file mode 100644 index 0000000000..4f0628c0ee --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -0,0 +1,70 @@ +/******************************************************************************* + 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@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file link_manager.h + * \brief this is the implementation of a link manager + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#ifndef LINK_MANAGER_H +#define LINK_MANAGER_H + +//#include "message_queue.h" +#include "ringbuffer_queue.h" +#include "socket_link.h" + +#include <pthread.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + message_queue_t *send_queue; + message_queue_t *receive_queue; + socket_link_t *socket_link; + pthread_t sender; + pthread_t receiver; + volatile int run; +} link_manager_t; + +link_manager_t *create_link_manager( + message_queue_t *send_queue, + message_queue_t *receive_queue, + socket_link_t *link); +void destroy_link_manager(link_manager_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* LINK_MANAGER_H */ diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c new file mode 100644 index 0000000000..3e06b5021a --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/message_queue.c @@ -0,0 +1,211 @@ +/******************************************************************************* + 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@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file message_queue.c + * \brief this is the implementation of a message queue + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#include "message_queue.h" +#include "log.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <pthread.h> + +message_queue_t *new_message_queue(void) +{ + message_queue_t *ret = NULL; + + ret = calloc(1, sizeof(message_queue_t)); + if (ret == NULL) + goto error; + + ret->mutex = calloc(1, sizeof(pthread_mutex_t)); + if (ret->mutex == NULL) + goto error; + if (pthread_mutex_init(ret->mutex, NULL)) + goto error; + + ret->cond = calloc(1, sizeof(pthread_cond_t)); + if (ret->cond == NULL) + goto error; + if (pthread_cond_init(ret->cond, NULL)) + goto error; + + return ret; + +error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + if (ret != NULL) { + free(ret->mutex); + free(ret->cond); + memset(ret, 0, sizeof(message_queue_t)); + free(ret); + } + return NULL; +} + +int message_put(message_queue_t *queue, void *data, int size, int priority) +{ + message_t *m = NULL; + + m = calloc(1, sizeof(message_t)); + if (m == NULL) + goto error; + + m->data = data; + m->size = size; + m->priority = priority; + m->next = NULL; + + if (pthread_mutex_lock(queue->mutex)) + goto error; + + if (queue->count == 0) + queue->head = m; + else + queue->tail->next = m; + queue->tail = m; + + queue->count++; + + if (pthread_cond_signal(queue->cond)) { + LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + pthread_mutex_unlock(queue->mutex); + exit(1); + } + if (pthread_mutex_unlock(queue->mutex)) { + LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + + return 0; + +error: + free(m); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int message_get(message_queue_t *queue, void **data, int *size, int *priority) +{ + message_t *m; + + if (pthread_mutex_lock(queue->mutex)) + goto error; + + while (queue->count == 0) { + if (pthread_cond_wait(queue->cond, queue->mutex)) { + pthread_mutex_unlock(queue->mutex); + goto error; + } + } + + m = queue->head; + queue->head = queue->head->next; + if (queue->head == NULL) + queue->tail = NULL; + + queue->count--; + + if (pthread_mutex_unlock(queue->mutex)) + goto error; + + *data = m->data; + *size = m->size; + *priority = m->priority; + free(m); + + return 0; + +error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +/* when calling this function, the queue must not be used anymore (we don't lock it) */ +/* we suppose that the data pointer in messages was allocated by malloc/calloc/realloc */ +void destroy_message_queue(message_queue_t *queue) +{ + while (queue->head) { + message_t *m = queue->head; + queue->head = queue->head->next; + free(m->data); + memset(m, 0, sizeof(message_t)); + free(m); + } + free(queue->mutex); + free(queue->cond); + memset(queue, 0, sizeof(message_queue_t)); + free(queue); +} + +#ifdef TEST + +/* some very basic tests */ +int main(void) +{ + void *data; + int size; + int priority; + message_queue_t *q; + char *s; + + q = new_message_queue(); + if (q == NULL) goto error; + + if (message_put(q, "hello", 6, 0)) goto error; + if (message_put(q, "world", 6, 1)) goto error; + + if (message_get(q, &data, &size, &priority)) goto error; + printf("message:\n data: '%s'\n size: %d\n priority: %d\n", + (char *)data, size, priority); + if (message_get(q, &data, &size, &priority)) goto error; + printf("message:\n data: '%s'\n size: %d\n priority: %d\n", + (char *)data, size, priority); + + /* let's put a message before destroying the queue */ + s = malloc(10); if (s == NULL) goto error; + sprintf(s, "hello"); + if (message_put(q, s, 6, 0)) goto error; + destroy_message_queue(q); + + return 0; + +error: + printf("error\n"); + return 1; +} + +#endif diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h new file mode 100644 index 0000000000..15fc4335a1 --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/message_queue.h @@ -0,0 +1,71 @@ +/******************************************************************************* + 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@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file message_queue.h + * \brief this is the implementation of a message queue + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#ifndef MESSAGE_QUEUE_H +#define MESSAGE_QUEUE_H + +#include <pthread.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct message_t { + void *data; + int size; + int priority; + struct message_t *next; +} message_t; + +typedef struct { + message_t *head; + message_t *tail; + volatile int count; + pthread_mutex_t *mutex; + pthread_cond_t *cond; +} message_queue_t; + +message_queue_t *new_message_queue(void); +int message_put(message_queue_t *queue, void *data, int size, int priority); +int message_get(message_queue_t *queue, void **data, int *size, int *priority); +void destroy_message_queue(message_queue_t *queue); + +#ifdef __cplusplus +} +#endif + +#endif /* MESSAGE_QUEUE_H */ diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c new file mode 100644 index 0000000000..0d63e41431 --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c @@ -0,0 +1,143 @@ +/******************************************************************************* + 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@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file ringbuffer_queue.c + * \brief Lock-free ringbuffer used for async message passing of agent + * \author Xenofon Foukas + * \date March 2016 + * \version 1.0 + * \email: x.foukas@sms.ed.ac.uk + * @ingroup _mac + */ + +#include "ringbuffer_queue.h" +#include "log.h" + +message_queue_t * new_message_queue(int size) { + + message_queue_t *ret = NULL; + + ret = calloc(1, sizeof(message_queue_t)); + if (ret == NULL) + goto error; + + lfds700_misc_library_init_valid_on_current_logical_core(); + lfds700_misc_prng_init(&(ret->ps)); + ret->ringbuffer_array = malloc(sizeof(struct lfds700_ringbuffer_element) * size); + lfds700_ringbuffer_init_valid_on_current_logical_core(&(ret->ringbuffer_state), + ret->ringbuffer_array, + size, + &(ret->ps), + NULL); + + return ret; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + if (ret != NULL) { + free(ret->ringbuffer_array); + memset(ret, 0, sizeof(message_queue_t)); + free(ret); + } + return NULL; +} + +int message_put(message_queue_t *queue, void *data, int size, int priority) { + + struct lfds700_misc_prng_state ls; + enum lfds700_misc_flag overwrite_occurred_flag; + message_t *overwritten_msg; + message_t *m = NULL; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + m = calloc(1, sizeof(message_t)); + if (m == NULL) + goto error; + + m->data = data; + m->size = size; + m->priority = priority; + + lfds700_ringbuffer_write(&(queue->ringbuffer_state), + NULL, + (void *) m, + &overwrite_occurred_flag, + NULL, + (void **) &overwritten_msg, + &ls); + + if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { + free(overwritten_msg->data); + free(overwritten_msg); + } + + return 0; + + error: + free(m); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int message_get(message_queue_t *queue, void **data, int *size, int *priority) { + message_t *m; + struct lfds700_misc_prng_state ls; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + if (lfds700_ringbuffer_read(&(queue->ringbuffer_state), NULL, (void **) &m, &ls) == 0) { + return -1; + } + + *data = m->data; + *size = m->size; + *priority = m->priority; + free(m); + return 0; +} + +message_queue_t destroy_message_queue(message_queue_t *queue) { + struct lfds700_misc_prng_state ls; + + message_t *m; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + while (lfds700_ringbuffer_read(&(queue->ringbuffer_state), NULL, (void **) &m, &ls) != 0) { + free(m->data); + memset(m, 0, sizeof(message_t)); + free(m); + } + free(queue->ringbuffer_array); + memset(queue, 0, sizeof(message_queue_t)); + free(queue); +} diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h new file mode 100644 index 0000000000..756a35ae4a --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h @@ -0,0 +1,60 @@ +/******************************************************************************* + 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@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file ringbuffer_queue.h + * \brief Lock-free ringbuffer used for async message passing of agent + * \author Xenofon Foukas + * \date March 2016 + * \version 1.0 + * \email: x.foukas@sms.ed.ac.uk + * @ingroup _mac + */ + +#ifndef RINGBUFFER_QUEUE_H +#define RINGBUFFER_QUEUE_H + +#include "liblfds700.h" + +typedef struct message_s { + void *data; + int size; + int priority; +} message_t; + +typedef struct { + struct lfds700_misc_prng_state ps; + struct lfds700_ringbuffer_element *ringbuffer_array; + struct lfds700_ringbuffer_state ringbuffer_state; +} message_queue_t; + +message_queue_t * new_message_queue(int size); +int message_put(message_queue_t *queue, void *data, int size, int priority); +int message_get(message_queue_t *queue, void **data, int *size, int *priority); +message_queue_t destroy_message_queue(message_queue_t *queue); + +#endif /* RINGBUFFER_QUEUE_H */ diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c new file mode 100644 index 0000000000..f4bd248f78 --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -0,0 +1,364 @@ +/******************************************************************************* + 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@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file socket_link.c + * \brief this is the implementation of a TCP socket ASYNC IF + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#include "socket_link.h" +#include "log.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/ip.h> +#include <netinet/tcp.h> +#include <arpa/inet.h> +#include <stdint.h> + +socket_link_t *new_link_server(int port) +{ + socket_link_t *ret = NULL; + int reuse; + struct sockaddr_in addr; + socklen_t addrlen; + int socket_server = -1; + int no_delay; + + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + ret->socket_fd = -1; + + LOG_D(MAC, "create a new link server socket at port %d\n", port); + + socket_server = socket(AF_INET, SOCK_STREAM, 0); + if (socket_server == -1) { + LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + reuse = 1; + if (setsockopt(socket_server, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) { + LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + no_delay = 1; + if (setsockopt(socket_server, IPPROTO_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { + LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = INADDR_ANY; + if (bind(socket_server, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + LOG_E(MAC, "%s:%d: bind: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + if (listen(socket_server, 5)) { + LOG_E(MAC, "%s:%d: listen: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + addrlen = sizeof(addr); + ret->socket_fd = accept(socket_server, (struct sockaddr *)&addr, &addrlen); + if (ret->socket_fd == -1) { + LOG_E(MAC, "%s:%d: accept: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + close(socket_server); + + LOG_D(MAC, "connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + return ret; + +error: + close(socket_server); + if (ret != NULL) close(ret->socket_fd); + free(ret); + LOG_E(MAC, "ERROR in new_link_server (see above), returning NULL\n"); + return NULL; +} + +socket_link_t *new_link_client(char *server, int port) +{ + socket_link_t *ret = NULL; + struct sockaddr_in addr; + int no_delay; + + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + ret->socket_fd = -1; + + LOG_D(MAC, "create a new link client socket connecting to %s:%d\n", server, port); + + ret->socket_fd = socket(AF_INET, SOCK_STREAM, 0); + if (ret->socket_fd == -1) { + LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + no_delay = 1; + if (setsockopt(ret->socket_fd, SOL_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { + LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + if (inet_aton(server, &addr.sin_addr) == 0) { + LOG_E(MAC, "invalid IP address '%s', use a.b.c.d notation\n", server); + goto error; + } + if (connect(ret->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + LOG_E(MAC, "%s:%d: connect: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + LOG_D(MAC, "connection to %s:%d established\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + return ret; + +error: + if (ret != NULL) close(ret->socket_fd); + free(ret); + LOG_E(MAC, "ERROR in new_link_client (see above), returning NULL\n"); + return NULL; +} + +/* + * return -1 on error and 0 if the sending was fine + */ +static int socket_send(int socket_fd, void *buf, int size) +{ + char *s = buf; + int l; + + while (size) { + l = send(socket_fd, s, size, MSG_NOSIGNAL); + if (l == -1) goto error; + if (l == 0) { LOG_E(MAC, "%s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } + size -= l; + s += l; + } + + return 0; + +error: + LOG_E(MAC, "socket_send: ERROR: %s\n", strerror(errno)); + return -1; +} + +/* + * return -1 on error and 0 if the receiving was fine + */ +static int socket_receive(int socket_fd, void *buf, int size) +{ + char *s = buf; + int l; + + while (size) { + l = read(socket_fd, s, size); + if (l == -1) goto error; + if (l == 0) goto socket_closed; + size -= l; + s += l; + } + + return 0; + +error: + LOG_E(MAC, "socket_receive: ERROR: %s\n", strerror(errno)); + return -1; + +socket_closed: + LOG_E(MAC, "socket_receive: socket closed\n"); + return -1; +} + +/* + * return -1 on error and 0 if the sending was fine + */ +int link_send_packet(socket_link_t *link, void *data, int size) +{ + char sizebuf[4]; + int32_t s = size; + + /* send the size first, maximum is 2^31 bytes */ + sizebuf[0] = (s >> 24) & 255; + sizebuf[1] = (s >> 16) & 255; + sizebuf[2] = (s >> 8) & 255; + sizebuf[3] = s & 255; + + if (socket_send(link->socket_fd, sizebuf, 4) == -1) + goto error; + + link->bytes_sent += 4; + + if (socket_send(link->socket_fd, data, size) == -1) + goto error; + + link->bytes_sent += size; + link->packets_sent++; + + return 0; + +error: + return -1; +} + +/* + * return -1 on error and 0 if the sending was fine + */ +int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) +{ + unsigned char sizebuf[4]; + int32_t size; + void *data = NULL; + + /* received the size first, maximum is 2^31 bytes */ + if (socket_receive(link->socket_fd, sizebuf, 4) == -1) + goto error; + + size = (sizebuf[0] << 24) | + (sizebuf[1] << 16) | + (sizebuf[2] << 8) | + sizebuf[3]; + + link->bytes_received += 4; + + data = malloc(size); + if (data == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + + if (socket_receive(link->socket_fd, data, size) == -1) + goto error; + + link->bytes_received += size; + link->packets_received++; + + *ret_data = data; + *ret_size = size; + return 0; + +error: + free(data); + *ret_data = NULL; + *ret_size = 0; + return -1; +} + +/* + * return -1 on error, 0 if all is fine + */ +int close_link(socket_link_t *link) +{ + close(link->socket_fd); + memset(link, 0, sizeof(socket_link_t)); + free(link); + return 0; +} + +#ifdef SERVER_TEST + +#include <inttypes.h> + +int main(void) +{ + void *data; + int size; + socket_link_t *l = new_link_server(2210); + if (l == NULL) { printf("no link created\n"); return 1; } + printf("link is up\n"); + printf("server starts sleeping...\n"); + /* this sleep is here to test for broken pipe. You can run "nc localhost 2210" + * and interrupt it quickly so that the server gets a 'broken' pipe on the + * following link_send_packet. + */ + sleep(1); + printf("... done\n"); + if (link_send_packet(l, "hello\n", 6+1) || + link_send_packet(l, "world\n", 6+1)) return 1; + if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); + if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); + printf("stats:\n"); + printf(" sent packets %"PRIu64"\n", l->packets_sent); + printf(" sent bytes %"PRIu64"\n", l->bytes_sent); + printf(" received packets %"PRIu64"\n", l->packets_received); + printf(" received bytes %"PRIu64"\n", l->bytes_received); + if (close_link(l)) return 1; + printf("link is down\n"); + return 0; +} + +#endif + +#ifdef CLIENT_TEST + +#include <inttypes.h> + +int main(void) +{ + void *data; + int size; + socket_link_t *l = new_link_client("127.0.0.1", 2210); + if (l == NULL) { printf("no link created\n"); return 1; } + printf("link is up\n"); + if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); + if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); + if (link_send_packet(l, "bye\n", 4+1) || + link_send_packet(l, "server\n", 7+1)) return 1; + printf("stats:\n"); + printf(" sent packets %"PRIu64"\n", l->packets_sent); + printf(" sent bytes %"PRIu64"\n", l->bytes_sent); + printf(" received packets %"PRIu64"\n", l->packets_received); + printf(" received bytes %"PRIu64"\n", l->bytes_received); + if (close_link(l)) return 1; + printf("link is down\n"); + return 0; +} + +#endif diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h new file mode 100644 index 0000000000..c9e99b839f --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/socket_link.h @@ -0,0 +1,65 @@ +/******************************************************************************* + 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@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file socket_link.h + * \brief this is the implementation of a TCP socket ASYNC IF + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#ifndef SOCKET_LINK_H +#define SOCKET_LINK_H + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int socket_fd; + uint64_t bytes_sent; + uint64_t packets_sent; + uint64_t bytes_received; + uint64_t packets_received; +} socket_link_t; + +socket_link_t *new_link_server(int port); +socket_link_t *new_link_client(char *server, int port); +int link_send_packet(socket_link_t *link, void *data, int size); +int link_receive_packet(socket_link_t *link, void **data, int *size); +int close_link(socket_link_t *link); + +#ifdef __cplusplus +} +#endif + +#endif /* SOCKET_LINK_H */ diff --git a/targets/COMMON/MESSAGES/V2/flexsplit.proto b/targets/COMMON/MESSAGES/V2/flexsplit.proto new file mode 100644 index 0000000000..270750e406 --- /dev/null +++ b/targets/COMMON/MESSAGES/V2/flexsplit.proto @@ -0,0 +1,44 @@ +package protocol; + +import "header.proto"; + +message flexsplit_message { + optional flexsplit_direction msg_dir = 100; + oneof msg { + fsp_hello hello_msg = 1; + } +} + +enum flexsplit_direction { + //option allow_alias = true; + NOT_SET = 0; + INITIATING_MESSAGE = 1; + SUCCESSFUL_OUTCOME=2; + UNSUCCESSFUL_OUTCOME=3; +} + +enum flexsplit_err { + option allow_alias = true; + // message errors + NO_ERR = 0; + MSG_DEQUEUING = -1; + MSG_ENQUEUING = -2; + MSG_DECODING = -3; + MSG_ENCODING = -4; + MSG_BUILD = -5; + MSG_NOT_SUPPORTED = -6; + MSG_NOT_HANDLED = -7; + MSG_NOT_VALIDATED = -8; + MSG_OUT_DATED = -9; + + // other erros + UNEXPECTED = -100; +} + +// +// Maintenance and discovery messages +// + +message fsp_hello { + optional fsp_header header = 1; +} \ No newline at end of file diff --git a/targets/COMMON/MESSAGES/V2/header.proto b/targets/COMMON/MESSAGES/V2/header.proto new file mode 100644 index 0000000000..937e601884 --- /dev/null +++ b/targets/COMMON/MESSAGES/V2/header.proto @@ -0,0 +1,13 @@ +package protocol; + +message fsp_header { + optional uint32 version = 1; + optional uint32 type = 2; + optional uint32 xid = 4; +} + +enum fsp_type { + // Discovery and maintenance messages + FSPT_HELLO = 0; +} + -- GitLab From bc5e30318fd2638f668f98c5bb0652c8f280e0ac Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Mon, 5 Sep 2016 14:09:22 +0300 Subject: [PATCH 003/308] Added proto_agent files for a simple message exchange in oaisim --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 499 ++++++++ openair2/LAYER2/PROTO_AGENT/proto_agent.h | 51 + .../LAYER2/PROTO_AGENT/proto_agent_async.c | 154 +++ .../LAYER2/PROTO_AGENT/proto_agent_async.h | 60 + .../LAYER2/PROTO_AGENT/proto_agent_common.c | 432 +++++++ .../LAYER2/PROTO_AGENT/proto_agent_common.h | 361 ++++++ .../LAYER2/PROTO_AGENT/proto_agent_defs.h | 133 +++ .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 150 +++ .../LAYER2/PROTO_AGENT/proto_agent_net_comm.c | 200 ++++ .../LAYER2/PROTO_AGENT/proto_agent_net_comm.h | 90 ++ .../liblfds700/build/gcc_and_gnumake/Makefile | 168 +++ .../build/gcc_kbuild_and_gnumake/Kbuild | 76 ++ .../build/gcc_kbuild_and_gnumake/Makefile | 14 + .../liblfds700.def | 69 ++ .../sdk_for_windows_7_and_gnumake/makefile | 114 ++ .../liblfds700.def | 69 ++ .../liblfds700.sln | 46 + .../liblfds700.vcxproj | 705 +++++++++++ .../liblfds700.vcxproj.filters | 279 +++++ .../liblfds700.vcxproj.user | 4 + .../driver_entry.c | 1 + .../liblfds700.def | 69 ++ .../liblfds700.sln | 46 + .../liblfds700.vcxproj | 733 ++++++++++++ .../liblfds700.vcxproj.filters | 279 +++++ .../liblfds700.vcxproj.user | 4 + .../driver_entry.c | 1 + .../liblfds700.def | 69 ++ .../liblfds700.sln | 59 + .../liblfds700.vcxproj | 1054 +++++++++++++++++ .../liblfds700.vcxproj.filters | 279 +++++ .../liblfds700.vcxproj.user | 4 + .../liblfds700/build/wdk_7.1/dirs | 3 + ..._entry_renamed_to_avoid_compiler_warning.c | 23 + .../liblfds700/build/wdk_7.1/liblfds700.def | 69 ++ .../readme_before_win_kernel_build.txt | 32 + ...me_before_win_kernel_dynamic_lib_build.bat | 22 + ...nme_before_win_kernel_static_lib_build.bat | 21 + .../liblfds700/build/wdk_7.1/sources.dynamic | 62 + .../liblfds700/build/wdk_7.1/sources.static | 60 + .../liblfds7.0.0/liblfds700/inc/liblfds700.h | 31 + .../lfds700_btree_addonly_unbalanced.h | 113 ++ .../inc/liblfds700/lfds700_freelist.h | 54 + .../inc/liblfds700/lfds700_hash_addonly.h | 127 ++ ...fds700_list_addonly_ordered_singlylinked.h | 85 ++ ...s700_list_addonly_singlylinked_unordered.h | 90 ++ .../liblfds700/inc/liblfds700/lfds700_misc.h | 192 +++ ...ds700_porting_abstraction_layer_compiler.h | 478 ++++++++ ...rting_abstraction_layer_operating_system.h | 133 +++ ...s700_porting_abstraction_layer_processor.h | 544 +++++++++ .../liblfds700/inc/liblfds700/lfds700_queue.h | 60 + ...ue_bounded_singleconsumer_singleproducer.h | 59 + .../inc/liblfds700/lfds700_ringbuffer.h | 69 ++ .../liblfds700/inc/liblfds700/lfds700_stack.h | 55 + ...lfds700_btree_addonly_unbalanced_cleanup.c | 117 ++ .../lfds700_btree_addonly_unbalanced_get.c | 467 ++++++++ .../lfds700_btree_addonly_unbalanced_init.c | 32 + .../lfds700_btree_addonly_unbalanced_insert.c | 156 +++ ...fds700_btree_addonly_unbalanced_internal.h | 23 + .../lfds700_btree_addonly_unbalanced_query.c | 121 ++ .../lfds700_freelist_cleanup.c | 36 + .../lfds700_freelist/lfds700_freelist_init.c | 27 + .../lfds700_freelist_internal.h | 5 + .../lfds700_freelist/lfds700_freelist_pop.c | 52 + .../lfds700_freelist/lfds700_freelist_push.c | 42 + .../lfds700_freelist/lfds700_freelist_query.c | 123 ++ .../lfds700_hash_addonly_cleanup.c | 61 + .../lfds700_hash_addonly_get.c | 37 + .../lfds700_hash_addonly_init.c | 54 + .../lfds700_hash_addonly_insert.c | 62 + .../lfds700_hash_addonly_internal.h | 5 + .../lfds700_hash_addonly_iterate.c | 58 + .../lfds700_hash_addonly_query.c | 112 ++ ...ist_addonly_ordered_singlylinked_cleanup.c | 37 + ...00_list_addonly_ordered_singlylinked_get.c | 29 + ...0_list_addonly_ordered_singlylinked_init.c | 37 + ...list_addonly_ordered_singlylinked_insert.c | 134 +++ ...st_addonly_ordered_singlylinked_internal.h | 5 + ..._list_addonly_ordered_singlylinked_query.c | 121 ++ ...t_addonly_singlylinked_unordered_cleanup.c | 37 + ..._list_addonly_singlylinked_unordered_get.c | 29 + ...list_addonly_singlylinked_unordered_init.c | 35 + ...st_addonly_singlylinked_unordered_insert.c | 193 +++ ..._addonly_singlylinked_unordered_internal.h | 5 + ...ist_addonly_singlylinked_unordered_query.c | 121 ++ .../src/lfds700_misc/lfds700_misc_cleanup.c | 15 + .../src/lfds700_misc/lfds700_misc_globals.c | 11 + .../src/lfds700_misc/lfds700_misc_init.c | 53 + .../src/lfds700_misc/lfds700_misc_internal.h | 10 + .../src/lfds700_misc/lfds700_misc_prng.c | 144 +++ .../src/lfds700_misc/lfds700_misc_query.c | 48 + .../src/lfds700_queue/lfds700_queue_cleanup.c | 48 + .../src/lfds700_queue/lfds700_queue_dequeue.c | 109 ++ .../src/lfds700_queue/lfds700_queue_enqueue.c | 74 ++ .../src/lfds700_queue/lfds700_queue_init.c | 43 + .../lfds700_queue/lfds700_queue_internal.h | 14 + .../src/lfds700_queue/lfds700_queue_query.c | 126 ++ ...ed_singleconsumer_singleproducer_cleanup.c | 30 + ...ed_singleconsumer_singleproducer_dequeue.c | 42 + ...ed_singleconsumer_singleproducer_enqueue.c | 39 + ...unded_singleconsumer_singleproducer_init.c | 63 + ...d_singleconsumer_singleproducer_internal.h | 5 + ...nded_singleconsumer_singleproducer_query.c | 70 ++ .../lfds700_ringbuffer_cleanup.c | 86 ++ .../lfds700_ringbuffer_init.c | 51 + .../lfds700_ringbuffer_internal.h | 5 + .../lfds700_ringbuffer_query.c | 72 ++ .../lfds700_ringbuffer_read.c | 44 + .../lfds700_ringbuffer_write.c | 78 ++ .../src/lfds700_stack/lfds700_stack_cleanup.c | 36 + .../src/lfds700_stack/lfds700_stack_init.c | 27 + .../lfds700_stack/lfds700_stack_internal.h | 5 + .../src/lfds700_stack/lfds700_stack_pop.c | 52 + .../src/lfds700_stack/lfds700_stack_push.c | 42 + .../src/lfds700_stack/lfds700_stack_query.c | 123 ++ .../liblfds700/src/liblfds700_internal.h | 93 ++ .../test/build/gcc_and_gnumake/Makefile | 129 ++ .../sdk_for_windows_7_and_gnumake/makefile | 106 ++ .../visual_studio_professional_2012/test.sln | 67 ++ .../test.vcxproj | 554 +++++++++ .../test.vcxproj.filters | 216 ++++ .../test.vcxproj.user | 4 + .../LFDS/liblfds7.0.0/test/src/internal.h | 157 +++ .../UTIL/LFDS/liblfds7.0.0/test/src/main.c | 135 +++ .../UTIL/LFDS/liblfds7.0.0/test/src/misc.c | 191 +++ .../test_lfds700_btree_addonly_unbalanced.c | 32 + ...ds700_btree_addonly_unbalanced_alignment.c | 64 + ...tree_addonly_unbalanced_random_adds_fail.c | 319 +++++ ...nbalanced_random_adds_fail_and_overwrite.c | 140 +++ ...addonly_unbalanced_random_adds_overwrite.c | 322 +++++ .../test/src/test_lfds700_freelist.c | 33 + .../src/test_lfds700_freelist_alignment.c | 43 + .../test/src/test_lfds700_freelist_popping.c | 205 ++++ ...est_lfds700_freelist_popping_and_pushing.c | 319 +++++ .../test/src/test_lfds700_freelist_pushing.c | 246 ++++ ...ds700_freelist_rapid_popping_and_pushing.c | 216 ++++ .../test/src/test_lfds700_hash_addonly.c | 33 + .../src/test_lfds700_hash_addonly_alignment.c | 40 + .../src/test_lfds700_hash_addonly_iterate.c | 224 ++++ ...st_lfds700_hash_addonly_random_adds_fail.c | 314 +++++ ...h_addonly_random_adds_fail_and_overwrite.c | 137 +++ ...ds700_hash_addonly_random_adds_overwrite.c | 388 ++++++ ...fds700_list_addonly_ordered_singlylinked.c | 31 + ...t_addonly_ordered_singlylinked_alignment.c | 58 + ...addonly_ordered_singlylinked_new_ordered.c | 278 +++++ ...red_singlylinked_new_ordered_with_cursor.c | 366 ++++++ ...s700_list_addonly_singlylinked_unordered.c | 32 + ...addonly_singlylinked_unordered_alignment.c | 61 + ...addonly_singlylinked_unordered_new_after.c | 254 ++++ ...t_addonly_singlylinked_unordered_new_end.c | 229 ++++ ...addonly_singlylinked_unordered_new_start.c | 229 ++++ ...lfds700_porting_abstraction_layer_atomic.c | 33 + ...700_porting_abstraction_layer_atomic_cas.c | 176 +++ ...00_porting_abstraction_layer_atomic_dcas.c | 177 +++ ...orting_abstraction_layer_atomic_exchange.c | 333 ++++++ .../test/src/test_lfds700_queue.c | 35 + .../test/src/test_lfds700_queue_alignment.c | 55 + ...ue_bounded_singleconsumer_singleproducer.c | 25 + ..._singleconsumer_singleproducer_dequeuing.c | 61 + ..._singleconsumer_singleproducer_enqueuing.c | 59 + ...r_singleproducer_enqueuing_and_dequeuing.c | 260 ++++ .../test/src/test_lfds700_queue_dequeuing.c | 215 ++++ .../test/src/test_lfds700_queue_enqueuing.c | 239 ++++ ...st_lfds700_queue_enqueuing_and_dequeuing.c | 250 ++++ ..._queue_enqueuing_and_dequeuing_with_free.c | 241 ++++ ...uing_with_malloc_and_dequeuing_with_free.c | 208 ++++ ...s700_queue_rapid_enqueuing_and_dequeuing.c | 264 +++++ .../test/src/test_lfds700_ringbuffer.c | 31 + .../src/test_lfds700_ringbuffer_reading.c | 217 ++++ ...t_lfds700_ringbuffer_reading_and_writing.c | 261 ++++ .../src/test_lfds700_ringbuffer_writing.c | 272 +++++ .../test/src/test_lfds700_stack.c | 33 + .../test/src/test_lfds700_stack_alignment.c | 43 + .../test/src/test_lfds700_stack_popping.c | 202 ++++ .../test_lfds700_stack_popping_and_pushing.c | 316 +++++ .../test/src/test_lfds700_stack_pushing.c | 251 ++++ ..._lfds700_stack_rapid_popping_and_pushing.c | 217 ++++ ...g_abstraction_layer_get_logical_core_ids.c | 245 ++++ ...rting_abstraction_layer_operating_system.h | 82 ++ ...t_porting_abstraction_layer_thread_start.c | 336 ++++++ ...st_porting_abstraction_layer_thread_wait.c | 69 ++ .../LFDS/liblfds7.0.0/test/src/util_cmdline.c | 184 +++ .../LFDS/liblfds7.0.0/test/src/util_cmdline.h | 69 ++ .../test/src/util_memory_helpers.c | 75 ++ .../test/src/util_memory_helpers.h | 5 + .../test/src/util_thread_starter.c | 151 +++ .../test/src/util_thread_starter.h | 41 + 187 files changed, 24588 insertions(+) create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent.c create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent.h create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent_async.c create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent_async.h create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent_common.c create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent_common.h create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c create mode 100644 openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c new file mode 100644 index 0000000000..c78c9d93d4 --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -0,0 +1,499 @@ +/******************************************************************************* + 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 enb_agent.h + * \brief top level enb agent receive thread and itti task + * \author Navid Nikaein and Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include "proto_agent_common.h" +#include "log.h" +#include "proto_agent.h" +//#include "enb_agent_mac_defs.h" // TODO: Check if they are needed + +//#include "enb_agent_extern.h" // TODO: Check if they are needed for this implementation + +#include "assertions.h" + +#include "proto_agent_net_comm.h" // TODO: Check if they are needed +#include "proto_agent_async.h" + +//#define TEST_TIMER + +proto_agent_instance_t proto_agent[NUM_MAX_ENB]; +proto_agent_instance_t proto_server[NUM_MAX_ENB]; + +// Use the same configuration file for the moment + +char in_ip[40]; +static uint16_t in_port; +char local_cache[40]; + +void *send_thread(void *args); +void *client_receive_thread(void *args); +void *server_receive_thread(void *args); +//void *server_send_thread(void *args); +pthread_t new_thread(void *(*f)(void *), void *b); +//Protocol__ProgranMessage *enb_agent_timeout_prp(void* args); +Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); + + +/* + * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller + * and can interact with other itti tasks +*/ +void *proto_agent_task(void *args){ + + proto_agent_instance_t *d = (proto_agent_instance_t *) args; + Protocol__FlexsplitMessage *msg; + void *data; + int size; + err_code_t err_code; + int priority; + + MessageDef *msg_p = NULL; + const char *msg_name = NULL; + instance_t instance; + int result; + + + itti_mark_task_ready(TASK_PROTO_AGENT); + + do { + // Wait for a message + itti_receive_msg (TASK_PROTO_AGENT, &msg_p); + DevAssert(msg_p != NULL); + msg_name = ITTI_MSG_NAME (msg_p); + instance = ITTI_MSG_INSTANCE (msg_p); + + switch (ITTI_MSG_ID(msg_p)) { + case TERMINATE_MESSAGE: + itti_exit_task (); + break; + + case MESSAGE_TEST: + LOG_I(PROTO_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); + break; + + case TIMER_HAS_EXPIRED: + msg = proto_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); + if (msg != NULL){ + data=proto_agent_pack_message(msg,&size); + if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(PROTO_AGENT,"sent message with size %d\n", size); + } + break; + + default: + LOG_E(PROTO_AGENT, "Received unexpected message %s\n", msg_name); + break; + } + + result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + continue; + error: + LOG_E(PROTO_AGENT,"proto_agent_task: error %d occured\n",err_code); + } while (1); + + return NULL; +} + +void *send_thread(void *args) { + + proto_agent_instance_t *d = args; + void *data; + int size; + int priority; + err_code_t err_code; + + Protocol__FlexsplitMessage *msg; + + void **init_msg; + int msg_flag = 0; + msg_flag = proto_agent_hello(d->enb_id, args, init_msg); + + if (msg_flag == -1) + { + LOG_E( PROTO_AGENT, "Server did not create the message\n"); + goto error; + } + if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, init_msg, sizeof(Protocol__FlexsplitMessage), 0)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(PROTO_AGENT,"sent message with size %d\n", size); + + +// msg=proto_agent_handle_message(d->enb_id, data, size); + + free(data); + + free(*init_msg); + // check if there is something to send back to the controller + if (msg != NULL){ + data=proto_agent_pack_message(msg,&size); + + if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(PROTO_AGENT,"sent message with size %d\n", size); + } + + //} + + return NULL; + +error: + LOG_E(PROTO_AGENT,"receive_thread: error %d occured\n",err_code); + return NULL; +} + +void *receive_thread(void *args) { + + proto_agent_instance_t *d = args; + void *data; + int size; + int priority; + err_code_t err_code; + + Protocol__FlexsplitMessage *msg; + + while (1) { + if (proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(PROTO_AGENT,"received message with size %d\n", size); + + + msg=proto_agent_handle_message(d->enb_id, data, size); + + free(data); + + // check if there is something to send back to the controller + if (msg != NULL){ + data=proto_agent_pack_message(msg,&size); + + if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(PROTO_AGENT,"sent message with size %d\n", size); + } + + } + + return NULL; + +error: + LOG_E(PROTO_AGENT,"receive_thread: error %d occured\n",err_code); + return NULL; +} + + +/* utility function to create a thread */ +pthread_t new_thread(void *(*f)(void *), void *b) { + pthread_t t; + pthread_attr_t att; + + if (pthread_attr_init(&att)){ + fprintf(stderr, "pthread_attr_init err\n"); + exit(1); + } + if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) { + fprintf(stderr, "pthread_attr_setdetachstate err\n"); + exit(1); + } + if (pthread_create(&t, &att, f, b)) { + fprintf(stderr, "pthread_create err\n"); + exit(1); + } + if (pthread_attr_destroy(&att)) { + fprintf(stderr, "pthread_attr_destroy err\n"); + exit(1); + } + + return t; +} + + +// This is the only function that we will call for the moment from this file +int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ + + int channel_id; + + printf("INSIDE PROTO_SERVER_START\n"); + // Maybe change the RAN_LTE_OAI to protocol?? (e.g. PDCP) + set_enb_vars(mod_id, RAN_LTE_OAI); + proto_server[mod_id].enb_id = mod_id; + + /* + * check the configuration - Getting all the values from the config file + */ + if (enb_properties->properties[mod_id]->proto_agent_cache != NULL) { + strncpy(local_cache, enb_properties->properties[mod_id]->proto_agent_cache, sizeof(local_cache)); + local_cache[sizeof(local_cache) - 1] = 0; + } else { + strcpy(local_cache, DEFAULT_PROTO_AGENT_CACHE); + } + + if (enb_properties->properties[mod_id]->proto_agent_ipv4_address != NULL) { + strncpy(in_ip, enb_properties->properties[mod_id]->proto_agent_ipv4_address, sizeof(in_ip) ); + in_ip[sizeof(in_ip) - 1] = 0; // terminate string + } else { + strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS ); + } + + if (enb_properties->properties[mod_id]->proto_agent_port != 0 ) { + in_port = enb_properties->properties[mod_id]->proto_agent_port; + } else { + in_port = DEFAULT_PROTO_AGENT_PORT ; + } + LOG_I(ENB_AGENT,"starting PROTO agent SERVER for module id %d on ipv4 %s, port %d\n", + proto_server[mod_id].enb_id, + in_ip, + in_port); + + /* + * Initialize the channel container + */ + proto_agent_init_channel_container(); + + /*Create the async channel info*/ + printf("Before creating the async server channe;\n"); + proto_agent_instance_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port); + printf("After creating the async server channe;\n"); + + /*Create a channel using the async channel info*/ + printf("Before creating the receive channel\n"); + + channel_id = proto_agent_create_channel((void *) channel_info, + proto_agent_async_msg_send, + proto_agent_async_msg_recv, + proto_agent_async_release); + + printf("After creating the receive channel\n"); + + if (channel_id <= 0) { + goto error; + } + printf("Before getting ing the receive thread\n"); + + proto_agent_channel_t *channel = get_channel(channel_id); + printf("After getting ing the receive thread\n"); + + if (channel == NULL) { + goto error; + } + + /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ + printf("Before registering the receive channel \n"); + + proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); + printf("After registering the receive channel\n"); + + /*Example of registration for a specific agent(MAC): + *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); + */ + + /*Initialize the continuous MAC stats update mechanism*/ + // For the moment we do not need this + // enb_agent_init_cont_mac_stats_update(mod_id); + printf("Before initializing the receive thread\n"); + //new_thread(send_thread, &proto_server[mod_id]); + new_thread(receive_thread, &proto_server[mod_id]); + printf("After initializing the receive thread\n"); + + /* + * initilize a timer + */ + printf("Before initializing the receive timer\n"); + + proto_agent_init_timer(); + + printf("After initializing the receive thread\n"); + + /* + * start the enb agent task for tx and interaction with the underlying network function + */ + + if (itti_create_task (TASK_PROTO_AGENT, proto_agent_task, (void *) &proto_server[mod_id]) < 0) { + LOG_E(PROTO_AGENT, "Create task for eNB Agent failed\n"); + return -1; + } + + new_thread(send_thread, &proto_server[mod_id]); + + + LOG_I(PROTO_AGENT,"server ends\n"); + return 0; + +error: + LOG_I(PROTO_AGENT,"there was an error\n"); + return 1; + +} + +int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ + + int channel_id; + + printf("Starting client\n"); + + // Maybe change the RAN_LTE_OAI to protocol?? (e.g. PDCP) + set_enb_vars(mod_id, RAN_LTE_OAI); + proto_agent[mod_id].enb_id = mod_id; + + /* + * check the configuration - Getting all the values from the config file + */ + if (enb_properties->properties[mod_id]->proto_agent_cache != NULL) { + strncpy(local_cache, enb_properties->properties[mod_id]->proto_agent_cache, sizeof(local_cache)); + local_cache[sizeof(local_cache) - 1] = 0; + } else { + strcpy(local_cache, DEFAULT_PROTO_AGENT_CACHE); + } + + if (enb_properties->properties[mod_id]->proto_agent_ipv4_address != NULL) { + strncpy(in_ip, enb_properties->properties[mod_id]->proto_agent_ipv4_address, sizeof(in_ip) ); + in_ip[sizeof(in_ip) - 1] = 0; // terminate string + } else { + strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS ); + } + + if (enb_properties->properties[mod_id]->proto_agent_port != 0 ) { + in_port = enb_properties->properties[mod_id]->proto_agent_port; + } else { + in_port = DEFAULT_PROTO_AGENT_PORT ; + } + LOG_I(PROTO_AGENT,"starting PROTO agent client for module id %d on ipv4 %s, port %d\n", + proto_agent[mod_id].enb_id, + in_ip, + in_port); + + /* + * Initialize the channel container + */ + proto_agent_init_channel_container(); + + /*Create the async channel info*/ + proto_agent_instance_t *channel_info = proto_agent_async_channel_info(mod_id, in_ip, in_port); + + /*Create a channel using the async channel info*/ + channel_id = proto_agent_create_channel((void *) channel_info, + proto_agent_async_msg_send, + proto_agent_async_msg_recv, + proto_agent_async_release); + + + if (channel_id <= 0) { + goto error; + } + + proto_agent_channel_t *channel = get_channel(channel_id); + + if (channel == NULL) { + goto error; + } + + /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ + proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); + + /*Example of registration for a specific agent(MAC): + *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); + */ + + /*Initialize the continuous MAC stats update mechanism*/ + // For the moment we do not need this + // enb_agent_init_cont_mac_stats_update(mod_id); + + new_thread(receive_thread, &proto_agent[mod_id]); + + /*Initialize and register the mac xface. Must be modified later + *for more flexibility in agent management */ + // We do not need this + // AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface)); + // enb_agent_register_mac_xface(mod_id, mac_agent_xface); + + /* + * initilize a timer + */ + + proto_agent_init_timer(); + + /* + * Initialize the mac agent + */ + //enb_agent_init_mac_agent(mod_id); + + /* + * start the enb agent task for tx and interaction with the underlying network function + */ + + if (itti_create_task (TASK_PROTO_AGENT, proto_agent_task, (void *) &proto_agent[mod_id]) < 0) { + LOG_E(PROTO_AGENT, "Create task for eNB Agent failed\n"); + return -1; + } + + LOG_I(PROTO_AGENT,"client ends\n"); + return 0; + +error: + LOG_I(PROTO_AGENT,"there was an error\n"); + return 1; + +} + + + + +Protocol__FlexsplitMessage *proto_agent_timeout(void* args){ + + // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); + //memcpy (timer_args, args, sizeof(*timer_args)); + proto_agent_timer_args_t *timer_args = (proto_agent_timer_args_t *) args; + + LOG_I(PROTO_AGENT, "proto_agent %d timeout\n", timer_args->mod_id); + //LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); + //LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); + + return NULL; +} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h new file mode 100644 index 0000000000..b0d6020ce6 --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -0,0 +1,51 @@ + +/******************************************************************************* + 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 proto_agent.h + * \brief top level protocol agent + * \author Navid Nikaein and Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef PROTO_AGENT_H_ +#define PROTO_AGENT_H_ + +#include "ENB_APP/enb_config.h" // for enb properties +#include "proto_agent_common.h" + +int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); +int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); + +int proto_agent_stop(mid_t mod_id); + +void *proto_agent_task(void *args); + +#endif diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c new file mode 100644 index 0000000000..6299479bc4 --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -0,0 +1,154 @@ +/******************************************************************************* + 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 enb_agent_async.c + * \brief channel implementation for async interface + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include "proto_agent_async.h" +#include "proto_agent_defs.h" + +#include "log.h" + + +proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { + + proto_agent_async_channel_t *channel; + channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); + + if (channel == NULL) + goto error; + + channel->enb_id = mod_id; + /*Create a socket*/ + printf("Starting async server\n"); + new_thread(new_link_server, (void *) &dst_port); + channel->link = (void *) &dst_port; + printf("Started async server\n"); + if (channel->link == NULL) goto error; + + LOG_I(PROTO_AGENT,"starting proto agent server for module id %d on ipv4 %s, port %d\n", + channel->enb_id, + dst_ip, + dst_port); + + /* + * create a message queue + */ + + channel->send_queue = new_message_queue(); + if (channel->send_queue == NULL) goto error; + channel->receive_queue = new_message_queue(); + if (channel->receive_queue == NULL) goto error; + + /* + * create a link manager + */ + channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link); + if (channel->manager == NULL) goto error; + + return channel; + + error: + LOG_I(PROTO_AGENT,"there was an error\n"); + return 1; +} + + +proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { + + proto_agent_async_channel_t *channel; + channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); + + if (channel == NULL) + goto error; + + channel->enb_id = mod_id; + /*Create a socket*/ + channel->link = new_link_client(dst_ip, dst_port); + + if (channel->link == NULL) goto error; + + + LOG_I(PROTO_AGENT,"starting proto agent client for module id %d on ipv4 %s, port %d\n", + channel->enb_id, + dst_ip, + dst_port); + + /* + * create a message queue + */ + + channel->send_queue = new_message_queue(); + if (channel->send_queue == NULL) goto error; + channel->receive_queue = new_message_queue(); + if (channel->receive_queue == NULL) goto error; + + /* + * create a link manager + */ + channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link); + if (channel->manager == NULL) goto error; + + return channel; + + error: + LOG_I(PROTO_AGENT,"there was an error\n"); + return 1; +} + +int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { + proto_agent_async_channel_t *channel; + channel = (proto_agent_channel_t *)channel_info; + + return message_put(channel->send_queue, data, size, priority); +} + +int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { + proto_agent_async_channel_t *channel; + channel = (proto_agent_async_channel_t *)channel_info; + + return message_get(channel->receive_queue, data, size, priority); +} + +void proto_agent_async_release(proto_agent_channel_t *channel) { + proto_agent_async_channel_t *channel_info; + channel_info = (proto_agent_async_channel_t *) channel->channel_info; + + destroy_link_manager(channel_info->manager); + + destroy_message_queue(channel_info->send_queue); + destroy_message_queue(channel_info->receive_queue); + + close_link(channel_info->link); + free(channel_info); +} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h new file mode 100644 index 0000000000..e6abc72e6e --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h @@ -0,0 +1,60 @@ +/******************************************************************************* + 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 enb_agent_async.h + * \brief channel implementation for async interface + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef PROTO_AGENT_ASYNC_H_ +#define PROTO_AGENT_ASYNC_H_ + +#include "proto_agent_net_comm.h" + +typedef struct { + mid_t enb_id; + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; +} proto_agent_async_channel_t; + +proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); +proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); + +int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info); + +int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); + +void proto_agent_async_release(proto_agent_channel_t *channel); + + +#endif /*PROTO_AGENT_ASYNC_H_*/ diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c new file mode 100644 index 0000000000..0e6ed7d03b --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -0,0 +1,432 @@ +/******************************************************************************* + 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 proto_agent_common.c + * \brief common primitives for all agents + * \author Navid Nikaein and Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include<stdio.h> +#include <dlfcn.h> +#include <time.h> + +#include "proto_agent_common.h" +#include "PHY/extern.h" +#include "log.h" + +#include "RRC/LITE/extern.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "rrc_eNB_UE_context.h" + +void * enb[NUM_MAX_ENB]; +void * enb_ue[NUM_MAX_ENB]; +void * enb_rrc[NUM_MAX_ENB]; +/* + * message primitives + */ + +int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, int *size) { + + *size = protocol__flexsplit_message__get_packed_size(msg); + + *buf = malloc(*size); + if (buf == NULL) + goto error; + + protocol__flexsplit_message__pack(msg, *buf); + + return 0; + + error: + LOG_E(PROTO_AGENT, "an error occured\n"); // change the com + return -1; +} + + + +/* We assume that the buffer size is equal to the message size. + Should be chekced durint Tx/Rx */ +int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg) { + *msg = protocol__flexsplit_message__unpack(NULL, size, data); + if (*msg == NULL) + goto error; + + return 0; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + + +int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header) { + + *header = malloc(sizeof(Protocol__FspHeader)); + if(*header == NULL) + goto error; + + protocol__fsp_header__init(*header); + (*header)->version = FLEXSPLIT_VERSION; + (*header)->has_version = 1; + // check if the type is set + (*header)->type = type; + (*header)->has_type = 1; + (*header)->xid = xid; + (*header)->has_xid = 1; + return 0; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { + + Protocol__FspHeader *header; + /*TODO: Need to set random xid or xid from received hello message*/ + xid_t xid = 1; + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0) + goto error; + + Protocol__FspHello *hello_msg; + hello_msg = malloc(sizeof(Protocol__FspHello)); + if(hello_msg == NULL) + goto error; + protocol__fsp_hello__init(hello_msg); + hello_msg->header = header; + + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); + if(*msg == NULL) + goto error; + + protocol__flexsplit_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->has_msg_dir = 1; + (*msg)->hello_msg = hello_msg; + return 0; + + error: + if(header != NULL) + free(header); + if(hello_msg != NULL) + free(hello_msg); + if(*msg != NULL) + free(*msg); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) { + + if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG) + goto error; + + free(msg->hello_msg->header); + free(msg->hello_msg); + free(msg); + return 0; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +// call this function to start a nanosecond-resolution timer +struct timespec timer_start(){ + struct timespec start_time; + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time); + return start_time; +} + +// call this function to end a timer, returning nanoseconds elapsed as a long +long timer_end(struct timespec start_time){ + struct timespec end_time; + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time); + long diffInNanos = end_time.tv_nsec - start_time.tv_nsec; + return diffInNanos; +} + + +/* + * get generic info from RAN + */ + +void set_enb_vars(mid_t mod_id, ran_name_t ran){ + + switch (ran){ + case RAN_LTE_OAI : + enb[mod_id] = (void *)&eNB_mac_inst[mod_id]; + enb_ue[mod_id] = (void *)&eNB_mac_inst[mod_id].UE_list; + enb_rrc[mod_id] = (void *)&eNB_rrc_inst[mod_id]; + break; + default : + goto error; + } + + return; + + error: + LOG_E(PROTO_AGENT, "unknown RAN name %d\n", ran); +} + + +//struct proto_agent_map agent_map; +proto_agent_timer_instance_t timer_instance; +err_code_t proto_agent_init_timer(void){ + + LOG_I(PROTO_AGENT, "init RB tree\n"); + + RB_INIT(&timer_instance.proto_agent_head); + + /* + struct proto_agent_timer_element_s e; + memset(&e, 0, sizeof(proto_agent_timer_element_t)); + RB_INSERT(proto_agent_map, &agent_map, &e); + */ + return PROTOCOL__FLEXSPLIT_ERR__NO_ERR; +} + +RB_GENERATE(proto_agent_map,proto_agent_timer_element_s, entry, proto_agent_compare_timer); + +/* The timer_id might not be the best choice for the comparison */ +int proto_agent_compare_timer(struct proto_agent_timer_element_s *a, struct proto_agent_timer_element_s *b){ + + if (a->timer_id < b->timer_id) return -1; + if (a->timer_id > b->timer_id) return 1; + + // equal timers + return 0; +} + +err_code_t proto_agent_create_timer(uint32_t interval_sec, + uint32_t interval_usec, + agent_id_t agent_id, + instance_t instance, + uint32_t timer_type, + xid_t xid, + proto_agent_timer_callback_t cb, + void* timer_args, + long *timer_id){ + + struct proto_agent_timer_element_s *e = calloc(1, sizeof(*e)); + DevAssert(e != NULL); + +//uint32_t timer_id; + int ret=-1; + + if ((interval_sec == 0) && (interval_usec == 0 )) + return TIMER_NULL; + + if (timer_type >= PROTO_AGENT_TIMER_TYPE_MAX) + return TIMER_TYPE_INVALIDE; + + if (timer_type == PROTO_AGENT_TIMER_TYPE_ONESHOT){ + ret = timer_setup(interval_sec, + interval_usec, + TASK_PROTO_AGENT, + instance, + TIMER_ONE_SHOT, + timer_args, + timer_id); + + e->type = TIMER_ONE_SHOT; + } + else if (timer_type == PROTO_AGENT_TIMER_TYPE_PERIODIC ){ + ret = timer_setup(interval_sec, + interval_usec, + TASK_PROTO_AGENT, + instance, + TIMER_PERIODIC, + timer_args, + timer_id); + + e->type = TIMER_PERIODIC; + } + + if (ret < 0 ) { + return TIMER_SETUP_FAILED; + } + + e->agent_id = agent_id; + e->instance = instance; + e->state = PROTO_AGENT_TIMER_STATE_ACTIVE; + e->timer_id = *timer_id; + e->xid = xid; + e->timer_args = timer_args; + e->cb = cb; + /*element should be a real pointer*/ + RB_INSERT(proto_agent_map, &timer_instance.proto_agent_head, e); + + LOG_I(PROTO_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n", + e->timer_id, e->agent_id, e->instance); + + return 0; +} + +err_code_t proto_agent_destroy_timer(long timer_id){ + + struct proto_agent_timer_element_s *e = get_timer_entry(timer_id); + + if (e != NULL ) { + RB_REMOVE(proto_agent_map, &timer_instance.proto_agent_head, e); + proto_agent_destroy_flexsplit_message(e->timer_args->msg); + free(e); + } + + if (timer_remove(timer_id) < 0 ) + goto error; + + return 0; + + error: + LOG_E(PROTO_AGENT, "timer can't be removed\n"); + return TIMER_REMOVED_FAILED ; +} + +err_code_t proto_agent_destroy_timer_by_task_id(xid_t xid) { + struct proto_agent_timer_element_s *e = NULL; + long timer_id; + RB_FOREACH(e, proto_agent_map, &timer_instance.proto_agent_head) { + if (e->xid == xid) { + timer_id = e->timer_id; + RB_REMOVE(proto_agent_map, &timer_instance.proto_agent_head, e); + proto_agent_destroy_flexsplit_message(e->timer_args->msg); + free(e); + if (timer_remove(timer_id) < 0 ) { + goto error; + } + } + } + return 0; + + error: + LOG_E(PROTO_AGENT, "timer can't be removed\n"); + return TIMER_REMOVED_FAILED ; +} + +err_code_t proto_agent_destroy_timers(void){ + + struct proto_agent_timer_element_s *e = NULL; + + RB_FOREACH(e, proto_agent_map, &timer_instance.proto_agent_head) { + RB_REMOVE(proto_agent_map, &timer_instance.proto_agent_head, e); + timer_remove(e->timer_id); + proto_agent_destroy_flexsplit_message(e->timer_args->msg); + free(e); + } + + return 0; + +} + +void proto_agent_sleep_until(struct timespec *ts, int delay) { + ts->tv_nsec += delay; + if(ts->tv_nsec >= 1000*1000*1000){ + ts->tv_nsec -= 1000*1000*1000; + ts->tv_sec++; + } + clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL); +} + +/* + int i =0; + RB_FOREACH(e, proto_agent_map, &proto_agent_head) { + printf("%d: %p\n", i, e); i++; + } +*/ + + +err_code_t proto_agent_stop_timer(long timer_id){ + + struct proto_agent_timer_element_s *e=NULL; + struct proto_agent_timer_element_s search; + memset(&search, 0, sizeof(struct proto_agent_timer_element_s)); + search.timer_id = timer_id; + + e = RB_FIND(proto_agent_map, &timer_instance.proto_agent_head, &search); + + if (e != NULL ) { + e->state = PROTO_AGENT_TIMER_STATE_STOPPED; + } + + timer_remove(timer_id); + + return 0; +} + +struct proto_agent_timer_element_s * get_timer_entry(long timer_id) { + + struct proto_agent_timer_element_s search; + memset(&search, 0, sizeof(struct proto_agent_timer_element_s)); + search.timer_id = timer_id; + + return RB_FIND(proto_agent_map, &timer_instance.proto_agent_head, &search); +} + +/* +// this will change the timer_id +err_code_t enb_agent_restart_timer(uint32_t *timer_id){ + + struct enb_agent_timer_element_s *e=NULL; + + RB_FOREACH(e, enb_agent_map, &enb_agent_head) { + if (e->timer_id == timer_id) + break; + } + + if (e != NULL ) { + e->state = ENB_AGENT_TIMER_STATE_ACTIVE; + } + + ret = timer_setup(e->interval_sec, + e->interval_usec, + e->agent_id, + e->instance, + e->type, + e->timer_args, + &timer_id); + + } + + if (ret < 0 ) { + return PROTOCOL__PROGRAN_ERR__TIMER_SETUP_FAILED; + } + + return 0; + +} + +*/ + diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h new file mode 100644 index 0000000000..df8e320719 --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -0,0 +1,361 @@ +/******************************************************************************* + 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 enb_agent_common.h + * \brief common message primitves and utilities + * \author Navid Nikaein and Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + + + +#ifndef PROTO_AGENT_COMMON_H_ +#define PROTO_AGENT_COMMON_H_ + +#include <time.h> + +#include "header.pb-c.h" +#include "flexsplit.pb-c.h" + +// Do not need these +//#include "stats_messages.pb-c.h" +//#include "stats_common.pb-c.h" + +#include "proto_agent_defs.h" +#include "enb_config.h" + +#include "LAYER2/MAC/extern.h" +#include "LAYER2/RLC/rlc.h" + +# include "tree.h" +# include "intertask_interface.h" +# include "timer.h" + +#define FLEXSPLIT_VERSION 0 + +typedef int (*proto_agent_message_decoded_callback)( + mid_t mod_id, + const void *params, + Protocol__FlexsplitMessage **msg +); + +typedef int (*proto_agent_message_destruction_callback)( + Protocol__FlexsplitMessage *msg +); + +/********************************** + * progRAN protocol messages helper + * functions and generic handlers + **********************************/ + +int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, int *size); +int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg); + +void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, + uint32_t * size); + +err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg); + +int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header); + +int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg); + +Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, + uint8_t *data, + uint32_t size); + +Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args); + + + + +/**************************** + * get generic info from RAN + ****************************/ + +void set_enb_vars(mid_t mod_id, ran_name_t ran); + +// int get_current_time_ms (mid_t mod_id, int subframe_flag); + +/*Return the current frame number + *Could be using implementation specific numbering of frames + */ +// unsigned int get_current_frame(mid_t mod_id); + +/* Do not need these */ + +///*Return the current SFN (0-1023)*/ +//unsigned int get_current_system_frame_num(mid_t mod_id); +// +//unsigned int get_current_subframe(mid_t mod_id); + +///*Return the frame and subframe number in compact 16-bit format. +// Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/ +// uint16_t get_sfn_sf (mid_t mod_id); +// +// int get_num_ues(mid_t mod_id); +// +// int get_ue_crnti (mid_t mod_id, mid_t ue_id); +// +// int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); +// +// int get_ue_phr (mid_t mod_id, mid_t ue_id); +// +// int get_ue_wcqi (mid_t mod_id, mid_t ue_id); +// +// int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); +// +// int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id); +// +// int get_active_CC(mid_t mod_id, mid_t ue_id); +// +// int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); +// +// int get_n1pucch_an(mid_t mod_id, int CC_id); +// +// int get_nRB_CQI(mid_t mod_id, int CC_id); +// +// int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); +// +// int get_prach_ConfigIndex(mid_t mod_id, int CC_id); +// +// int get_prach_FreqOffset(mid_t mod_id, int CC_id); +// +// int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); +// +// int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); +// +// int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); +// +// int get_cell_id(mid_t mod_id, int CC_id); +// +// int get_srs_BandwidthConfig(mid_t mod_id, int CC_id); +// +// int get_srs_SubframeConfig(mid_t mod_id, int CC_id); +// +// int get_srs_MaxUpPts(mid_t mod_id, int CC_id); +// +// int get_N_RB_DL(mid_t mod_id, int CC_id); +// +// int get_N_RB_UL(mid_t mod_id, int CC_id); +// +// int get_subframe_assignment(mid_t mod_id, int CC_id); +// +// int get_special_subframe_assignment(mid_t mod_id, int CC_id); +// +// int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); +// +// int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); +// +// int get_duplex_mode(mid_t mod_id, int CC_id); +// +// long get_si_window_length(mid_t mod_id, int CC_id); +// +// int get_num_pdcch_symb(mid_t mod_id, int CC_id); +// +// int get_tpc(mid_t mod_id, mid_t ue_id); +// +// int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, +// const int frame, const uint8_t subframe, int *id, int *status); + +/* + * ************************************ + * Get Messages for UE Configuration Reply + * ************************************ + */ + +// int get_time_alignment_timer(mid_t mod_id, mid_t ue_id); +// +// int get_meas_gap_config(mid_t mod_id, mid_t ue_id); +// +// int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); +// +// int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); +// +// int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); +// +// int get_half_duplex(mid_t ue_id); +// +// int get_intra_sf_hopping(mid_t ue_id); +// +// int get_type2_sb_1(mid_t ue_id); +// +// int get_ue_category(mid_t ue_id); +// +// int get_res_alloc_type1(mid_t ue_id); +// +// int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); +// +// int get_tti_bundling(mid_t mod_id, mid_t ue_id); +// +// int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); +// +// int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); +// +// int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); +// +// int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); +// +// int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); +// +// int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); +// +// int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); +// +// int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); +// +// int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); +// +// int get_extended_bsr_size(mid_t mod_id, mid_t ue_id); +// +// int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); +// +// int get_lcg(mid_t ue_id, mid_t lc_id); +// +// int get_direction(mid_t ue_id, mid_t lc_id); + + + +/******************* + * timer primitves + *******************/ + +#define TIMER_NULL -1 +#define TIMER_TYPE_INVALIDE -2 +#define TIMER_SETUP_FAILED -3 +#define TIMER_REMOVED_FAILED -4 +#define TIMER_ELEMENT_NOT_FOUND -5 + + +/* Type of the callback executed when the timer expired */ +typedef Protocol__FlexsplitMessage *(*proto_agent_timer_callback_t)(void*); + +typedef enum { + /* oneshot timer: */ + PROTO_AGENT_TIMER_TYPE_ONESHOT = 0x0, + + /* periodic timer */ + PROTO_AGENT_TIMER_TYPE_PERIODIC = 0x1, + + /* Inactive state: initial state for any timer. */ + PROTO_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2, + + /* Max number of states available */ + PROTO_AGENT_TIMER_TYPE_MAX, +} proto_agent_timer_type_t; + +typedef enum { + /* Inactive state: initial state for any timer. */ + PROTO_AGENT_TIMER_STATE_INACTIVE = 0x0, + + /* Inactive state: initial state for any timer. */ + PROTO_AGENT_TIMER_STATE_ACTIVE = 0x1, + + /* Inactive state: initial state for any timer. */ + PROTO_AGENT_TIMER_STATE_STOPPED = 0x2, + + /* Max number of states available */ + PROTO_AGENT_TIMER_STATE_MAX, +} proto_agent_timer_state_t; + +typedef struct proto_agent_timer_args_s{ + mid_t mod_id; + Protocol__FlexsplitMessage *msg; +} proto_agent_timer_args_t; + + +// Do we need this?? Probably not.. +typedef struct proto_agent_timer_element_s{ + RB_ENTRY(proto_agent_timer_element_s) entry; + + agent_id_t agent_id; + instance_t instance; + + proto_agent_timer_type_t type; + proto_agent_timer_state_t state; + + uint32_t interval_sec; + uint32_t interval_usec; + + long timer_id; /* Timer id returned by the timer API*/ + xid_t xid; /*The id of the task as received by the controller + message*/ + + proto_agent_timer_callback_t cb; + proto_agent_timer_args_t *timer_args; + +} proto_agent_timer_element_t; + +typedef struct proto_agent_timer_instance_s{ + RB_HEAD(proto_agent_map, proto_agent_timer_element_s) proto_agent_head; +}proto_agent_timer_instance_t; + +err_code_t proto_agent_init_timer(void); + +err_code_t proto_agent_create_timer(uint32_t interval_sec, + uint32_t interval_usec, + agent_id_t agent_id, + instance_t instance, + uint32_t timer_type, + xid_t xid, + proto_agent_timer_callback_t cb, + void* timer_args, + long *timer_id); + +err_code_t proto_agent_destroy_timers(void); +err_code_t proto_agent_destroy_timer(long timer_id); +err_code_t proto_agent_destroy_timer_by_task_id(xid_t xid); + +err_code_t proto_agent_stop_timer(long timer_id); + +err_code_t proto_agent_restart_timer(long *timer_id); + +struct proto_agent_timer_element_s * get_timer_entry(long timer_id); + +Protocol__FlexsplitMessage * proto_agent_process_timeout(long timer_id, void* timer_args); + +int proto_agent_compare_timer(struct proto_agent_timer_element_s *a, struct proto_agent_timer_element_s *b); + +/*Specify a delay in nanoseconds to timespec and sleep until then*/ +void proto_agent_sleep_until(struct timespec *ts, int delay); + +/* RB_PROTOTYPE is for .h files */ +RB_PROTOTYPE(proto_agent_map, proto_agent_timer_element_s, entry, proto_agent_compare_timer); + + +#endif + + + + + + + diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h new file mode 100644 index 0000000000..85559e864b --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h @@ -0,0 +1,133 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2016 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 enb_agent_defs.h + * \brief enb agent common definitions + * \author Navid Nikaein and Xenofon Foukas + * \date 2016 + * \version 0.1 + */ +#ifndef PROTO_AGENT_DEFS_H_ +#define PROTO_AGENT_DEFS_H_ + +#include <stdio.h> +#include <stdlib.h> +#include <pthread.h> +#include <string.h> + +#include "UTIL/ASYNC_IF/link_manager.h" + +#define NUM_MAX_ENB 2 +#define NUM_MAX_UE 2048 +#define DEFAULT_PROTO_AGENT_IPv4_ADDRESS "127.0.0.1" +#define DEFAULT_PROTO_AGENT_PORT 2210 +#define DEFAULT_PROTO_AGENT_CACHE "/mnt/oai_agent_cache" + +typedef enum { + + PROTO_AGENT_DEFAULT=0, + + ENB_AGENT_PHY=1, + ENB_AGENT_MAC=2, + ENB_AGENT_RLC=3, + ENB_AGENT_PDCP=4, + ENB_AGENT_RRC=5, + ENB_AGENT_S1AP=6, + ENB_AGENT_GTP=7, + ENB_AGENT_X2AP=8, + + ENB_AGENT_MAX=9, + +} agent_id_t; + +typedef enum { + /* no action */ + ENB_AGENT_ACTION_NONE = 0x0, + + /* send action */ + ENB_AGENT_ACTION_SEND = 0x1, + + /* apply action */ + ENB_AGENT_ACTION_APPLY = 0x2, + + /* clear action */ + ENB_AGENT_ACTION_CLEAR = 0x4, + + /* write action */ + ENB_AGENT_ACTION_WRITE = 0x8, + + /* filter action */ + ENB_AGENT_ACTION_FILTER = 0x10, + + /* preprocess action */ + ENB_AGENT_ACTION_PREPROCESS = 0x20, + + /* meter action */ + ENB_AGENT_ACTION_METER = 0x40, + + /* Max number of states available */ + ENB_AGENT_ACTION_MAX = 0x7f, +} agent_action_t; + + +typedef enum { + + RAN_LTE_OAI= 0, + + /* Max number of states available */ + RAN_NAME_MAX = 0x7f, +} ran_name_t; + +typedef uint8_t xid_t; +typedef uint8_t mid_t; // module or enb id +typedef uint8_t lcid_t; +typedef int32_t err_code_t; + + + +typedef struct { + /* general info */ + + /* stats */ + + uint32_t total_rx_msg; + uint32_t total_tx_msg; + + uint32_t rx_msg[NUM_MAX_ENB]; + uint32_t tx_msg[NUM_MAX_ENB]; + +}proto_agent_info_t; + +typedef struct { + mid_t enb_id; + proto_agent_info_t agent_info; + +}proto_agent_instance_t; + +#endif diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c new file mode 100644 index 0000000000..b3e39bbd65 --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -0,0 +1,150 @@ +/******************************************************************************* + 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 enb_agent_handler.c + * \brief enb agent tx and rx message handler + * \author Navid Nikaein and Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + + +#include "proto_agent_common.h" + +//#include "enb_agent_mac.h" // Do we need this? + +#include "log.h" + +#include "assertions.h" + +proto_agent_message_decoded_callback agent_messages_callback[][3] = { + {proto_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ +}; + +proto_agent_message_destruction_callback message_destruction_callback[] = { + proto_agent_destroy_hello, +}; + +static const char *proto_agent_direction2String[] = { + "", /* not_set */ + "originating message", /* originating message */ + "successfull outcome", /* successfull outcome */ + "unsuccessfull outcome", /* unsuccessfull outcome */ +}; + + +Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, + uint8_t *data, + uint32_t size){ + + Protocol__FlexsplitMessage *decoded_message, *reply_message; + err_code_t err_code; + DevAssert(data != NULL); + + if (proto_agent_deserialize_message(data, size, &decoded_message) < 0) { + err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; + goto error; + } + + // Undestand why these calculations take place + if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) || + (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)){ + err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; + goto error; + } + + if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { + err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_SUPPORTED; + goto error; + + } + + err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); + if ( err_code < 0 ){ + goto error; + } else if (err_code == 1) { //If err_code > 1, we do not want to dispose the message yet + protocol__flexsplit_message__free_unpacked(decoded_message, NULL); + } + return reply_message; + +error: + LOG_E(PROTO_AGENT,"errno %d occured\n",err_code); + return NULL; + +} + + + +void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, + uint32_t * size){ + + void * buffer; + err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR; + + if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING; + goto error; + } + + // free the msg --> later keep this in the data struct and just update the values + //TODO call proper destroy function + err_code = ((*message_destruction_callback[msg->msg_case-1])(msg)); + + DevAssert(buffer !=NULL); + + LOG_D(PROTO_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); + + return buffer; + + error : + LOG_E(PROTO_AGENT,"errno %d occured\n",err_code); + + return NULL; +} + +Protocol__FlexsplitMessage* proto_agent_process_timeout(long timer_id, void* timer_args){ + + struct proto_agent_timer_element_s *found = get_timer_entry(timer_id); + + if (found == NULL ) goto error; +// LOG_I(PROTO_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); + + if (timer_args == NULL) + LOG_W(PROTO_AGENT,"null timer args\n"); + +// return found->cb(timer_args); + return 1; + error: + LOG_E(PROTO_AGENT, "can't get the timer element\n"); + return TIMER_ELEMENT_NOT_FOUND; +} + +err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg) { + return ((*message_destruction_callback[msg->msg_case-1])(msg)); +} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c new file mode 100644 index 0000000000..51a909261f --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -0,0 +1,200 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2016 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 enb_agent_net_comm.c + * \brief enb agent network interface abstraction + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include "proto_agent_net_comm.h" +#include "log.h" + +proto_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; +proto_agent_channel_instance_t channel_instance; +int proto_agent_channel_id = 0; + +int proto_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { + /*Check if agent id is valid*/ + if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + goto error; + } + proto_agent_channel_t *channel; + channel = agent_channel[mod_id][agent_id]; + + /*Check if agent has a channel registered*/ + if (channel == NULL) { + goto error; + } + + return channel->msg_send(data, size, priority, channel->channel_info); + + error: + LOG_E(PROTO_AGENT, "No channel registered for agent with id %d\n", agent_id); + return -1; +} + +int proto_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) { + /*Check if agent id is valid*/ + if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + goto error; + } + proto_agent_channel_t *channel; + channel = agent_channel[mod_id][agent_id]; + + /*Check if agent has a channel registered*/ + if (channel == NULL) { + goto error; + } + + return channel->msg_recv(data, size, priority, channel->channel_info); + + error: + LOG_E(PROTO_AGENT, "No channel registered for agent with id %d\n", agent_id); + return -1; +} + +int proto_agent_register_channel(mid_t mod_id, proto_agent_channel_t *channel, agent_id_t agent_id) { + int i; + + if (channel == NULL) { + return -1; + } + + if (agent_id == ENB_AGENT_MAX) { + for (i = 0; i < ENB_AGENT_MAX; i++) { + agent_channel[mod_id][i] = channel; + } + } else { + agent_channel[mod_id][agent_id] = channel; + } + return 0; +} + +void proto_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { + int i; + + if (agent_id == ENB_AGENT_MAX) { + for (i = 0; i < ENB_AGENT_MAX; i++) { + agent_channel[mod_id][i] = NULL; + } + } else { + agent_channel[mod_id][agent_id] = NULL; + } +} + +int proto_agent_create_channel(void *channel_info, + int (*msg_send)(void *data, int size, int priority, void *channel_info), + int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + void (*release)(proto_agent_channel_t *channel)) { + + int channel_id = ++proto_agent_channel_id; + proto_agent_channel_t *channel = (proto_agent_channel_t *) malloc(sizeof(proto_agent_channel_t)); + channel->channel_id = channel_id; + channel->channel_info = channel_info; + channel->msg_send = msg_send; + channel->msg_recv = msg_recv; + channel->release = release; + + /*element should be a real pointer*/ + RB_INSERT(proto_agent_channel_map, &channel_instance.proto_agent_head, channel); + + LOG_I(PROTO_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); + + return channel_id; +} + +int proto_agent_destroy_channel(int channel_id) { + int i, j; + + /*Check to see if channel exists*/ + struct proto_agent_channel_s *e = NULL; + struct proto_agent_channel_s search; + memset(&search, 0, sizeof(struct proto_agent_channel_s)); + + e = RB_FIND(proto_agent_channel_map, &channel_instance.proto_agent_head, &search); + + if (e == NULL) { + return -1; + } + + /*Unregister the channel from all agents*/ + for (i = 0; i < NUM_MAX_ENB; i++) { + for (j = 0; j < ENB_AGENT_MAX; j++) { + if (agent_channel[i][j] != NULL) { + if (agent_channel[i][j]->channel_id == e->channel_id) { + agent_channel[i][j] == NULL; + } + } + } + } + + /*Remove the channel from the tree and free memory*/ + RB_REMOVE(proto_agent_channel_map, &channel_instance.proto_agent_head, e); + e->release(e); + free(e); + + return 0; +} + +err_code_t proto_agent_init_channel_container(void) { + int i, j; + LOG_I(PROTO_AGENT, "init RB tree for channel container\n"); + + RB_INIT(&channel_instance.proto_agent_head); + + for (i = 0; i < NUM_MAX_ENB; i++) { + for (j = 0; j < ENB_AGENT_MAX; j++) { + agent_channel[i][j] == NULL; + } + } + + return 0; +} + +RB_GENERATE(proto_agent_channel_map,proto_agent_channel_s, entry, proto_agent_compare_channel); + +int proto_agent_compare_channel(struct proto_agent_channel_s *a, struct proto_agent_channel_s *b) { + if (a->channel_id < b->channel_id) return -1; + if (a->channel_id > b->channel_id) return 1; + + // equal timers + return 0; +} + +proto_agent_channel_t * get_channel(int channel_id) { + + struct proto_agent_channel_s search; + memset(&search, 0, sizeof(struct proto_agent_channel_s)); + search.channel_id = channel_id; + + return RB_FIND(proto_agent_channel_map, &channel_instance.proto_agent_head, &search); + +} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h new file mode 100644 index 0000000000..acdb5a5146 --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h @@ -0,0 +1,90 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2016 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 enb_agent_net_comm.h + * \brief enb agent network interface abstraction + * \autho Xenofon Foukas + * \date 2016 + * \version 0.1 + */ +#ifndef PROTO_AGENT_NET_COMM_H_ +#define PROTO_AGENT_NET_COMM_H_ + +#include "proto_agent_defs.h" + +#include "tree.h" + +/*Channel related information used for Tx/Rx of protocol messages*/ +typedef struct proto_agent_channel_s { + RB_ENTRY(proto_agent_channel_s) entry; +int channel_id; +void *channel_info; +/*Callbacks for channel message Tx and Rx*/ +int (*msg_send)(void *data, int size, int priority, void *channel_info); +int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); +void (*release)(struct proto_agent_channel_s *channel); +} proto_agent_channel_t; + +typedef struct proto_agent_channel_instance_s{ + RB_HEAD(proto_agent_channel_map, proto_agent_channel_s) proto_agent_head; +} proto_agent_channel_instance_t; + +/*Send and receive messages using the channel registered for a specific agent*/ +int proto_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); + +int proto_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority); + +/*Register a channel to an agent. Use ENB_AGENT_MAX to register the + *same channel to all agents*/ +int proto_agent_register_channel(mid_t mod_id, proto_agent_channel_t *channel, agent_id_t agent_id); + +/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/ +void proto_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id); + +/*Create a new channel. Returns the id of the new channel or negative number otherwise*/ +int proto_agent_create_channel(void *channel_info, + int (*msg_send)(void *data, int size, int priority, void *channel_info), + int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + void (*release)(proto_agent_channel_t *channel)); + +/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ +int proto_agent_destroy_channel(int channel_id); + +/*Return an agent communication channel based on its id*/ +proto_agent_channel_t * get_channel(int channel_id); + +/*Should be called before performing any channel operations*/ +err_code_t proto_agent_init_channel_container(void); + +int proto_agent_compare_channel(struct proto_agent_channel_s *a, struct proto_agent_channel_s *b); + +/* RB_PROTOTYPE is for .h files */ +RB_PROTOTYPE(proto_agent_channel_map, proto_agent_channel_s, entry, proto_agent_compare_channel); + +#endif /*ENB_AGENT_COMM_H_*/ diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile new file mode 100644 index 0000000000..27e4d91df3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile @@ -0,0 +1,168 @@ +##### paths ##### +BINDIR := ../../bin +INCDIR := ../../inc +OBJDIR := ../../obj +SRCDIR := ../../src + +##### misc ##### +QUIETLY := 1>/dev/null 2>/dev/null +VERSION_NUMBER := 1 +MINOR_NUMBER := 0 +RELEASE_NUMBER := 0 + +##### sources, objects and libraries ##### +BINNAME := liblfds700 +ARFILENAME := $(BINNAME).a +ARPATHNAME := $(BINDIR)/$(ARFILENAME) +SOBASENAME := $(BINNAME).so +SONAME := $(SOBASENAME).$(VERSION_NUMBER) +SOFILENAME := $(SONAME).$(MINOR_NUMBER).$(RELEASE_NUMBER) +SOPATHNAME := $(BINDIR)/$(SOFILENAME) +INCNAME := $(INCDIR)/$(BINNAME).h +SRCDIRS := lfds700_btree_addonly_unbalanced lfds700_freelist lfds700_hash_addonly lfds700_list_addonly_ordered_singlylinked lfds700_list_addonly_singlylinked_unordered lfds700_misc lfds700_queue lfds700_queue_bounded_singleconsumer_singleproducer lfds700_ringbuffer lfds700_stack +SOURCES := lfds700_hash_addonly_cleanup.c lfds700_hash_addonly_get.c lfds700_hash_addonly_init.c lfds700_hash_addonly_insert.c lfds700_hash_addonly_iterate.c lfds700_hash_addonly_query.c \ + lfds700_list_addonly_ordered_singlylinked_cleanup.c lfds700_list_addonly_ordered_singlylinked_get.c lfds700_list_addonly_ordered_singlylinked_init.c lfds700_list_addonly_ordered_singlylinked_insert.c lfds700_list_addonly_ordered_singlylinked_query.c \ + lfds700_list_addonly_singlylinked_unordered_cleanup.c lfds700_list_addonly_singlylinked_unordered_get.c lfds700_list_addonly_singlylinked_unordered_init.c lfds700_list_addonly_singlylinked_unordered_insert.c lfds700_list_addonly_singlylinked_unordered_query.c \ + lfds700_btree_addonly_unbalanced_cleanup.c lfds700_btree_addonly_unbalanced_get.c lfds700_btree_addonly_unbalanced_init.c lfds700_btree_addonly_unbalanced_insert.c lfds700_btree_addonly_unbalanced_query.c \ + lfds700_freelist_cleanup.c lfds700_freelist_init.c lfds700_freelist_pop.c lfds700_freelist_push.c lfds700_freelist_query.c \ + lfds700_misc_cleanup.c lfds700_misc_globals.c lfds700_misc_init.c lfds700_misc_prng.c lfds700_misc_query.c \ + lfds700_queue_cleanup.c lfds700_queue_dequeue.c lfds700_queue_enqueue.c lfds700_queue_init.c lfds700_queue_query.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c lfds700_queue_bounded_singleconsumer_singleproducer_init.c lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ + lfds700_ringbuffer_cleanup.c lfds700_ringbuffer_init.c lfds700_ringbuffer_query.c lfds700_ringbuffer_read.c lfds700_ringbuffer_write.c \ + lfds700_stack_cleanup.c lfds700_stack_init.c lfds700_stack_pop.c lfds700_stack_push.c lfds700_stack_query.c +OBJECTS := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES))) +SYSLIBS := + +##### default paths fix up ##### +CPATH := $(subst : ,:,$(SRCDIR):$(INCDIR)) + +##### tools ##### +MAKE := make +MFLAGS := + +DG := gcc +DGFLAGS := -MM -std=gnu89 + +CC := gcc +CFBASE := -c -fno-strict-aliasing -std=gnu89 -Wall -Werror -Wno-unknown-pragmas -Wno-unused-but-set-variable -Wno-unused-variable +CFCOV := -O0 -ggdb -DCOVERAGE -fprofile-arcs -ftest-coverage +CFDBG := -O0 -ggdb -D_DEBUG +CFPROF := -O0 -ggdb -DPROF -pg +CFREL := -O2 -DNDEBUG -finline-functions +CFTSAN := -O0 -ggdb -DTSAN -fsanitize=thread -fPIC +CFBARE := -ffreestanding -nodefaultlibs -nostdinc -nostdlib + +AR := ar +AFLAGS := -rcs + +LD := gcc +LFBASE := -pthread -shared -std=gnu89 -Wl,-soname,$(SONAME) -o $(SOPATHNAME) -Wall -Werror +LFCOV := -O0 -fprofile-arcs -ftest-coverage +LFDBG := -O0 -ggdb +LFPROF := -O0 -pg +LFREL := -O2 -s -finline-functions +LFTSAN := -O0 -fsanitize=thread -fPIC +LFBARE := -ffreestanding -nodefaultlibs -nostdinc -nostdlib + +##### CPU variants ##### +GCCARCH := native +CFBASE += -march=$(GCCARCH) + +##### build variants ##### +ifeq ($(findstring so,$(MAKECMDGOALS)),so) + CFBASE += -fPIC +endif + +CFLAGS += $(CFBASE) +LFLAGS += $(LFBASE) + +ifeq ($(MAKECMDGOALS),) + CFLAGS += $(CFDBG) + LFLAGS += $(LFDBG) +endif + +ifeq ($(findstring cov,$(MAKECMDGOALS)),cov) + CFLAGS += $(CFCOV) + LFLAGS += $(LFCOV) + SYSLIBS += -lgcov +endif + +ifeq ($(findstring dbg,$(MAKECMDGOALS)),dbg) + CFLAGS += $(CFDBG) + LFLAGS += $(LFDBG) +endif + +ifeq ($(findstring prof,$(MAKECMDGOALS)),prof) + CFLAGS += $(CFPROF) + LFLAGS += $(LFPROF) +endif + +ifeq ($(findstring rel,$(MAKECMDGOALS)),rel) + CFLAGS += $(CFREL) + LFLAGS += $(LFREL) +endif + +ifeq ($(findstring tsan,$(MAKECMDGOALS)),tsan) + CFLAGS += $(CFTSAN) + LFLAGS += $(LFTSAN) +endif + +ifeq ($(findstring b_,$(MAKECMDGOALS)),b_) + CFLAGS += $(CFBARE) + LFLAGS += $(CFBARE) +endif + +##### search paths ##### +vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS)) + +##### implicit rules ##### +$(OBJDIR)/%.o : %.c + $(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d + $(CC) $(CFLAGS) -o $@ $< + +##### explicit rules ##### +$(ARPATHNAME) : $(OBJECTS) + $(AR) $(AFLAGS) $(ARPATHNAME) $(OBJECTS) + +$(SOPATHNAME) : $(OBJECTS) + $(LD) $(LFLAGS) $(OBJECTS) -o $(SOPATHNAME) + @ln -fs $(SOFILENAME) $(BINDIR)/$(SONAME) + @ln -fs $(SOFILENAME) $(BINDIR)/$(SOBASENAME) + +##### phony ##### +.PHONY : clean bare_ar_cov bare_ar_dbg bare_ar_prof bare_ar_rel bare_ar_tsan bare_so_cov bare_so_dbg bare_so_prof bare_so_rel bare_so_tsan hosted_ar_cov hosted_ar_dbg hosted_ar_prof hosted_ar_rel hosted_ar_tsan hosted_so_cov hosted_so_dbg hosted_so_prof hosted_so_rel hosted_so_tsan + +clean : + @rm -f $(BINDIR)/* $(OBJDIR)/* + +bare_ar_cov : $(ARPATHNAME) # bare, archive (.a), coverage +bare_ar_dbg : $(ARPATHNAME) # bare, archive (.a), debug +bare_ar_prof : $(ARPATHNAME) # bare, archive (.a), profiling +bare_ar_rel : $(ARPATHNAME) # bare, archive (.a), release +bare_ar_tsan : $(ARPATHNAME) # bare, archive (.a), thread sanitizer + +bare_so_cov : $(SOPATHNAME) # bare, shared (.so), coverage +bare_so_dbg : $(SOPATHNAME) # bare, shared (.so), debug +bare_so_prof : $(SOPATHNAME) # bare, shared (.so), profiling +bare_so_rel : $(SOPATHNAME) # bare, shared (.so), release +bare_so_tsan : $(SOPATHNAME) # bare, shared (.so), thread sanitizer + +hosted_ar_cov : $(ARPATHNAME) # hosted implementation, archive (.a), coverage +hosted_ar_dbg : $(ARPATHNAME) # hosted implementation, archive (.a), debug +hosted_ar_prof : $(ARPATHNAME) # hosted implementation, archive (.a), profiling +hosted_ar_rel : $(ARPATHNAME) # hosted implementation, archive (.a), release +hosted_ar_tsan : $(ARPATHNAME) # hosted implementation, archive (.a), thread sanitizer + +hosted_so_cov : $(SOPATHNAME) # hosted implementation, shared (.so), coverage +hosted_so_dbg : $(SOPATHNAME) # hosted implementation, shared (.so), debug +hosted_so_prof : $(SOPATHNAME) # hosted implementation, shared (.so), profiling +hosted_so_rel : $(SOPATHNAME) # hosted implementation, shared (.so), release +hosted_so_tsan : $(SOPATHNAME) # hosted implementation, shared (.so), thread sanitizer + +##### dependencies ##### +-include $(DEPENDS) + +##### notes ##### +# TRD : we use -std=gnu89 for C++ style comments +# hosted implementation differs from bare simply in that <assert.h> ends up being included + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild new file mode 100644 index 0000000000..1ae6b36240 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild @@ -0,0 +1,76 @@ +lib-y := + +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.o +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.o +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.o +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.o +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.o + +lib-y += ../../src/lfds700_freelist/lfds700_freelist_cleanup.o +lib-y += ../../src/lfds700_freelist/lfds700_freelist_init.o +lib-y += ../../src/lfds700_freelist/lfds700_freelist_pop.o +lib-y += ../../src/lfds700_freelist/lfds700_freelist_push.o +lib-y += ../../src/lfds700_freelist/lfds700_freelist_query.o + +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_get.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_init.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_insert.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_query.o + +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.o +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.o +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.o +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.o +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.o + +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.o +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.o +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.o +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.o +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.o + +lib-y += ../../src/lfds700_misc/lfds700_misc_cleanup.o +lib-y += ../../src/lfds700_misc/lfds700_misc_globals.o +lib-y += ../../src/lfds700_misc/lfds700_misc_init.o +lib-y += ../../src/lfds700_misc/lfds700_misc_prng.o +lib-y += ../../src/lfds700_misc/lfds700_misc_query.o + +lib-y += ../../src/lfds700_queue/lfds700_queue_cleanup.o +lib-y += ../../src/lfds700_queue/lfds700_queue_dequeue.o +lib-y += ../../src/lfds700_queue/lfds700_queue_enqueue.o +lib-y += ../../src/lfds700_queue/lfds700_queue_init.o +lib-y += ../../src/lfds700_queue/lfds700_queue_query.o + +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.o +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.o +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.o +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.o +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.o + +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.o +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_init.o +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_query.o +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_read.o +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_write.o + +lib-y += ../../src/lfds700_stack/lfds700_stack_cleanup.o +lib-y += ../../src/lfds700_stack/lfds700_stack_init.o +lib-y += ../../src/lfds700_stack/lfds700_stack_pop.o +lib-y += ../../src/lfds700_stack/lfds700_stack_push.o +lib-y += ../../src/lfds700_stack/lfds700_stack_query.o + +libs-y := ../../bin/ + +ccflags-y := -I$(src)/../../inc +ccflags-y += -I$(src)/../../inc/liblfds700 +ccflags-y += -D_KERNEL_MODE +ccflags-y += -fno-strict-aliasing +ccflags-y += -std=gnu89 +ccflags-y += -Wall +ccflags-y += -Werror +ccflags-y += -Wno-unknown-pragmas +ccflags-y += -Wno-unused-but-set-variable +ccflags-y += -Wno-unused-variable + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile new file mode 100644 index 0000000000..d6de5f4b5d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile @@ -0,0 +1,14 @@ +default: + $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) + +clean: + $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) clean + find ../../src/ -name "*.o" -type f -delete + +help: + $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) help + +modules: + $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) modules + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile new file mode 100644 index 0000000000..7b257c9277 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile @@ -0,0 +1,114 @@ +##### paths ##### +BINDIR := ..\..\bin +INCDIR := ..\..\inc +OBJDIR := ..\..\obj +SRCDIR := ..\..\src + +##### misc ##### +QUIETLY := 1>nul 2>nul +NULL := +SPACE := $(NULL) # TRD : with a trailing space + +##### sources, objects and libraries ##### +BINNAME := liblfds700 +LIB_BINARY := $(BINDIR)\$(BINNAME).lib +DLL_BINARY := $(BINDIR)\$(BINNAME).dll +SRCDIRS := lfds700_btree_addonly_unbalanced lfds700_freelist lfds700_hash_addonly lfds700_list_addonly_ordered_singlylinked lfds700_list_addonly_singlylinked_unordered lfds700_misc lfds700_queue lfds700_queue_bounded_singleconsumer_singleproducer lfds700_ringbuffer lfds700_stack +SOURCES := lfds700_hash_addonly_cleanup.c lfds700_hash_addonly_get.c lfds700_hash_addonly_init.c lfds700_hash_addonly_insert.c lfds700_hash_addonly_iterate.c lfds700_hash_addonly_query.c \ + lfds700_list_addonly_ordered_singlylinked_cleanup.c lfds700_list_addonly_ordered_singlylinked_get.c lfds700_list_addonly_ordered_singlylinked_init.c lfds700_list_addonly_ordered_singlylinked_insert.c lfds700_list_addonly_ordered_singlylinked_query.c \ + lfds700_list_addonly_singlylinked_unordered_cleanup.c lfds700_list_addonly_singlylinked_unordered_get.c lfds700_list_addonly_singlylinked_unordered_init.c lfds700_list_addonly_singlylinked_unordered_insert.c lfds700_list_addonly_singlylinked_unordered_query.c \ + lfds700_btree_addonly_unbalanced_cleanup.c lfds700_btree_addonly_unbalanced_get.c lfds700_btree_addonly_unbalanced_init.c lfds700_btree_addonly_unbalanced_insert.c lfds700_btree_addonly_unbalanced_query.c \ + lfds700_freelist_cleanup.c lfds700_freelist_init.c lfds700_freelist_pop.c lfds700_freelist_push.c lfds700_freelist_query.c \ + lfds700_misc_cleanup.c lfds700_misc_globals.c lfds700_misc_init.c lfds700_misc_prng.c lfds700_misc_query.c \ + lfds700_queue_cleanup.c lfds700_queue_dequeue.c lfds700_queue_enqueue.c lfds700_queue_init.c lfds700_queue_query.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c lfds700_queue_bounded_singleconsumer_singleproducer_init.c lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ + lfds700_ringbuffer_cleanup.c lfds700_ringbuffer_init.c lfds700_ringbuffer_query.c lfds700_ringbuffer_read.c lfds700_ringbuffer_write.c \ + lfds700_stack_cleanup.c lfds700_stack_init.c lfds700_stack_pop.c lfds700_stack_push.c lfds700_stack_query.c +OBJECTS := $(patsubst %.c,$(OBJDIR)/%.obj,$(notdir $(SOURCES))) +SYSLIBS := kernel32.lib + +##### default paths fix up ##### +INCDIRS := $(patsubst %,%;,$(INCDIR)) +INCLUDE += $(subst $(SPACE),,$(INCDIRS)) + +##### tools ##### +MAKE := make +MFLAGS := + +CC := cl +CBASE := /c "-I$(SRCDIR)" "/Fd$(BINDIR)\$(BINNAME).pdb" /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN /DUNICODE /D_UNICODE /DUNICODE /nologo /W4 /wd 4068 /WX +CFREL := /DNDEBUG /Ox +CFDBG := /D_DEBUG /Gm /Od /Zi + +AR := lib +AFLAGS := /nologo /subsystem:console /verbose /wx + +LD := link +LFBASE := /def:$(BINNAME).def /dll /nodefaultlib /nologo /nxcompat /subsystem:console /wx +LFREL := /incremental:no +LFDBG := /debug "/pdb:$(BINDIR)\$(BINNAME).pdb" + +##### variants ##### +CFLAGS := $(CBASE) $(CFDBG) /MTd +ASFLAGS := $(ASBASE) $(ASDBG) +LFLAGS := $(LFBASE) $(LFDBG) +CLIB := libcmtd.lib + +ifeq ($(MAKECMDGOALS),librel) + CFLAGS := $(CBASE) $(CFREL) /MT + ASFLAGS := $(ASBASE) $(ASREL) + LFLAGS := $(LFBASE) $(LFREL) + CLIB := libcmt.lib +endif + +ifeq ($(MAKECMDGOALS),libdbg) + CFLAGS := $(CBASE) $(CFDBG) /MTd + ASFLAGS := $(ASBASE) $(ASDBG) + LFLAGS := $(LFBASE) $(LFDBG) + CLIB := libcmtd.lib +endif + +ifeq ($(MAKECMDGOALS),dllrel) + CFLAGS := $(CBASE) $(CFREL) /MD + ASFLAGS := $(ASBASE) $(ASREL) + LFLAGS := $(LFBASE) $(LFREL) + CLIB := msvcrt.lib +endif + +ifeq ($(MAKECMDGOALS),dlldbg) + CFLAGS := $(CBASE) $(CFDBG) /MDd + ASFLAGS := $(ASBASE) $(ASDBG) + LFLAGS := $(LFBASE) $(LFDBG) + CLIB := msvcrtd.lib +endif + +##### search paths ##### +vpath %.c $(patsubst %,$(SRCDIR)/%;,$(SRCDIRS)) + +##### implicit rules ##### +$(OBJDIR)/%.obj : %.c + $(CC) $(CFLAGS) "/Fo$@" $< + +##### explicit rules ##### +$(LIB_BINARY) : $(OBJECTS) + $(AR) $(AFLAGS) $(OBJECTS) /out:$(LIB_BINARY) + +$(DLL_BINARY) : $(OBJECTS) + $(LD) $(LFLAGS) $(CLIB) $(SYSLIBS) $(OBJECTS) /out:$(DLL_BINARY) + +##### phony ##### +.PHONY : clean librel libdbg dllrel dlldbg + +clean : + @erase /Q $(BINDIR)\$(BINNAME).* $(OBJDIR)\*.obj $(QUIETLY) + +dlldbg : $(DLL_BINARY) +dllrel : $(DLL_BINARY) + +libdbg : $(LIB_BINARY) +librel : $(LIB_BINARY) + +##### notes ##### +# /wd 4068 : turn off "unknown pragma" warning + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln new file mode 100644 index 0000000000..b52c44e46f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug DLL|x64 = Debug DLL|x64 + Debug LIB|Win32 = Debug LIB|Win32 + Debug LIB|x64 = Debug LIB|x64 + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release LIB|Win32 = Release LIB|Win32 + Release LIB|x64 = Release LIB|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj new file mode 100644 index 0000000000..3d4bf6364f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj @@ -0,0 +1,705 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug DLL|Win32"> + <Configuration>Debug DLL</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug DLL|x64"> + <Configuration>Debug DLL</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|Win32"> + <Configuration>Debug LIB</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|x64"> + <Configuration>Debug LIB</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|Win32"> + <Configuration>Release DLL</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|x64"> + <Configuration>Release DLL</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|Win32"> + <Configuration>Release LIB</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|x64"> + <Configuration>Release LIB</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <AdditionalDependencies>kernel32.lib;msvcrtd.lib</AdditionalDependencies> + <LinkStatus> + </LinkStatus> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <MapExports>true</MapExports> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <GenerateMapFile>true</GenerateMapFile> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <OmitFramePointers>false</OmitFramePointers> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <OmitFramePointers>false</OmitFramePointers> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <MapExports>true</MapExports> + <OptimizeReferences>false</OptimizeReferences> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;msvcrtd.lib</AdditionalDependencies> + <GenerateMapFile>true</GenerateMapFile> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalDependencies>kernel32.lib;msvcrt.lib</AdditionalDependencies> + <LinkStatus> + </LinkStatus> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + </ClCompile> + <Link> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;msvcrt.lib</AdditionalDependencies> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\inc\liblfds700.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_btree_addonly_unbalanced.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_freelist.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_hash_addonly.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_ordered_singlylinked.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_singlylinked_unordered.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_misc.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_compiler.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_operating_system.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_processor.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue_bounded_singleconsumer_singleproducer.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_ringbuffer.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_stack.h" /> + <ClInclude Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_internal.h" /> + <ClInclude Include="..\..\src\lfds700_freelist\lfds700_freelist_internal.h" /> + <ClInclude Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_internal.h" /> + <ClInclude Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_internal.h" /> + <ClInclude Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_internal.h" /> + <ClInclude Include="..\..\src\lfds700_misc\lfds700_misc_internal.h" /> + <ClInclude Include="..\..\src\lfds700_queue\lfds700_queue_internal.h" /> + <ClInclude Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" /> + <ClInclude Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_internal.h" /> + <ClInclude Include="..\..\src\lfds700_stack\lfds700_stack_internal.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_get.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_init.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_insert.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_query.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_init.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_pop.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_push.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_query.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_get.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_init.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_insert.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_iterate.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_query.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_get.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_init.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_insert.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_query.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_get.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_init.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_insert.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_query.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_globals.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_init.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_prng.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_query.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_dequeue.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_enqueue.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_init.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_query.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_init.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_query.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_init.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_query.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_read.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_write.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_init.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_pop.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_push.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_query.c" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters new file mode 100644 index 0000000000..5ec0bea579 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters @@ -0,0 +1,279 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Header Files\liblfds700"> + <UniqueIdentifier>{258be429-7dac-4999-b995-753aa2f0c505}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_freelist"> + <UniqueIdentifier>{469abf8e-47d8-4678-bd66-7c7e65c5f52e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_ringbuffer"> + <UniqueIdentifier>{62ee141b-2acb-4555-b016-7be20a57f2bf}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_stack"> + <UniqueIdentifier>{19c73b0f-25e0-4166-9093-427f1dfb4f70}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_queue"> + <UniqueIdentifier>{00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_misc"> + <UniqueIdentifier>{400ae4e9-2281-4549-b918-59d1a27a2d07}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_btree_addonly_unbalanced"> + <UniqueIdentifier>{0b1fafc3-817b-4c18-8eb1-121884e3a29b}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_hash_addonly"> + <UniqueIdentifier>{bcbadc74-1748-4696-aad7-7fdbe5614624}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_list_addonly_ordered_singlylinked"> + <UniqueIdentifier>{c45194af-7b41-4c28-bc0e-1095ec347664}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_queue_bounded_singleconsumer_singleproducer"> + <UniqueIdentifier>{6250c4d5-ac8e-4c28-93de-0954c5bed1cb}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_list_addonly_singlylinked_unordered"> + <UniqueIdentifier>{3ac93721-1d81-49e4-9581-dbc12ace5c0c}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\inc\liblfds700.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_freelist\lfds700_freelist_internal.h"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_queue\lfds700_queue_internal.h"> + <Filter>Source Files\lfds700_queue</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_stack\lfds700_stack_internal.h"> + <Filter>Source Files\lfds700_stack</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_btree_addonly_unbalanced.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_freelist.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_hash_addonly.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_ordered_singlylinked.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_singlylinked_unordered.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_misc.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_compiler.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_operating_system.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_processor.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue_bounded_singleconsumer_singleproducer.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_ringbuffer.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_stack.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_internal.h"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_misc\lfds700_misc_internal.h"> + <Filter>Source Files\lfds700_misc</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_internal.h"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_internal.h"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_internal.h"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_internal.h"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_internal.h"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_cleanup.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_init.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_pop.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_push.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_query.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_cleanup.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_dequeue.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_enqueue.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_init.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_query.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_cleanup.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_init.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_pop.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_push.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_query.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_cleanup.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_get.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_init.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_insert.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_iterate.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_query.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_cleanup.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_globals.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_init.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_prng.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_query.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_cleanup.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_get.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_init.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_insert.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_query.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_cleanup.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_init.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_query.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_read.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_write.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_init.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_query.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_cleanup.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_get.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_init.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_insert.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_query.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_cleanup.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_get.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_init.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_insert.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_query.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user new file mode 100644 index 0000000000..7cbb3216ad --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c new file mode 100644 index 0000000000..9ea5612e54 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c @@ -0,0 +1 @@ +#include <wdf.h> diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln new file mode 100644 index 0000000000..b52c44e46f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug DLL|x64 = Debug DLL|x64 + Debug LIB|Win32 = Debug LIB|Win32 + Debug LIB|x64 = Debug LIB|x64 + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release LIB|Win32 = Release LIB|Win32 + Release LIB|x64 = Release LIB|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj new file mode 100644 index 0000000000..f19ead0c18 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj @@ -0,0 +1,733 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug DLL|Win32"> + <Configuration>Debug DLL</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug DLL|x64"> + <Configuration>Debug DLL</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|Win32"> + <Configuration>Debug LIB</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|x64"> + <Configuration>Debug LIB</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|Win32"> + <Configuration>Release DLL</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|x64"> + <Configuration>Release DLL</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|Win32"> + <Configuration>Release LIB</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|x64"> + <Configuration>Release LIB</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath);</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath);</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath);</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath);</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath);</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath);</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath);</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath);</LibraryPath> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <AdditionalDependencies>kernel32.lib;msvcrtd.lib</AdditionalDependencies> + <LinkStatus> + </LinkStatus> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <MapExports>true</MapExports> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <GenerateMapFile>true</GenerateMapFile> + <Driver>WDM</Driver> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <OmitFramePointers>false</OmitFramePointers> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <OmitFramePointers>false</OmitFramePointers> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <MapExports>true</MapExports> + <OptimizeReferences>false</OptimizeReferences> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;msvcrtd.lib</AdditionalDependencies> + <GenerateMapFile>true</GenerateMapFile> + <Driver>WDM</Driver> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalDependencies>kernel32.lib;msvcrt.lib</AdditionalDependencies> + <LinkStatus> + </LinkStatus> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <Driver>WDM</Driver> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;msvcrt.lib</AdditionalDependencies> + <Driver>WDM</Driver> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\inc\liblfds700.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_btree_addonly_unbalanced.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_freelist.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_hash_addonly.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_ordered_singlylinked.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_singlylinked_unordered.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_misc.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_compiler.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_operating_system.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_processor.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue_bounded_singleconsumer_singleproducer.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_ringbuffer.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_stack.h" /> + <ClInclude Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_internal.h" /> + <ClInclude Include="..\..\src\lfds700_freelist\lfds700_freelist_internal.h" /> + <ClInclude Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_internal.h" /> + <ClInclude Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_internal.h" /> + <ClInclude Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_internal.h" /> + <ClInclude Include="..\..\src\lfds700_misc\lfds700_misc_internal.h" /> + <ClInclude Include="..\..\src\lfds700_queue\lfds700_queue_internal.h" /> + <ClInclude Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" /> + <ClInclude Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_internal.h" /> + <ClInclude Include="..\..\src\lfds700_stack\lfds700_stack_internal.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_get.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_init.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_insert.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_query.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_init.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_pop.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_push.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_query.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_get.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_init.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_insert.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_iterate.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_query.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_get.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_init.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_insert.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_query.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_get.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_init.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_insert.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_query.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_globals.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_init.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_prng.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_query.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_dequeue.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_enqueue.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_init.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_query.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_init.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_query.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_init.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_query.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_read.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_write.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_init.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_pop.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_push.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_query.c" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters new file mode 100644 index 0000000000..978f8ec1c9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters @@ -0,0 +1,279 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Header Files\liblfds700"> + <UniqueIdentifier>{258be429-7dac-4999-b995-753aa2f0c505}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_freelist"> + <UniqueIdentifier>{469abf8e-47d8-4678-bd66-7c7e65c5f52e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_ringbuffer"> + <UniqueIdentifier>{62ee141b-2acb-4555-b016-7be20a57f2bf}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_stack"> + <UniqueIdentifier>{19c73b0f-25e0-4166-9093-427f1dfb4f70}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_queue"> + <UniqueIdentifier>{00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_queue_bounded_singleconsumer_singleproducer"> + <UniqueIdentifier>{6250c4d5-ac8e-4c28-93de-0954c5bed1cb}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_misc"> + <UniqueIdentifier>{400ae4e9-2281-4549-b918-59d1a27a2d07}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_list_addonly_ordered_singlylinked"> + <UniqueIdentifier>{c45194af-7b41-4c28-bc0e-1095ec347664}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_list_addonly_singlylinked_unordered"> + <UniqueIdentifier>{8b3cbb5c-7436-429f-9b72-bae1f4721746}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_hash_addonly"> + <UniqueIdentifier>{bcbadc74-1748-4696-aad7-7fdbe5614624}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_btree_addonly_unbalanced"> + <UniqueIdentifier>{0b1fafc3-817b-4c18-8eb1-121884e3a29b}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\inc\liblfds700.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_freelist\lfds700_freelist_internal.h"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_stack\lfds700_stack_internal.h"> + <Filter>Source Files\lfds700_stack</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_queue\lfds700_queue_internal.h"> + <Filter>Source Files\lfds700_queue</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_btree_addonly_unbalanced.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_freelist.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_hash_addonly.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_ordered_singlylinked.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_singlylinked_unordered.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_misc.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_compiler.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_operating_system.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_processor.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue_bounded_singleconsumer_singleproducer.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_ringbuffer.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_stack.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_internal.h"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_internal.h"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_internal.h"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_misc\lfds700_misc_internal.h"> + <Filter>Source Files\lfds700_misc</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_internal.h"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_internal.h"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_internal.h"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_cleanup.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_init.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_pop.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_push.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_query.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_cleanup.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_init.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_pop.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_push.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_query.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_cleanup.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_dequeue.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_enqueue.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_init.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_query.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_cleanup.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_get.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_init.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_insert.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_iterate.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_query.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_cleanup.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_get.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_init.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_insert.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_query.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_cleanup.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_get.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_init.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_insert.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_query.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_cleanup.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_globals.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_init.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_prng.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_query.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_init.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_query.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_cleanup.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_get.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_init.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_insert.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_query.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_cleanup.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_init.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_query.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_read.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_write.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user new file mode 100644 index 0000000000..7cbb3216ad --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c new file mode 100644 index 0000000000..9ea5612e54 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c @@ -0,0 +1 @@ +#include <wdf.h> diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln new file mode 100644 index 0000000000..1cc19a8e23 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln @@ -0,0 +1,59 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|ARM = Debug DLL|ARM + Debug DLL|Win32 = Debug DLL|Win32 + Debug DLL|x64 = Debug DLL|x64 + Debug LIB|ARM = Debug LIB|ARM + Debug LIB|Win32 = Debug LIB|Win32 + Debug LIB|x64 = Debug LIB|x64 + Release DLL|ARM = Release DLL|ARM + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release LIB|ARM = Release LIB|ARM + Release LIB|Win32 = Release LIB|Win32 + Release LIB|x64 = Release LIB|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|ARM.ActiveCfg = Debug DLL|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|ARM.Build.0 = Debug DLL|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|ARM.ActiveCfg = Debug LIB|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|ARM.Build.0 = Debug LIB|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|ARM.ActiveCfg = Release DLL|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|ARM.Build.0 = Release DLL|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|ARM.ActiveCfg = Release LIB|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|ARM.Build.0 = Release LIB|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj new file mode 100644 index 0000000000..e67a540e37 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj @@ -0,0 +1,1054 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug DLL|ARM"> + <Configuration>Debug DLL</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug DLL|Win32"> + <Configuration>Debug DLL</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug DLL|x64"> + <Configuration>Debug DLL</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|ARM"> + <Configuration>Debug LIB</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|Win32"> + <Configuration>Debug LIB</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|x64"> + <Configuration>Debug LIB</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|ARM"> + <Configuration>Release DLL</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|Win32"> + <Configuration>Release DLL</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|x64"> + <Configuration>Release DLL</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|ARM"> + <Configuration>Release LIB</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|Win32"> + <Configuration>Release LIB</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|x64"> + <Configuration>Release LIB</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|ARM'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|ARM'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|ARM'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|ARM'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|ARM'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|ARM'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|ARM'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|ARM'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\</IncludePath> + <LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|ARM'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath)</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\</IncludePath> + <LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|ARM'"> + <LinkIncremental /> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath)</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath)</LibraryPath> + <ExcludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuildToolsPath);$(MSBuildFrameworkToolsPath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_ARM);</ExcludePath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\</IncludePath> + <LibraryPath>$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\</IncludePath> + <LibraryPath>$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\</IncludePath> + <LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|ARM'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath)</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\</IncludePath> + <LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|ARM'"> + <LinkIncremental /> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath)</IncludePath> + <LibraryPath>$(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'"> + <LinkIncremental>true</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\</IncludePath> + <LibraryPath>$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> + <LinkIncremental> + </LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + <IncludePath>$(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\</IncludePath> + <LibraryPath>$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\</LibraryPath> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|ARM'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineARM</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <AdditionalDependencies>kernel32.lib;msvcrtd.lib</AdditionalDependencies> + <LinkStatus> + </LinkStatus> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <MapExports>true</MapExports> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <GenerateMapFile>true</GenerateMapFile> + <Driver>WDM</Driver> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|ARM'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <AdditionalDependencies>kernel32.lib;msvcrtd.lib</AdditionalDependencies> + <LinkStatus> + </LinkStatus> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <MapExports>true</MapExports> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <GenerateMapFile>true</GenerateMapFile> + <Driver>WDM</Driver> + <IgnoreSpecificDefaultLibraries /> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <OmitFramePointers>false</OmitFramePointers> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <SmallerTypeCheck>true</SmallerTypeCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>true</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <SDLCheck>true</SDLCheck> + <MinimalRebuild>false</MinimalRebuild> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <OmitFramePointers>false</OmitFramePointers> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <MapExports>true</MapExports> + <OptimizeReferences>false</OptimizeReferences> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;msvcrtd.lib</AdditionalDependencies> + <GenerateMapFile>true</GenerateMapFile> + <Driver>WDM</Driver> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + </Lib> + <Lib> + <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|ARM'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineARM</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalDependencies>kernel32.lib;msvcrt.lib</AdditionalDependencies> + <LinkStatus> + </LinkStatus> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <Driver>WDM</Driver> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|ARM'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalDependencies>kernel32.lib;msvcrt.lib</AdditionalDependencies> + <LinkStatus> + </LinkStatus> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <Driver>WDM</Driver> + <IgnoreSpecificDefaultLibraries /> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Native</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <StringPooling>true</StringPooling> + <ExceptionHandling>false</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking> + </FunctionLevelLinking> + <EnableParallelCodeGeneration> + </EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet> + </EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage> + </CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <CompileAs>CompileAsC</CompileAs> + <UseFullPaths>true</UseFullPaths> + <ErrorReporting>None</ErrorReporting> + <OmitFramePointers>true</OmitFramePointers> + <DisableSpecificWarnings>4068</DisableSpecificWarnings> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalOptions>/kernel %(AdditionalOptions)</AdditionalOptions> + </ClCompile> + <Link> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Native</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <ModuleDefinitionFile>liblfds700.def</ModuleDefinitionFile> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;msvcrt.lib</AdditionalDependencies> + <Driver>WDM</Driver> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + </Lib> + <Lib> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <Lib> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\inc\liblfds700.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_btree_addonly_unbalanced.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_freelist.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_hash_addonly.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_ordered_singlylinked.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_singlylinked_unordered.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_misc.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_compiler.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_operating_system.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_processor.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue_bounded_singleconsumer_singleproducer.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_ringbuffer.h" /> + <ClInclude Include="..\..\inc\liblfds700\lfds700_stack.h" /> + <ClInclude Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_internal.h" /> + <ClInclude Include="..\..\src\lfds700_freelist\lfds700_freelist_internal.h" /> + <ClInclude Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_internal.h" /> + <ClInclude Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_internal.h" /> + <ClInclude Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_internal.h" /> + <ClInclude Include="..\..\src\lfds700_misc\lfds700_misc_internal.h" /> + <ClInclude Include="..\..\src\lfds700_queue\lfds700_queue_internal.h" /> + <ClInclude Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" /> + <ClInclude Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_internal.h" /> + <ClInclude Include="..\..\src\lfds700_stack\lfds700_stack_internal.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_get.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_init.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_insert.c" /> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_query.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_init.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_pop.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_push.c" /> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_query.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_get.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_init.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_insert.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_iterate.c" /> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_query.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_get.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_init.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_insert.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_query.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_get.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_init.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_insert.c" /> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_query.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_globals.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_init.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_prng.c" /> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_query.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_dequeue.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_enqueue.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_init.c" /> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_query.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_init.c" /> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_query.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_init.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_query.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_read.c" /> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_write.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_cleanup.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_init.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_pop.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_push.c" /> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_query.c" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters new file mode 100644 index 0000000000..978f8ec1c9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters @@ -0,0 +1,279 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Header Files\liblfds700"> + <UniqueIdentifier>{258be429-7dac-4999-b995-753aa2f0c505}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_freelist"> + <UniqueIdentifier>{469abf8e-47d8-4678-bd66-7c7e65c5f52e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_ringbuffer"> + <UniqueIdentifier>{62ee141b-2acb-4555-b016-7be20a57f2bf}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_stack"> + <UniqueIdentifier>{19c73b0f-25e0-4166-9093-427f1dfb4f70}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_queue"> + <UniqueIdentifier>{00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_queue_bounded_singleconsumer_singleproducer"> + <UniqueIdentifier>{6250c4d5-ac8e-4c28-93de-0954c5bed1cb}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_misc"> + <UniqueIdentifier>{400ae4e9-2281-4549-b918-59d1a27a2d07}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_list_addonly_ordered_singlylinked"> + <UniqueIdentifier>{c45194af-7b41-4c28-bc0e-1095ec347664}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_list_addonly_singlylinked_unordered"> + <UniqueIdentifier>{8b3cbb5c-7436-429f-9b72-bae1f4721746}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_hash_addonly"> + <UniqueIdentifier>{bcbadc74-1748-4696-aad7-7fdbe5614624}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\lfds700_btree_addonly_unbalanced"> + <UniqueIdentifier>{0b1fafc3-817b-4c18-8eb1-121884e3a29b}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\inc\liblfds700.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_freelist\lfds700_freelist_internal.h"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_stack\lfds700_stack_internal.h"> + <Filter>Source Files\lfds700_stack</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_queue\lfds700_queue_internal.h"> + <Filter>Source Files\lfds700_queue</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_btree_addonly_unbalanced.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_freelist.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_hash_addonly.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_ordered_singlylinked.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_list_addonly_singlylinked_unordered.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_misc.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_compiler.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_operating_system.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_porting_abstraction_layer_processor.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_queue_bounded_singleconsumer_singleproducer.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_ringbuffer.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\inc\liblfds700\lfds700_stack.h"> + <Filter>Header Files\liblfds700</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_internal.h"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_internal.h"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_internal.h"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_misc\lfds700_misc_internal.h"> + <Filter>Source Files\lfds700_misc</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_internal.h"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_internal.h"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClInclude> + <ClInclude Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_internal.h"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_cleanup.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_init.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_pop.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_push.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_freelist\lfds700_freelist_query.c"> + <Filter>Source Files\lfds700_freelist</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_cleanup.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_init.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_pop.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_push.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_stack\lfds700_stack_query.c"> + <Filter>Source Files\lfds700_stack</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_cleanup.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_dequeue.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_enqueue.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_init.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue\lfds700_queue_query.c"> + <Filter>Source Files\lfds700_queue</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_cleanup.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_get.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_init.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_insert.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_iterate.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_hash_addonly\lfds700_hash_addonly_query.c"> + <Filter>Source Files\lfds700_hash_addonly</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_cleanup.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_get.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_init.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_insert.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_ordered_singlylinked\lfds700_list_addonly_ordered_singlylinked_query.c"> + <Filter>Source Files\lfds700_list_addonly_ordered_singlylinked</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_cleanup.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_get.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_init.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_insert.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_btree_addonly_unbalanced\lfds700_btree_addonly_unbalanced_query.c"> + <Filter>Source Files\lfds700_btree_addonly_unbalanced</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_cleanup.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_globals.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_init.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_prng.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_misc\lfds700_misc_query.c"> + <Filter>Source Files\lfds700_misc</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_init.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\lfds700_queue_bounded_singleconsumer_singleproducer_query.c"> + <Filter>Source Files\lfds700_queue_bounded_singleconsumer_singleproducer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_cleanup.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_get.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_init.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_insert.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_list_addonly_singlylinked_unordered\lfds700_list_addonly_singlylinked_unordered_query.c"> + <Filter>Source Files\lfds700_list_addonly_singlylinked_unordered</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_cleanup.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_init.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_query.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_read.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + <ClCompile Include="..\..\src\lfds700_ringbuffer\lfds700_ringbuffer_write.c"> + <Filter>Source Files\lfds700_ringbuffer</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user new file mode 100644 index 0000000000..7cbb3216ad --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs new file mode 100644 index 0000000000..64e002cc57 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs @@ -0,0 +1,3 @@ +DIRS = single_dir_for_windows_kernel + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c new file mode 100644 index 0000000000..09d7acb7fc --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c @@ -0,0 +1,23 @@ +#include "liblfds700_internal.h" + + + + + +/****************************************************************************/ +DRIVER_INITIALIZE DriverEntry; + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +NTSTATUS DriverEntry( struct _DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath ) +{ + return( STATUS_SUCCESS ); +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt new file mode 100644 index 0000000000..1481c8d08a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt @@ -0,0 +1,32 @@ +The Windows kernel build environment is primitive and has a number +of severe limitations; in particular, all source files must be in +one directory and it is not possible to choose the output binary type +(static or dynamic library) from the build command line; rather, +a string has to be modified in a text file used by the build (!) + +To deal with these limitations, it is necessary for a Windows kernel +build to run a batch file prior to building. + +There are two batch files, one for static library builds and the other +for dynamic library builds. + +They are both idempotent; you can run them as often as you like and +switch between them as often as you want. It's all fine; whenever +you run one of them, it will take you from whatever state you were +previously in, into the state you want to be in. + +Both batch files copy all the sources file into a single directory, +"/src/single_dir_for_windows_kernel/". + +The static library batch file will then copy "/sources.static" into +"/src/single_dir_for_windows_kernel/", which will cause a static +library to be built. + +The dynamic library batch file will then copy "/sources.dynamic" into +"/src/single_dir_for_windows_kernel/", which will cause a dynamic +library to be built. It will also copy "src/driver_entry.c" into +"/src/single_dir_for_windows_kernel/", since the linker requires +the DriverEntry function to exist for dynamic libraries, even +though it's not used. + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat new file mode 100644 index 0000000000..ff6fc8a1f3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat @@ -0,0 +1,22 @@ +@echo off +rmdir /q /s single_dir_for_windows_kernel 1>nul 2>nul +mkdir single_dir_for_windows_kernel 1>nul 2>nul + +copy /y ..\..\src\lfds700_btree_addonly_unbalanced\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_freelist\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_hash_addonly\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_list_addonly_ordered_singlylinked\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_list_addonly_singlylinked_unordered\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_misc\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_queue\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_ringbuffer\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_stack\* single_dir_for_windows_kernel\ 1>nul 2>nul + +copy /y ..\..\src\liblfds700_internal.h single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y driver_entry_renamed_to_avoid_compiler_warning.c single_dir_for_windows_kernel\driver_entry.c 1>nul 2>nul +copy /y sources.dynamic single_dir_for_windows_kernel\sources 1>nul 2>nul + +echo Windows kernel dynamic library build directory structure created. +echo (Note the effects of this batch file are idempotent). + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat new file mode 100644 index 0000000000..81c35e99c8 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat @@ -0,0 +1,21 @@ +@echo off +rmdir /q /s single_dir_for_windows_kernel 1>nul 2>nul +mkdir single_dir_for_windows_kernel 1>nul 2>nul + +copy /y ..\..\src\lfds700_btree_addonly_unbalanced\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_freelist\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_hash_addonly\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_list_addonly_ordered_singlylinked\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_list_addonly_singlylinked_unordered\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_misc\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_queue\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_ringbuffer\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_stack\* single_dir_for_windows_kernel\ 1>nul 2>nul + +copy /y ..\..\src\liblfds700_internal.h single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y sources.static single_dir_for_windows_kernel\sources 1>nul 2>nul + +echo Windows kernel static library build directory structure created. +echo (Note the effects of this batch file are idempotent). + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic new file mode 100644 index 0000000000..b0d241f85f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic @@ -0,0 +1,62 @@ +MSC_WARNING_LEVEL = /WX /wd4127 /W4 +DLLDEF = ../liblfds700.def +TARGETNAME = liblfds700 +TARGETPATH = ../../../bin/ +TARGETTYPE = EXPORT_DRIVER +UMTYPE = nt +USER_C_FLAGS = /D_KERNEL_MODE + +INCLUDES = ../../../inc/ +SOURCES = lfds700_hash_addonly_cleanup.c \ + lfds700_hash_addonly_get.c \ + lfds700_hash_addonly_init.c \ + lfds700_hash_addonly_insert.c \ + lfds700_hash_addonly_iterate.c \ + lfds700_hash_addonly_query.c \ + lfds700_list_addonly_ordered_singlylinked_cleanup.c \ + lfds700_list_addonly_ordered_singlylinked_get.c \ + lfds700_list_addonly_ordered_singlylinked_init.c \ + lfds700_list_addonly_ordered_singlylinked_insert.c \ + lfds700_list_addonly_ordered_singlylinked_query.c \ + lfds700_list_addonly_singlylinked_unordered_cleanup.c \ + lfds700_list_addonly_singlylinked_unordered_get.c \ + lfds700_list_addonly_singlylinked_unordered_init.c \ + lfds700_list_addonly_singlylinked_unordered_insert.c \ + lfds700_list_addonly_singlylinked_unordered_query.c \ + lfds700_btree_addonly_unbalanced_cleanup.c \ + lfds700_btree_addonly_unbalanced_get.c \ + lfds700_btree_addonly_unbalanced_init.c \ + lfds700_btree_addonly_unbalanced_insert.c \ + lfds700_btree_addonly_unbalanced_query.c \ + lfds700_freelist_cleanup.c \ + lfds700_freelist_init.c \ + lfds700_freelist_pop.c \ + lfds700_freelist_push.c \ + lfds700_freelist_query.c \ + lfds700_misc_cleanup.c \ + lfds700_misc_globals.c \ + lfds700_misc_init.c \ + lfds700_misc_prng.c \ + lfds700_misc_query.c \ + lfds700_queue_cleanup.c \ + lfds700_queue_dequeue.c \ + lfds700_queue_enqueue.c \ + lfds700_queue_init.c \ + lfds700_queue_query.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_init.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ + lfds700_ringbuffer_cleanup.c \ + lfds700_ringbuffer_init.c \ + lfds700_ringbuffer_query.c \ + lfds700_ringbuffer_read.c \ + lfds700_ringbuffer_write.c \ + lfds700_stack_cleanup.c \ + lfds700_stack_init.c \ + lfds700_stack_pop.c \ + lfds700_stack_push.c \ + lfds700_stack_query.c \ + driver_entry.c + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static new file mode 100644 index 0000000000..401b381c7d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static @@ -0,0 +1,60 @@ +MSC_WARNING_LEVEL = /WX /wd4127 /W4 +TARGETNAME = liblfds700 +TARGETPATH = ../../../bin/ +TARGETTYPE = DRIVER_LIBRARY +UMTYPE = nt +USER_C_FLAGS = /D_KERNEL_MODE + +INCLUDES = ../../../inc/ +SOURCES = lfds700_hash_addonly_cleanup.c \ + lfds700_hash_addonly_get.c \ + lfds700_hash_addonly_init.c \ + lfds700_hash_addonly_insert.c \ + lfds700_hash_addonly_iterate.c \ + lfds700_hash_addonly_query.c \ + lfds700_list_addonly_ordered_singlylinked_cleanup.c \ + lfds700_list_addonly_ordered_singlylinked_get.c \ + lfds700_list_addonly_ordered_singlylinked_init.c \ + lfds700_list_addonly_ordered_singlylinked_insert.c \ + lfds700_list_addonly_ordered_singlylinked_query.c \ + lfds700_list_addonly_singlylinked_unordered_cleanup.c \ + lfds700_list_addonly_singlylinked_unordered_get.c \ + lfds700_list_addonly_singlylinked_unordered_init.c \ + lfds700_list_addonly_singlylinked_unordered_insert.c \ + lfds700_list_addonly_singlylinked_unordered_query.c \ + lfds700_btree_addonly_unbalanced_cleanup.c \ + lfds700_btree_addonly_unbalanced_get.c \ + lfds700_btree_addonly_unbalanced_init.c \ + lfds700_btree_addonly_unbalanced_insert.c \ + lfds700_btree_addonly_unbalanced_query.c \ + lfds700_freelist_cleanup.c \ + lfds700_freelist_init.c \ + lfds700_freelist_pop.c \ + lfds700_freelist_push.c \ + lfds700_freelist_query.c \ + lfds700_misc_cleanup.c \ + lfds700_misc_globals.c \ + lfds700_misc_init.c \ + lfds700_misc_prng.c \ + lfds700_misc_query.c \ + lfds700_queue_cleanup.c \ + lfds700_queue_dequeue.c \ + lfds700_queue_enqueue.c \ + lfds700_queue_init.c \ + lfds700_queue_query.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_init.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ + lfds700_ringbuffer_cleanup.c \ + lfds700_ringbuffer_init.c \ + lfds700_ringbuffer_query.c \ + lfds700_ringbuffer_read.c \ + lfds700_ringbuffer_write.c \ + lfds700_stack_cleanup.c \ + lfds700_stack_init.c \ + lfds700_stack_pop.c \ + lfds700_stack_push.c \ + lfds700_stack_query.c + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h new file mode 100644 index 0000000000..fdda50cefb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h @@ -0,0 +1,31 @@ +#ifndef LIBLFDS700_H + + /***** defines *****/ + #define LIBLFDS700_H + + /***** pragmas on *****/ + #pragma warning( disable : 4324 ) // TRD : 4324 disables MSVC warnings for structure alignment padding due to alignment specifiers + + #pragma prefast( disable : 28113 28182 28183, "blah" ) + + /***** includes *****/ + #include "liblfds700/lfds700_porting_abstraction_layer_compiler.h" + #include "liblfds700/lfds700_porting_abstraction_layer_operating_system.h" + #include "liblfds700/lfds700_porting_abstraction_layer_processor.h" + + #include "liblfds700/lfds700_misc.h" // TRD : everything after depends on misc + #include "liblfds700/lfds700_btree_addonly_unbalanced.h" // TRD : hash_addonly depends on btree_addonly_unbalanced + #include "liblfds700/lfds700_freelist.h" + #include "liblfds700/lfds700_hash_addonly.h" + #include "liblfds700/lfds700_list_addonly_ordered_singlylinked.h" + #include "liblfds700/lfds700_list_addonly_singlylinked_unordered.h" + #include "liblfds700/lfds700_queue.h" + #include "liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h" + #include "liblfds700/lfds700_ringbuffer.h" + #include "liblfds700/lfds700_stack.h" + + /***** pragmas off *****/ + #pragma warning( default : 4324 ) + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h new file mode 100644 index 0000000000..bdc63a4273 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h @@ -0,0 +1,113 @@ +/***** defines *****/ +#define LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( btree_au_element ) ( (btree_au_element).key ) +#define LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( btree_au_element, new_key ) ( (btree_au_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( btree_au_element ) ( LFDS700_MISC_BARRIER_LOAD, (btree_au_element).value ) +#define LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( btree_au_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(btree_au_element).value, &local_new_value ); } +#define LFDS700_BTREE_AU_GET_USER_STATE_FROM_STATE( btree_au_state ) ( (btree_au_state).user_state ) + +/***** enums *****/ +enum lfds700_btree_au_absolute_position +{ + LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT, + LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, + LFDS700_BTREE_AU_ABSOLUTE_POSITION_LARGEST_IN_TREE +}; + +enum lfds700_btree_au_existing_key +{ + LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, + LFDS700_BTREE_AU_EXISTING_KEY_FAIL +}; + +enum lfds700_btree_au_insert_result +{ + LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY, + LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE, + LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS +}; + +enum lfds700_btree_au_relative_position +{ + LFDS700_BTREE_AU_RELATIVE_POSITION_UP, + LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT, + LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT, + LFDS700_BTREE_AU_RELATIVE_POSITION_SMALLEST_ELEMENT_BELOW_CURRENT_ELEMENT, + LFDS700_BTREE_AU_RELATIVE_POSITION_LARGEST_ELEMENT_BELOW_CURRENT_ELEMENT, + LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE, + LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE +}; + +enum lfds700_btree_au_query +{ + LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structs *****/ +struct lfds700_btree_au_element +{ + struct lfds700_btree_au_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile left, + *volatile right, + *volatile up; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile value; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *key; +}; + +struct lfds700_btree_au_state +{ + struct lfds700_btree_au_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile root; + + int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + (*key_compare_function)( void const *new_key, void const *existing_key ); + + enum lfds700_btree_au_existing_key + existing_key; + + void + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_btree_au_init_valid_on_current_logical_core( struct lfds700_btree_au_state *baus, + int (*key_compare_function)(void const *new_key, void const *existing_key), + enum lfds700_btree_au_existing_key existing_key, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_btree_au_cleanup( struct lfds700_btree_au_state *baus, + void (*element_cleanup_callback)(struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue) ); + +enum lfds700_btree_au_insert_result lfds700_btree_au_insert( struct lfds700_btree_au_state *baus, + struct lfds700_btree_au_element *baue, + struct lfds700_btree_au_element **existing_baue, + struct lfds700_misc_prng_state *ps ); + // TRD : if a link collides with an existing key and existing_baue is non-NULL, existing_baue is set to the existing element + +int lfds700_btree_au_get_by_key( struct lfds700_btree_au_state *baus, + void *key, + struct lfds700_btree_au_element **baue ); + +int lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( struct lfds700_btree_au_state *baus, + struct lfds700_btree_au_element **baue, + enum lfds700_btree_au_absolute_position absolute_position, + enum lfds700_btree_au_relative_position relative_position ); + // TRD : if *baue is NULL, we get the element at position, otherwise we move from *baue according to direction + +int lfds700_btree_au_get_by_absolute_position( struct lfds700_btree_au_state *baus, + struct lfds700_btree_au_element **baue, + enum lfds700_btree_au_absolute_position absolute_position ); + +int lfds700_btree_au_get_by_relative_position( struct lfds700_btree_au_element **baue, + enum lfds700_btree_au_relative_position relative_position ); + +void lfds700_btree_au_query( struct lfds700_btree_au_state *baus, + enum lfds700_btree_au_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h new file mode 100644 index 0000000000..6a89386c5d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h @@ -0,0 +1,54 @@ +/***** defines *****/ +#define LFDS700_FREELIST_GET_KEY_FROM_ELEMENT( freelist_element ) ( (freelist_element).key ) +#define LFDS700_FREELIST_SET_KEY_IN_ELEMENT( freelist_element, new_key ) ( (freelist_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( freelist_element ) ( (freelist_element).value ) +#define LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( freelist_element, new_value ) ( (freelist_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) +#define LFDS700_FREELIST_GET_USER_STATE_FROM_STATE( freelist_state ) ( (freelist_state).user_state ) + +/***** enums *****/ +enum lfds700_freelist_query +{ + LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT, + LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_freelist_element +{ + struct lfds700_freelist_element + *volatile next; + + void + *key, + *value; +}; + +struct lfds700_freelist_state +{ + struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile top[PAC_SIZE]; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_freelist_init_valid_on_current_logical_core( struct lfds700_freelist_state *fs, void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_freelist_cleanup( struct lfds700_freelist_state *fs, + void (*element_cleanup_callback)(struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe) ); + +void lfds700_freelist_push( struct lfds700_freelist_state *fs, + struct lfds700_freelist_element *fe, + struct lfds700_misc_prng_state *ps ); + +int lfds700_freelist_pop( struct lfds700_freelist_state *fs, + struct lfds700_freelist_element **fe, + struct lfds700_misc_prng_state *ps ); + +void lfds700_freelist_query( struct lfds700_freelist_state *fs, + enum lfds700_freelist_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h new file mode 100644 index 0000000000..f7962db9e0 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h @@ -0,0 +1,127 @@ +/***** defines *****/ +#define LFDS700_HASH_A_GET_KEY_FROM_ELEMENT( hash_a_element ) ( (hash_a_element).key ) +#define LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hash_a_element, new_key ) ( (hash_a_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( hash_a_element ) ( LFDS700_MISC_BARRIER_LOAD, (hash_a_element).value ) +#define LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hash_a_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(hash_a_element).value, &local_new_value ); } +#define LFDS700_HASH_A_GET_USER_STATE_FROM_STATE( hash_a_state ) ( (hash_a_state).user_state ) + +#define LFDS700_HASH_A_32BIT_HASH_FUNCTION( data, data_length_in_bytes, hash ) { \ + lfds700_pal_uint_t \ + loop; \ + \ + for( loop = 0 ; loop < (data_length_in_bytes) ; loop++ ) \ + { \ + (hash) += *( (char unsigned *) (data) + loop ); \ + (hash) += ((hash) << 10); \ + (hash) ^= ((hash) >> 6); \ + } \ + \ + (hash) += ((hash) << 3); \ + (hash) ^= ((hash) >> 11); \ + (hash) += ((hash) << 15); \ + } + /* TRD : this is the Jenkins one-at-a-time hash + it produces a 32 bit hash + http://en.wikipedia.org/wiki/Jenkins_hash_function + + we ourselves do *not* initialize the value of *hash, so that + our caller has the option to call us multiple times, each + time with for example a different member of a struct, which is + then hashed into the existing, built-up-so-far hash value, and + so build up a quality hash + */ + +/***** enums *****/ +enum lfds700_hash_a_existing_key +{ + LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, + LFDS700_HASH_A_EXISTING_KEY_FAIL +}; + +enum lfds700_hash_a_insert_result +{ + LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY, + LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE, + LFDS700_HASH_A_PUT_RESULT_SUCCESS +}; + +enum lfds700_hash_a_query +{ + LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structs *****/ +struct lfds700_hash_a_element +{ + struct lfds700_btree_au_element + baue; + + void + *key; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile value; +}; + +struct lfds700_hash_a_iterate +{ + struct lfds700_btree_au_element + *baue; + + struct lfds700_btree_au_state + *baus, + *baus_end; +}; + +struct lfds700_hash_a_state +{ + enum lfds700_hash_a_existing_key + existing_key; + + int + (*key_compare_function)( void const *new_key, void const *existing_key ); + + lfds700_pal_uint_t + array_size; + + struct lfds700_btree_au_state + *baus_array; + + void + (*element_cleanup_callback)( struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae ), + (*key_hash_function)( void const *key, lfds700_pal_uint_t *hash ), + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_hash_a_init_valid_on_current_logical_core( struct lfds700_hash_a_state *has, + struct lfds700_btree_au_state *baus_array, + lfds700_pal_uint_t array_size, + int (*key_compare_function)(void const *new_key, void const *existing_key), + void (*key_hash_function)(void const *key, lfds700_pal_uint_t *hash), + enum lfds700_hash_a_existing_key existing_key, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_hash_a_cleanup( struct lfds700_hash_a_state *has, + void (*element_cleanup_function)(struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae) ); + +enum lfds700_hash_a_insert_result lfds700_hash_a_insert( struct lfds700_hash_a_state *has, + struct lfds700_hash_a_element *hae, + struct lfds700_hash_a_element **existing_hae, + struct lfds700_misc_prng_state *ps ); + // TRD : if existing_value is not NULL and the key exists, existing_value is set to the value of the existing key + +int lfds700_hash_a_get_by_key( struct lfds700_hash_a_state *has, + void *key, + struct lfds700_hash_a_element **hae ); + +void lfds700_hash_a_iterate_init( struct lfds700_hash_a_state *has, struct lfds700_hash_a_iterate *hai ); +int lfds700_hash_a_iterate( struct lfds700_hash_a_iterate *hai, struct lfds700_hash_a_element **hae ); + +void lfds700_hash_a_query( struct lfds700_hash_a_state *has, + enum lfds700_hash_a_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h new file mode 100644 index 0000000000..dffab0aa6b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h @@ -0,0 +1,85 @@ +/***** defines *****/ +#define LFDS700_LIST_AOS_GET_START( list_aos_state ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_state).start->next ) +#define LFDS700_LIST_AOS_GET_NEXT( list_aos_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_element).next ) +#define LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT( list_aos_state, pointer_to_list_aos_element ) ( (pointer_to_list_aos_element) == NULL ? ( (pointer_to_list_aos_element) = LFDS700_LIST_AOS_GET_START(list_aos_state) ) : ( (pointer_to_list_aos_element) = LFDS700_LIST_AOS_GET_NEXT(*(pointer_to_list_aos_element)) ) ) +#define LFDS700_LIST_AOS_GET_KEY_FROM_ELEMENT( list_aos_element ) ( (list_aos_element).key ) +#define LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( list_aos_element, new_key ) ( (list_aos_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( list_aos_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_element).value ) +#define LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( list_aos_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(list_aos_element).value, &local_new_value ); } +#define LFDS700_LIST_AOS_GET_USER_STATE_FROM_STATE( list_aos_state ) ( (list_aos_state).user_state ) + +/***** enums *****/ +enum lfds700_list_aos_existing_key +{ + LFDS700_LIST_AOS_EXISTING_KEY_OVERWRITE, + LFDS700_LIST_AOS_EXISTING_KEY_FAIL +}; + +enum lfds700_list_aos_insert_result +{ + LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, + LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS_OVERWRITE, + LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS +}; + +enum lfds700_list_aos_query +{ + LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_list_aos_element +{ + struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile next; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile value; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *key; +}; + +struct lfds700_list_aos_state +{ + struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile start; + + struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + dummy_element; + + int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + (*key_compare_function)( void const *new_key, void const *existing_key ); + + enum lfds700_list_aos_existing_key + existing_key; + + void + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_list_aos_init_valid_on_current_logical_core( struct lfds700_list_aos_state *laoss, + int (*key_compare_function)(void const *new_key, void const *existing_key), + enum lfds700_list_aos_existing_key existing_key, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_list_aos_cleanup( struct lfds700_list_aos_state *laoss, + void (*element_cleanup_callback)(struct lfds700_list_aos_state *laoss, struct lfds700_list_aos_element *laose) ); + +enum lfds700_list_aos_insert_result lfds700_list_aos_insert( struct lfds700_list_aos_state *laoss, + struct lfds700_list_aos_element *laose, + struct lfds700_list_aos_element **existing_laose, + struct lfds700_misc_prng_state *ps ); + +int lfds700_list_aos_get_by_key( struct lfds700_list_aos_state *laoss, + void *key, + struct lfds700_list_aos_element **laose ); + +void lfds700_list_aos_query( struct lfds700_list_aos_state *laoss, + enum lfds700_list_aos_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h new file mode 100644 index 0000000000..38d21511a1 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h @@ -0,0 +1,90 @@ +/***** defines *****/ +#define LFDS700_LIST_ASU_GET_START( list_asu_state ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_state).start->next ) +#define LFDS700_LIST_ASU_GET_NEXT( list_asu_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_element).next ) +#define LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT( list_asu_state, pointer_to_list_asu_element ) ( (pointer_to_list_asu_element) == NULL ? ( (pointer_to_list_asu_element) = LFDS700_LIST_ASU_GET_START(list_asu_state) ) : ( (pointer_to_list_asu_element) = LFDS700_LIST_ASU_GET_NEXT(*(pointer_to_list_asu_element)) ) ) +#define LFDS700_LIST_ASU_GET_KEY_FROM_ELEMENT( list_asu_element ) ( (list_asu_element).key ) +#define LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( list_asu_element, new_key ) ( (list_asu_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( list_asu_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_element).value ) +#define LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( list_asu_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(list_asu_element).value, &local_new_value ); } +#define LFDS700_LIST_ASU_GET_USER_STATE_FROM_STATE( list_asu_state ) ( (list_asu_state).user_state ) + +/***** enums *****/ +enum lfds700_list_asu_position +{ + LFDS700_LIST_ASU_POSITION_START, + LFDS700_LIST_ASU_POSITION_END, + LFDS700_LIST_ASU_POSITION_AFTER +}; + +enum lfds700_list_asu_query +{ + LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_list_asu_element +{ + struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile next; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile value; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *key; +}; + +struct lfds700_list_asu_state +{ + struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile end, + *volatile start; + + struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + dummy_element; + + int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + (*key_compare_function)( void const *new_key, void const *existing_key ); + + void + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_list_asu_init_valid_on_current_logical_core( struct lfds700_list_asu_state *lasus, + int (*key_compare_function)(void const *new_key, void const *existing_key), + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_list_asu_cleanup( struct lfds700_list_asu_state *lasus, + void (*element_cleanup_callback)(struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue) ); + +void lfds700_list_asu_insert_at_position( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_list_asu_element *lasue_predecessor, + enum lfds700_list_asu_position position, + struct lfds700_misc_prng_state *ps ); + +void lfds700_list_asu_insert_at_start( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_misc_prng_state *ps ); + +void lfds700_list_asu_insert_at_end( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_misc_prng_state *ps ); + +void lfds700_list_asu_insert_after_element( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_list_asu_element *lasue_predecessor, + struct lfds700_misc_prng_state *ps ); + +int lfds700_list_asu_get_by_key( struct lfds700_list_asu_state *lasus, + void *key, + struct lfds700_list_asu_element **lasue ); + +void lfds700_list_asu_query( struct lfds700_list_asu_state *lasus, + enum lfds700_list_asu_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h new file mode 100644 index 0000000000..014f72dac5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h @@ -0,0 +1,192 @@ +/***** defines *****/ +#define LFDS700_MISC_VERSION_STRING "7.0.0" +#define LFDS700_MISC_VERSION_INTEGER 700 + +#ifndef NULL + #define NULL ( (void *) 0 ) +#endif + +#define POINTER 0 +#define COUNTER 1 +#define PAC_SIZE 2 + +#define LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE 0 +#define LFDS700_MISC_PRNG_MAX ( (lfds700_pal_uint_t) -1 ) +#define LFDS700_MISC_DELIBERATELY_CRASH { char *c = 0; *c = 0; } +#define LFDS700_MISC_PRNG_SEED 0x0a34655d34c092feULL + /* TRD : from an on-line hardware RNG, using atmospheric noise + the URL eblow will generate another 16 random hex digits (e.g. a 64-bit number) and is + the RNG used to generate the number above (0x0a34655d34c092fe) + http://www.random.org/integers/?num=16&min=0&max=15&col=1&base=16&format=plain&rnd=new + + this seed is a fixed seed which is used for the slow, high quality PRNG, + which in turn is used when thread start to generate a single high quality seed + for the fast, low quality PRNG used for the CAS exponential backoff + */ + +#if( LFDS700_PAL_ALIGN_SINGLE_POINTER == 4 ) // TRD : any 32-bit platform + // TRD : PRNG is a 32-bit xorshift, numbers suggested by George Marsaglia, in his paper http://www.jstatsoft.org/v08/i14/paper + #define LFDS700_MISC_PRNG_GENERATE( pointer_to_lfds700_misc_prng_state ) ( (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 13, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state << 17, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 5 ) +#endif + +#if( LFDS700_PAL_ALIGN_SINGLE_POINTER == 8 ) // TRD : any 64-bit platform + // TRD : PRNG is 64-bit xorshift (xorshift64*), from Sebastiano Vigna (vigna at acm dot org), http://creativecommons.org/publicdomain/zero/1.0/ + #define LFDS700_MISC_PRNG_GENERATE( pointer_to_lfds700_misc_prng_state ) ( (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 12, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state << 25, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 27, (pointer_to_lfds700_misc_prng_state)->prng_state *= 2685821657736338717LL ) +#endif + +#if( !defined LFDS700_PAL_ATOMIC_CAS ) + #define LFDS700_PAL_NO_ATOMIC_CAS + + // TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *compare, lfds700_pal_atom_t new_destination, enum lfds700_misc_cas_strength cas_strength, char unsigned result + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_CAS not implemented for this platform." ); \ + LFDS700_MISC_DELIBERATELY_CRASH; \ + (result) = (char unsigned) 1; \ + } +#endif + +#if( !defined LFDS700_PAL_ATOMIC_DWCAS ) + #define LFDS700_PAL_NO_ATOMIC_DWCAS + + // TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, unsigned char result + + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_DWCAS not implemented for this platform." ); \ + LFDS700_MISC_DELIBERATELY_CRASH; \ + (result) = (char unsigned) 1; \ + } +#endif + +#if( !defined LFDS700_PAL_ATOMIC_EXCHANGE ) + #define LFDS700_PAL_NO_ATOMIC_EXCHANGE + // TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *exchange + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_EXCHANGE not implemented for this platform." ); \ + LFDS700_MISC_DELIBERATELY_CRASH; \ + } +#endif + +#if( defined LFDS700_PAL_NO_COMPILER_BARRIERS ) + #define LFDS700_MISC_BARRIER_LOAD ( LFDS700_PAL_BARRIER_PROCESSOR_LOAD ) + #define LFDS700_MISC_BARRIER_STORE ( LFDS700_PAL_BARRIER_PROCESSOR_STORE ) + #define LFDS700_MISC_BARRIER_FULL ( LFDS700_PAL_BARRIER_PROCESSOR_FULL ) +#else + #define LFDS700_MISC_BARRIER_LOAD ( LFDS700_PAL_BARRIER_COMPILER_LOAD, LFDS700_PAL_BARRIER_PROCESSOR_LOAD, LFDS700_PAL_BARRIER_COMPILER_LOAD ) + #define LFDS700_MISC_BARRIER_STORE ( LFDS700_PAL_BARRIER_COMPILER_STORE, LFDS700_PAL_BARRIER_PROCESSOR_STORE, LFDS700_PAL_BARRIER_COMPILER_STORE ) + #define LFDS700_MISC_BARRIER_FULL ( LFDS700_PAL_BARRIER_COMPILER_FULL, LFDS700_PAL_BARRIER_PROCESSOR_FULL, LFDS700_PAL_BARRIER_COMPILER_FULL ) +#endif + +#define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE LFDS700_MISC_BARRIER_LOAD + +#if( defined LFDS700_PAL_NO_ATOMIC_CAS ) + #define LFDS700_MISC_ATOMIC_SUPPORT_CAS 0 +#else + #define LFDS700_MISC_ATOMIC_SUPPORT_CAS 1 +#endif + +#if( defined LFDS700_PAL_NO_ATOMIC_DWCAS ) + #define LFDS700_MISC_ATOMIC_SUPPORT_DWCAS 0 +#else + #define LFDS700_MISC_ATOMIC_SUPPORT_DWCAS 1 +#endif + +#if( defined LFDS700_PAL_NO_ATOMIC_EXCHANGE ) + #define LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE 0 +#else + #define LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE 1 +#endif + +/***** enums *****/ +enum lfds700_misc_cas_strength +{ + // TRD : yes, weak is 1 (one) - blame GCC! + LFDS700_MISC_CAS_STRENGTH_WEAK = 1, + LFDS700_MISC_CAS_STRENGTH_STRONG = 0 +}; + +enum lfds700_misc_validity +{ + LFDS700_MISC_VALIDITY_VALID, + LFDS700_MISC_VALIDITY_INVALID_LOOP, + LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS, + LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS, + LFDS700_MISC_VALIDITY_INVALID_TEST_DATA, + LFDS700_MISC_VALIDITY_INVALID_ORDER +}; + +enum lfds700_misc_flag +{ + LFDS700_MISC_FLAG_LOWERED, + LFDS700_MISC_FLAG_RAISED +}; + +enum lfds700_misc_query +{ + LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS, + LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS, + LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS, + LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS, + LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING +}; + +/***** struct *****/ +struct lfds700_misc_globals +{ + lfds700_pal_atom_t + exponential_backoff_timeslot_length_in_loop_iterations_for_cas, + exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; +}; + +struct lfds700_misc_prng_state +{ + lfds700_pal_uint_t + prng_state; + + // TRD : here to be on the same cache-line as prng_state, and so all are obtained from one cache-line read + lfds700_pal_atom_t + local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas, + local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; +}; + +struct lfds700_misc_validation_info +{ + lfds700_pal_uint_t + min_elements, + max_elements; +}; + +/***** externs *****/ +extern struct lfds700_misc_globals + lfds700_misc_globals; + +/***** public prototypes *****/ +void lfds700_misc_library_init_valid_on_current_logical_core( void ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE +void lfds700_misc_library_cleanup( void ); + +static LFDS700_PAL_INLINE void lfds700_misc_force_store( void ); + +void lfds700_misc_prng_init( struct lfds700_misc_prng_state *ps ); + +void lfds700_misc_query( enum lfds700_misc_query query_type, void *query_input, void *query_output ); + +/***** public in-line functions *****/ +#pragma prefast( disable : 28112, "blah" ) + +static LFDS700_PAL_INLINE void lfds700_misc_force_store() +{ + lfds700_pal_uint_t + exchange = 0; + + lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + destination; + + LFDS700_PAL_ATOMIC_EXCHANGE( &destination, &exchange ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h new file mode 100644 index 0000000000..c628ddd03a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h @@ -0,0 +1,478 @@ +/****************************************************************************/ +#if( defined __GNUC__ ) + // TRD : makes checking GCC versions much tidier + #define LFDS700_PAL_GCC_VERSION ( __GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ ) +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 ) + + /* TRD : MSVC 8.0 and greater + + _MSC_VER indicates Microsoft C compiler and version + - __declspec(align) requires 7.1 (1310) + - __nop requires 8.0 (1400) + - _ReadBarrier requires 8.0 (1400) + - _WriteBarrier requires 8.0 (1400) + - _ReadWriteBarrier requires 7.1 (1310) + - _InterlockedCompareExchangePointer requires 8.0 (1400) + - _InterlockedExchange requires 7.1 (1310) + - _InterlockedExchangePointer requires 8.0 (1400) + - _InterlockedCompareExchange64 requires 8.0 (1400) (seems to, docs unclear) + - _InterlockedCompareExchange128 requires 9.0 (1500) + + load/store barriers are mandatory for liblfds, which means the earliest viable version of MSCV is 1400 + strictly we could get away with 1310 and use _ReadWriteBarrier, but the difference between 1310 and 1400 is small, so WTH + + _InterlockedCompareExchange128 is needed on 64-bit platforms to provide DWCAS, but DWCAS is not mandatory, + so we check against the compiler version - remember, any unimplemented atomic will be masked by its dummy define, + so everything will compile - it just means you can't use data structures which require that atomic + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + + #define LFDS700_PAL_COMPILER_STRING "MSVC" + + #define LFDS700_PAL_ALIGN(alignment) __declspec( align(alignment) ) + #define LFDS700_PAL_INLINE __forceinline + + #define LFDS700_PAL_BARRIER_COMPILER_LOAD _ReadBarrier() + #define LFDS700_PAL_BARRIER_COMPILER_STORE _WriteBarrier() + #define LFDS700_PAL_BARRIER_COMPILER_FULL _ReadWriteBarrier() + + /* TRD : there are four processors to consider; + + . ARM32 (32 bit, CAS, DWCAS) (defined _M_ARM) + . Itanium (64 bit, CAS) (defined _M_IA64) + . x64 (64 bit, CAS, DWCAS) (defined _M_X64 || defined _M_AMD64) + . x86 (32 bit, CAS, DWCAS) (defined _M_IX86) + + can't find any indications of 64-bit ARM support yet + + ARM has better intrinsics than the others, as there are no-fence variants + + in theory we also have to deal with 32-bit Windows on a 64-bit platform, + and I presume we'd see the compiler properly indicate this in its macros, + but this would require that we use 32-bit atomics on the 64-bit platforms, + while keeping 64-bit cache line lengths and so on, and this is just so + wierd a thing to do these days that it's not supported + + note that _InterlockedCompareExchangePointer performs CAS on all processors + however, it is documented as being available for x86 when in fact it is not + so we have to #if for processor type and use the length specific intrinsics + */ + + #if( defined _M_ARM ) + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __dmb( _ARM_BARRIER_ISH ) + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __dmb( _ARM_BARRIER_ISHST ) + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __dmb( _ARM_BARRIER_ISH ) + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange_nf( (long volatile *) (pointer_to_destination), (long) (new_destination), (long) *(pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + __int64 \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = *(__int64 *) (pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(__int64 *) (pointer_to_compare) = _InterlockedCompareExchange64_nf( (__int64 volatile *) (pointer_to_destination), *(__int64 *) (pointer_to_new_destination), *(__int64 *) (pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( *(__int64 *) (pointer_to_compare) == original_compare ); \ + } + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange_nf( (int long volatile *) (pointer_to_destination), (int long) *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + + #if( defined _M_IA64 ) + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __mf() + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __mf() + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __mf() + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange64_acq( (__int64 volatile *) (pointer_to_destination), (__int64) (new_destination), (__int64) *(pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange64_acq( (__int64 volatile *) (pointer_to_destination), (__int64) *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + + #if( defined _M_X64 || defined _M_AMD64 ) + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD _mm_lfence() + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE _mm_sfence() + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL _mm_mfence() + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange64( (__int64 volatile *) (pointer_to_destination), (__int64) (new_destination), (__int64) *(pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + #if( _MSC_VER >= 1500 ) + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + result = (char unsigned) _InterlockedCompareExchange128( (__int64 volatile *) (pointer_to_destination), (__int64) (pointer_to_new_destination[1]), (__int64) (pointer_to_new_destination[0]), (__int64 *) (pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchangePointer( (void * volatile *) (pointer_to_destination), (void *) *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + + #if( defined _M_IX86 ) + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD lfds700_misc_force_store() + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE lfds700_misc_force_store() + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL lfds700_misc_force_store() + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange( (long volatile *) (pointer_to_destination), (long) (new_destination), (long) *(pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + __int64 \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = *(__int64 *) (pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(__int64 *) (pointer_to_compare) = _InterlockedCompareExchange64( (__int64 volatile *) (pointer_to_destination), *(__int64 *) (pointer_to_new_destination), *(__int64 *) (pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( *(__int64 *) (pointer_to_compare) == original_compare ); \ + } + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange( (int long volatile *) (pointer_to_destination), (int long) *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && LFDS700_PAL_GCC_VERSION >= 412 && LFDS700_PAL_GCC_VERSION < 473 ) + + /* TRD : GCC 4.1.2 up to 4.7.3 + + __GNUC__ indicates GCC + LFDS700_PAL_GCC_VERSION indicates which version + - __sync_synchronize requires 4.1.2 + + GCC 4.1.2 introduced the __sync_*() atomic intrinsics + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + + #define LFDS700_PAL_COMPILER_STRING "GCC < 4.7.3" + + #define LFDS700_PAL_ALIGN(alignment) __attribute__( (aligned(alignment)) ) + #define LFDS700_PAL_INLINE inline + + static LFDS700_PAL_INLINE void lfds700_pal_barrier_compiler( void ) + { + __asm__ __volatile__ ( "" : : : "memory" ); + } + + #define LFDS700_PAL_BARRIER_COMPILER_LOAD lfds700_pal_barrier_compiler() + #define LFDS700_PAL_BARRIER_COMPILER_STORE lfds700_pal_barrier_compiler() + #define LFDS700_PAL_BARRIER_COMPILER_FULL lfds700_pal_barrier_compiler() + + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __sync_synchronize() + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __sync_synchronize() + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __sync_synchronize() + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(pointer_to_compare) = __sync_val_compare_and_swap( pointer_to_destination, *(pointer_to_compare), new_destination ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (unsigned char) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + // TRD : ARM and x86 have DWCAS which we can get via GCC intrinsics + #if( defined __arm__ || defined __i686__ || defined __i586__ || defined __i486__ ) + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + int long long unsigned \ + original_destination; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + original_destination = __sync_val_compare_and_swap( (int long long unsigned volatile *) (pointer_to_destination), *(int long long unsigned *) (pointer_to_compare), *(int long long unsigned *) (pointer_to_new_destination) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_destination == *(int long long unsigned *) (pointer_to_compare) ); \ + \ + *(int long long unsigned *) (pointer_to_compare) = original_destination; \ + } + #endif + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *( (lfds700_pal_atom_t *) pointer_to_exchange) = (lfds700_pal_atom_t) __sync_lock_test_and_set( pointer_to_destination, *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && LFDS700_PAL_GCC_VERSION >= 473 ) + + /* TRD : GCC 4.7.3 and greater + + __GNUC__ indicates GCC + LFDS700_PAL_GCC_VERSION indicates which version + - __atomic_thread_fence requires 4.7.3 + + GCC 4.7.3 introduced the better __atomic*() atomic intrinsics + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + + #define LFDS700_PAL_COMPILER_STRING "GCC >= 4.7.3" + + #define LFDS700_PAL_ALIGN(alignment) __attribute__( (aligned(alignment)) ) + #define LFDS700_PAL_INLINE inline + + // TRD : GCC >= 4.7.3 compiler barriers are built into the intrinsics + #define LFDS700_PAL_NO_COMPILER_BARRIERS + + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __atomic_thread_fence( __ATOMIC_ACQUIRE ) + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __atomic_thread_fence( __ATOMIC_RELEASE ) + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __atomic_thread_fence( __ATOMIC_ACQ_REL ) + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + result = (char unsigned) __atomic_compare_exchange_n( pointer_to_destination, (void *) (pointer_to_compare), (new_destination), (cas_strength), __ATOMIC_RELAXED, __ATOMIC_RELAXED ); \ + } + + // TRD : ARM and x86 have DWCAS which we can get via GCC intrinsics + #if( defined __arm__ || defined __i686__ || defined __i586__ || defined __i486__ ) + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + (result) = (char unsigned) __atomic_compare_exchange_n( (int long long unsigned volatile *) (pointer_to_destination), (int long long unsigned *) (pointer_to_compare), *(int long long unsigned *) (pointer_to_new_destination), (cas_strength), __ATOMIC_RELAXED, __ATOMIC_RELAXED ); \ + } + #endif + + #if( defined __x86_64__ ) + /* TRD : __GNUC__ indicates GCC + - __asm__ requires GCC + - __volatile__ requires GCC + __x86_64__ indicates x64 + - cmpxchg16b requires x64 + + On 64 bit platforms, unsigned long long int is 64 bit, so we must manually use cmpxchg16b, + as __sync_val_compare_and_swap() will only emit cmpxchg8b + */ + + // TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, char unsigned result + + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + (result) = 0; \ + \ + __asm__ __volatile__ \ + ( \ + "lock;" /* make cmpxchg16b atomic */ \ + "cmpxchg16b %0;" /* cmpxchg16b sets ZF on success */ \ + "setz %3;" /* if ZF set, set result to 1 */ \ + \ + /* output */ \ + : "+m" (*pointer_to_destination), "+a" ((pointer_to_compare)[0]), "+d" ((pointer_to_compare)[1]), "=q" (result) \ + \ + /* input */ \ + : "b" ((pointer_to_new_destination)[0]), "c" ((pointer_to_new_destination)[1]) \ + \ + /* clobbered */ \ + : "cc", "memory" \ + ); \ + } + #endif + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + *(pointer_to_exchange) = __atomic_exchange_n( (pointer_to_destination), *(pointer_to_exchange), __ATOMIC_RELAXED ); \ + } + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h new file mode 100644 index 0000000000..0c1eba628a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h @@ -0,0 +1,133 @@ +/****************************************************************************/ +#if( defined _MSC_VER ) + /* TRD : MSVC compiler + + an unfortunately necessary hack for MSVC + MSVC only defines __STDC__ if /Za is given, where /Za turns off MSVC C extensions - + which prevents Windows header files from compiling. + */ + + #define __STDC__ 1 + #define __STDC_HOSTED__ 1 +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && __STDC_HOSTED__ == 1 && !defined _KERNEL_MODE ) + + // TRD : MSVC + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #include <assert.h> + + #define LFDS700_PAL_OS_STRING "Windows" + #define LFDS700_PAL_ASSERT( expression ) assert( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && defined __STDC_HOSTED__ && __STDC_HOSTED__ == 1 && defined _WIN32 && defined _KERNEL_MODE ) + + // TRD : MSVC, Windows kernel-mode + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #include <assert.h> + #include <intrin.h> + + #define LFDS700_PAL_OS_STRING "Windows" + #define LFDS700_PAL_ASSERT( expression ) assert( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && __STDC_HOSTED__ == 1 && !(defined __linux__ && defined _KERNEL_MODE) ) + + // TRD : GCC, hosted implementation (except for Linux kernel mode) + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #include <assert.h> + + #define LFDS700_PAL_OS_STRING "Embedded (hosted)" + #define LFDS700_PAL_ASSERT( expression ) assert( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && __STDC_HOSTED__ == 0 ) + + // TRD : GCC, freestanding or bare implementation + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #define LFDS700_PAL_OS_STRING "Embedded (freestanding/bare)" + #define LFDS700_PAL_ASSERT( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __linux__ && defined _KERNEL_MODE ) + + // TRD : GCC, Linux kernel-mode + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #include <linux/module.h> + + #define LFDS700_PAL_OS_STRING "Linux" + #define LFDS700_PAL_ASSERT( expression ) BUG_ON( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( !defined LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM ) + + #error No matching porting abstraction layer in lfds700_porting_abstraction_layer_operating_system.h + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h new file mode 100644 index 0000000000..1e81c0eae2 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h @@ -0,0 +1,544 @@ +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_IX86 ) + + /* TRD : MSVC, x86 + x86 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "x86" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && (defined _M_X64 || defined _M_AMD64) ) + + /* TRD : MSVC, x64 + x64 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "x64" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_IA64 ) + + /* TRD : MSVC, Itanium + IA64 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "IA64" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + + /****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_ARM ) + + /* TRD : MSVC, 32-bit ARM + + ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes + so the isolation value used here is worst-case - be sure to set + this correctly, otherwise structures are painfully large + */ + +#ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR +#error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h +#endif + +#define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + +#define LFDS700_PAL_PROCESSOR_STRING "ARM (32-bit)" + +#define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 +#define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + +#define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 +#define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __arm__ ) + + /* TRD : GCC, 32-bit ARM + + ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes + so the isolation value used here is worst-case - be sure to set + this correctly, otherwise structures are painfully large + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "ARM (32-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __aarch64__ ) + + /* TRD : GCC, 64-bit ARM + + ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes + so the isolation value used here is worst-case - be sure to set + this correctly, otherwise structures are painfully large + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "ARM (64-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && (defined __i686__ || defined __i586__ || defined __i486__) ) + + /* TRD : GCC, x86 + + x86 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "x86" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __x86_64__ ) + + /* TRD : GCC, x86 + + x64 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "x64" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __alpha__ ) + + /* TRD : GCC, alpha + + alpha is LL/SC, but there is only one reservation per processor, + so the isolation value used here is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "alpha" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __ia64__ ) + + /* TRD : GCC, Itanium + + Itanium is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "IA64" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __mips__ ) + + /* TRD : GCC, MIPS (32-bit) + + MIPS is LL/SC, but there is only one reservation per processor, + so the isolation value used here is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "MIPS (32-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __mips64 ) + + /* TRD : GCC, MIPS (64-bit) + + MIPS is LL/SC, but there is only one reservation per processor, + so the isolation value used here is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "MIPS (64-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __ppc__ ) + + /* TRD : GCC, POWERPC (32-bit) + + POWERPC is LL/SC and uses a reservation granule but I can't find + canonical documentation for its size - 128 bytes seems to be the + largest value I've found + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "POWERPC (32-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 128 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __ppc64__ ) + + /* TRD : GCC, POWERPC (64-bit) + + POWERPC is LL/SC and uses a reservation granule but I can't find + canonical documentation for its size - 128 bytes seems to be the + largest value I've found + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "POWERPC (64-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 128 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __sparc__ && !defined __sparc_v9__ ) + + /* TRD : GCC, SPARC (32-bit) + + SPARC is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "SPARC (32-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __sparc__ && defined __sparc_v9__ ) + + /* TRD : GCC, SPARC (64-bit) + + SPARC is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "SPARC (64-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __m68k__ ) + + /* TRD : GCC, 680x0 + + 680x0 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "680x0" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( !defined LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR ) + + #error No matching porting abstraction layer in lfds700_porting_abstraction_layer_processor.h + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h new file mode 100644 index 0000000000..025b0673e9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h @@ -0,0 +1,60 @@ +/***** defines *****/ +#define LFDS700_QUEUE_GET_KEY_FROM_ELEMENT( queue_element ) ( (queue_element).key ) +#define LFDS700_QUEUE_SET_KEY_IN_ELEMENT( queue_element, new_key ) ( (queue_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( queue_element ) ( (queue_element).value ) +#define LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( queue_element, new_value ) ( (queue_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) +#define LFDS700_QUEUE_GET_USER_STATE_FROM_STATE( queue_state ) ( (queue_state).user_state ) + +/***** enums *****/ +enum lfds700_queue_query +{ + LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, + LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_queue_element +{ + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile next[PAC_SIZE]; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *key; + + void + *value; +}; + +struct lfds700_queue_state +{ + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile enqueue[PAC_SIZE], + *volatile dequeue[PAC_SIZE]; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_queue_init_valid_on_current_logical_core( struct lfds700_queue_state *qs, + struct lfds700_queue_element *qe_dummy, + struct lfds700_misc_prng_state *ps, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_queue_cleanup( struct lfds700_queue_state *qs, + void (*element_cleanup_callback)(struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag) ); + +void lfds700_queue_enqueue( struct lfds700_queue_state *qs, + struct lfds700_queue_element *qe, + struct lfds700_misc_prng_state *ps ); + +int lfds700_queue_dequeue( struct lfds700_queue_state *qs, + struct lfds700_queue_element **qe, + struct lfds700_misc_prng_state *ps ); + +void lfds700_queue_query( struct lfds700_queue_state *qs, + enum lfds700_queue_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h new file mode 100644 index 0000000000..3b090e1d45 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h @@ -0,0 +1,59 @@ +/***** defines *****/ +#define LFDS700_QUEUE_BSS_GET_USER_STATE_FROM_STATE( queue_bss_state ) ( (queue_bss_state).user_state ) + +/***** enums *****/ +enum lfds700_queue_bss_query +{ + LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_QUEUE_BSS_QUERY_VALIDATE +}; + +/***** structures *****/ +struct lfds700_queue_bss_element +{ + void + *volatile key, + *volatile value; +}; + +struct lfds700_queue_bss_state +{ + lfds700_pal_uint_t + number_elements, + mask; + + lfds700_pal_uint_t volatile + read_index, + write_index; + + struct lfds700_queue_bss_element + *element_array; + + void + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_queue_bss_init_valid_on_current_logical_core( struct lfds700_queue_bss_state *qbsss, + struct lfds700_queue_bss_element *element_array, + lfds700_pal_uint_t number_elements, + void *user_state ); + // TRD : number_elements must be a positive integer power of 2 + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_queue_bss_cleanup( struct lfds700_queue_bss_state *qbsss, + void (*element_cleanup_callback)(struct lfds700_queue_bss_state *qbsss, void *key, void *value) ); + +int lfds700_queue_bss_enqueue( struct lfds700_queue_bss_state *qbsss, + void *key, + void *value ); + +int lfds700_queue_bss_dequeue( struct lfds700_queue_bss_state *qbsss, + void **key, + void **value ); + +void lfds700_queue_bss_query( struct lfds700_queue_bss_state *qbsss, + enum lfds700_queue_bss_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h new file mode 100644 index 0000000000..fbb21d2be4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h @@ -0,0 +1,69 @@ +/***** enums *****/ +#define LFDS700_RINGBUFFER_GET_USER_STATE_FROM_STATE( ringbuffer_state ) ( (ringbuffer_state).user_state ) + +/***** enums *****/ +enum lfds700_ringbuffer_query +{ + LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT, + LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_ringbuffer_element +{ + struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + fe; + + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + qe; + + struct lfds700_queue_element + *qe_use; // TRD : hack for 7.0.0; we need a new queue with no dummy element + + void + *key, + *value; +}; + +struct lfds700_ringbuffer_state +{ + struct lfds700_freelist_state LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + fs; + + struct lfds700_queue_state LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + qs; + + void + (*element_cleanup_callback)( struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag ), + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_ringbuffer_init_valid_on_current_logical_core( struct lfds700_ringbuffer_state *rs, + struct lfds700_ringbuffer_element *re_array_inc_dummy, + lfds700_pal_uint_t number_elements, + struct lfds700_misc_prng_state *ps, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_ringbuffer_cleanup( struct lfds700_ringbuffer_state *rs, + void (*element_cleanup_callback)(struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag) ); + +int lfds700_ringbuffer_read( struct lfds700_ringbuffer_state *rs, + void **key, + void **value, + struct lfds700_misc_prng_state *ps ); + +void lfds700_ringbuffer_write( struct lfds700_ringbuffer_state *rs, + void *key, + void *value, + enum lfds700_misc_flag *overwrite_occurred_flag, + void **overwritten_key, + void **overwritten_value, + struct lfds700_misc_prng_state *ps ); + +void lfds700_ringbuffer_query( struct lfds700_ringbuffer_state *rs, + enum lfds700_ringbuffer_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h new file mode 100644 index 0000000000..3faed80308 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h @@ -0,0 +1,55 @@ +/***** defines *****/ +#define LFDS700_STACK_GET_KEY_FROM_ELEMENT( stack_element ) ( (stack_element).key ) +#define LFDS700_STACK_SET_KEY_IN_ELEMENT( stack_element, new_key ) ( (stack_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_STACK_GET_VALUE_FROM_ELEMENT( stack_element ) ( (stack_element).value ) +#define LFDS700_STACK_SET_VALUE_IN_ELEMENT( stack_element, new_value ) ( (stack_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) +#define LFDS700_STACK_GET_USER_STATE_FROM_STATE( stack_state ) ( (stack_state).user_state ) + +/***** enums *****/ +enum lfds700_stack_query +{ + LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT, + LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_stack_element +{ + struct lfds700_stack_element + *volatile next; + + void + *key, + *value; +}; + +struct lfds700_stack_state +{ + struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile top[PAC_SIZE]; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_stack_init_valid_on_current_logical_core( struct lfds700_stack_state *ss, void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_stack_cleanup( struct lfds700_stack_state *ss, + void (*element_cleanup_callback)(struct lfds700_stack_state *ss, struct lfds700_stack_element *se) ); + +void lfds700_stack_push( struct lfds700_stack_state *ss, + struct lfds700_stack_element *se, + struct lfds700_misc_prng_state *ps ); + +int lfds700_stack_pop( struct lfds700_stack_state *ss, + struct lfds700_stack_element **se, + struct lfds700_misc_prng_state *ps ); + +void lfds700_stack_query( struct lfds700_stack_state *ss, + enum lfds700_stack_query query_type, + void *query_input, + void *query_output ); + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c new file mode 100644 index 0000000000..2927c98628 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c @@ -0,0 +1,117 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + + + + + +/****************************************************************************/ +void lfds700_btree_au_cleanup( struct lfds700_btree_au_state *baus, + void (*element_cleanup_callback)(struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue) ) +{ + enum lfds700_btree_au_delete_action + delete_action = LFDS700_BTREE_AU_DELETE_SELF; // TRD : to remove compiler warning + + struct lfds700_btree_au_element + *baue; + + struct lfds700_btree_au_element + *temp; + + LFDS700_PAL_ASSERT( baus != NULL ); + // TRD : element_delete_function can be NULL + + /* TRD : we're not lock-free now, so delete at will + but be iterative, so can be used in kernels (where there's little stack) + and be performant, since the user may be + creating/destroying many of these trees + also remember the user may be deallocating user data + so we cannot visit an element twice + + we start at the root and iterate till we go to NULL + if the element has zero children, we delete it and move up to its parent + if the element has one child, we delete it, move its child into its place, and continue from its child + if the element has two children, we move left + + the purpose of this is to minimize walking around the tree + to prevent visiting an element twice + while also minimizing code complexity + */ + + if( element_cleanup_callback == NULL ) + return; + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_btree_au_get_by_absolute_position( baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT ); + + while( baue != NULL ) + { + if( baue->left == NULL and baue->right == NULL ) + delete_action = LFDS700_BTREE_AU_DELETE_SELF; + + if( baue->left != NULL and baue->right == NULL ) + delete_action = LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD; + + if( baue->left == NULL and baue->right != NULL ) + delete_action = LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD; + + if( baue->left != NULL and baue->right != NULL ) + delete_action = LFDS700_BTREE_AU_DELETE_MOVE_LEFT; + + switch( delete_action ) + { + case LFDS700_BTREE_AU_DELETE_SELF: + // TRD : if we have a parent (we could be root) set his point to us to NULL + if( baue->up != NULL ) + { + if( baue->up->left == baue ) + baue->up->left = NULL; + if( baue->up->right == baue ) + baue->up->right = NULL; + } + + temp = baue; + lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_UP ); + element_cleanup_callback( baus, temp ); + break; + + case LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD: + baue->left->up = baue->up; + if( baue->up != NULL ) + { + if( baue->up->left == baue ) + baue->up->left = baue->left; + if( baue->up->right == baue ) + baue->up->right = baue->left; + } + + temp = baue; + lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT ); + element_cleanup_callback( baus, temp ); + break; + + case LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD: + baue->right->up = baue->up; + if( baue->up != NULL ) + { + if( baue->up->left == baue ) + baue->up->left = baue->right; + if( baue->up->right == baue ) + baue->up->right = baue->right; + } + + temp = baue; + lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT ); + element_cleanup_callback( baus, temp ); + break; + + case LFDS700_BTREE_AU_DELETE_MOVE_LEFT: + lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT ); + break; + } + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c new file mode 100644 index 0000000000..8a2cdf93e8 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c @@ -0,0 +1,467 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + +/***** private prototypes *****/ +static void lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( struct lfds700_btree_au_element **baue ); +static void lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( struct lfds700_btree_au_element **baue ); + + + + + +/****************************************************************************/ +int lfds700_btree_au_get_by_key( struct lfds700_btree_au_state *baus, + void *key, + struct lfds700_btree_au_element **baue ) +{ + int + compare_result = !0, + rv = 1; + + LFDS700_PAL_ASSERT( baus != NULL ); + // TRD : key can be NULL + LFDS700_PAL_ASSERT( baue != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + *baue = baus->root; + + LFDS700_MISC_BARRIER_LOAD; + + while( *baue != NULL and compare_result != 0 ) + { + compare_result = baus->key_compare_function( key, (*baue)->key ); + + if( compare_result < 0 ) + { + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + } + + if( compare_result > 0 ) + { + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + } + } + + if( *baue == NULL ) + rv = 0; + + return( rv ); +} + + + + + +/****************************************************************************/ +int lfds700_btree_au_get_by_absolute_position( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element **baue, enum lfds700_btree_au_absolute_position absolute_position ) +{ + int + rv = 1; + + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( baue != NULL ); + // TRD : absolute_position can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + *baue = baus->root; + + LFDS700_MISC_BARRIER_LOAD; + + switch( absolute_position ) + { + case LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT: + break; + + case LFDS700_BTREE_AU_ABSOLUTE_POSITION_LARGEST_IN_TREE: + if( *baue != NULL ) + while( (*baue)->right != NULL ) + { + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + } + break; + + case LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE: + if( *baue != NULL ) + while( (*baue)->left != NULL ) + { + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + } + break; + } + + if( *baue == NULL ) + rv = 0; + + return( rv ); +} + + + + + +/****************************************************************************/ +int lfds700_btree_au_get_by_relative_position( struct lfds700_btree_au_element **baue, enum lfds700_btree_au_relative_position relative_position ) +{ + int + rv = 1; + + LFDS700_PAL_ASSERT( baue != NULL ); + // TRD : relative_position can baue any value in its range + + if( *baue == NULL ) + return( 0 ); + + LFDS700_MISC_BARRIER_LOAD; + + switch( relative_position ) + { + case LFDS700_BTREE_AU_RELATIVE_POSITION_UP: + *baue = (*baue)->up; + // TRD : no load barrier - up already existed, so is known to be safely propagated + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT: + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT: + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_SMALLEST_ELEMENT_BELOW_CURRENT_ELEMENT: + *baue = (*baue)->left; + if( *baue != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + while( (*baue)->right != NULL ) + { + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + } + } + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_LARGEST_ELEMENT_BELOW_CURRENT_ELEMENT: + *baue = (*baue)->right; + if( *baue != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + while( (*baue)->left != NULL ) + { + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + } + } + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE: + lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( baue ); + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE: + lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( baue ); + break; + } + + if( *baue == NULL ) + rv = 0; + + return( rv ); +} + + + + + +/****************************************************************************/ +static void lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( struct lfds700_btree_au_element **baue ) +{ + enum lfds700_btree_au_move + action = LFDS700_BTREE_AU_MOVE_INVALID; + + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED, + load_finished_flag = LFDS700_MISC_FLAG_LOWERED; + + struct lfds700_btree_au_element + *left = NULL, + *right = NULL, + *up = NULL, + *up_left = NULL, + *up_right = NULL; + + LFDS700_PAL_ASSERT( baue != NULL ); + + /* TRD : from any given element, the next smallest element is; + 1. if we have a left, it's the largest element on the right branch of our left child + 2. if we don't have a left, and we're on the right of our parent, then it's our parent + 3. if we don't have a left, and we're on the left of our parent or we have no parent, + iterative up the tree until we find the first child who is on the right of its parent; then it's the parent + */ + + /* TRD : we need to ensure the variables we use to decide our action are self-consistent + to do this, we make local copies of them all + then, if they are all not NULL, we can know they cannot change and we can continue + if however any of them are NULL, they could have changed while we were reading + and so our variables could be non-self-consistent + to check for this, we issue another processor read barrier + and then compare our local variables with the values in the tree + if they all match, then we know our variable set is self-consistent + (even though it may now be wrong - but we will discover this when we try the atomic operation) + */ + + LFDS700_MISC_BARRIER_LOAD; + + while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + left = (*baue)->left; + right = (*baue)->right; + up = (*baue)->up; + if( up != NULL ) + { + up_left = (*baue)->up->left; + up_right = (*baue)->up->right; + } + + if( left != NULL and right != NULL and (up == NULL or (up != NULL and up_left != NULL and up_right != NULL)) ) + break; + + LFDS700_MISC_BARRIER_LOAD; + + if( left == (*baue)->left and right == (*baue)->right and (up == NULL or (up != NULL and up == (*baue)->up and up_left == (*baue)->up->left and up_right == (*baue)->up->right)) ) + load_finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( left != NULL ) + action = LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD; + + if( left == NULL and up != NULL and up_right == *baue ) + action = LFDS700_BTREE_AU_MOVE_GET_PARENT; + + if( (left == NULL and up == NULL) or (up != NULL and up_left == *baue and left == NULL) ) + action = LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE; + + switch( action ) + { + case LFDS700_BTREE_AU_MOVE_INVALID: + case LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD: + // TRD : eliminates a compiler warning + break; + + case LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD: + *baue = left; + if( *baue != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + while( (*baue)->right != NULL ) + { + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + } + } + break; + + case LFDS700_BTREE_AU_MOVE_GET_PARENT: + *baue = up; + break; + + case LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE: + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + load_finished_flag = LFDS700_MISC_FLAG_LOWERED; + + while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + up = (*baue)->up; + if( up != NULL ) + up_left = (*baue)->up->left; + + if( up == NULL or (up != NULL and up_left != NULL) ) + break; + + LFDS700_MISC_BARRIER_LOAD; + + if( up == (*baue)->up and up_left == (*baue)->up->left ) + load_finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( *baue != NULL and up != NULL and *baue == up_left ) + *baue = up; + else + finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + *baue = up; + + /* + + while( *baue != NULL and (*baue)->up != NULL and *baue == (*baue)->up->left ) + *baue = (*baue)->up; + + *baue = (*baue)->up; + + */ + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( struct lfds700_btree_au_element **baue ) +{ + enum lfds700_btree_au_move + action = LFDS700_BTREE_AU_MOVE_INVALID; + + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED, + load_finished_flag = LFDS700_MISC_FLAG_LOWERED; + + struct lfds700_btree_au_element + *left = NULL, + *right = NULL, + *up = NULL, + *up_left = NULL, + *up_right = NULL; + + LFDS700_PAL_ASSERT( baue != NULL ); + + /* TRD : from any given element, the next largest element is; + 1. if we have a right, it's the smallest element on the left branch of our right child + 2. if we don't have a right, and we're on the left of our parent, then it's our parent + 3. if we don't have a right, and we're on the right of our parent or we have no parent, + iterate up the tree until we find the first child who is on the left of its parent; then it's the parent + */ + + LFDS700_MISC_BARRIER_LOAD; + + while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + left = (*baue)->left; + right = (*baue)->right; + up = (*baue)->up; + if( up != NULL ) + { + up_left = (*baue)->up->left; + up_right = (*baue)->up->right; + } + + if( left != NULL and right != NULL and (up == NULL or (up != NULL and up_left != NULL and up_right != NULL)) ) + break; + + LFDS700_MISC_BARRIER_LOAD; + + if( left == (*baue)->left and right == (*baue)->right and (up == NULL or (up != NULL and up == (*baue)->up and up_left == (*baue)->up->left and up_right == (*baue)->up->right)) ) + load_finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( right != NULL ) + action = LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD; + + if( right == NULL and up != NULL and up_left == *baue ) + action = LFDS700_BTREE_AU_MOVE_GET_PARENT; + + if( (right == NULL and up == NULL) or (up != NULL and up_right == *baue and right == NULL) ) + action = LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE; + + switch( action ) + { + case LFDS700_BTREE_AU_MOVE_INVALID: + case LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD: + // TRD : remove compiler warning + break; + + case LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD: + *baue = right; + if( *baue != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + while( (*baue)->left != NULL ) + { + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + } + } + break; + + case LFDS700_BTREE_AU_MOVE_GET_PARENT: + *baue = up; + break; + + case LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE: + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + load_finished_flag = LFDS700_MISC_FLAG_LOWERED; + + while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + up = (*baue)->up; + if( up != NULL ) + up_right = (*baue)->up->right; + + if( up == NULL or (up != NULL and up_right != NULL) ) + break; + + LFDS700_MISC_BARRIER_LOAD; + + if( up == (*baue)->up and up_right == (*baue)->up->right ) + load_finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( *baue != NULL and up != NULL and *baue == up_right ) + *baue = up; + else + finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + *baue = up; + + /* + + while( *baue != NULL and (*baue)->up != NULL and *baue == (*baue)->up->right ) + *baue = (*baue)->up; + + *baue = (*baue)->up; + + */ + break; + } + + return; +} + + + + + +/****************************************************************************/ +int lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element **baue, enum lfds700_btree_au_absolute_position absolute_position, enum lfds700_btree_au_relative_position relative_position ) +{ + int + rv; + + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( baue != NULL ); + // TRD: absolute_position can be any value in its range + // TRD: relative_position can be any value in its range + + if( *baue == NULL ) + rv = lfds700_btree_au_get_by_absolute_position( baus, baue, absolute_position ); + else + rv = lfds700_btree_au_get_by_relative_position( baue, relative_position ); + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c new file mode 100644 index 0000000000..7dd0efd6c0 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c @@ -0,0 +1,32 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + + + + + +/****************************************************************************/ +void lfds700_btree_au_init_valid_on_current_logical_core( struct lfds700_btree_au_state *baus, + int (*key_compare_function)(void const *new_key, void const *existing_key), + enum lfds700_btree_au_existing_key existing_key, + void *user_state ) +{ + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baus->root % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baus->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( key_compare_function != NULL ); + // TRD : existing_key can be any value in its range + // TRD : user_state can be NULL + + baus->root = NULL; + baus->key_compare_function = key_compare_function; + baus->existing_key = existing_key; + baus->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c new file mode 100644 index 0000000000..8808177a4c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c @@ -0,0 +1,156 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + + + + + +/****************************************************************************/ +enum lfds700_btree_au_insert_result lfds700_btree_au_insert( struct lfds700_btree_au_state *baus, + struct lfds700_btree_au_element *baue, + struct lfds700_btree_au_element **existing_baue, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result = 0; + + int + compare_result = 0; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_btree_au_element + *volatile compare = NULL, + *volatile baue_next = NULL, + *volatile baue_parent = NULL, + *volatile baue_temp; + + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( baue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->left % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->right % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->up % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : existing_baue can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + /* TRD : we follow a normal search for the insert node and which side to insert + + the difference is that insertion may fail because someone else inserts + there before we do + + in this case, we resume searching for the insert node from the node + we were attempting to insert upon + + (if we attempted to insert the root node and this failed, i.e. we thought + the tree was empty but then it wasn't, then we start searching from the + new root) + */ + + baue->up = baue->left = baue->right = NULL; + + LFDS700_MISC_BARRIER_LOAD; + + baue_temp = baus->root; + + LFDS700_MISC_BARRIER_LOAD; + + while( result == 0 ) + { + // TRD : first we find where to insert + while( baue_temp != NULL ) + { + compare_result = baus->key_compare_function( baue->key, baue_temp->key ); + + if( compare_result == 0 ) + { + if( existing_baue != NULL ) + *existing_baue = baue_temp; + + switch( baus->existing_key ) + { + case LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE: + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( *baue_temp, baue->value ); + return( LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ); + break; + + case LFDS700_BTREE_AU_EXISTING_KEY_FAIL: + return( LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ); + break; + } + } + + if( compare_result < 0 ) + baue_next = baue_temp->left; + + if( compare_result > 0 ) + baue_next = baue_temp->right; + + baue_parent = baue_temp; + baue_temp = baue_next; + if( baue_temp != NULL ) + LFDS700_MISC_BARRIER_LOAD; + } + + /* TRD : second, we actually insert + + at this point baue_temp has come to NULL + and baue_parent is the element to insert at + and result of the last compare indicates + the direction of insertion + + it may be that another tree has already inserted an element with + the same key as ourselves, or other elements which mean our position + is now wrong + + in this case, it is either inserted in the position we're trying + to insert in now, in which case our insert will fail + + or, similarly, other elements will have come in where we are, + and our insert will fail + */ + + if( baue_parent == NULL ) + { + compare = NULL; + baue->up = baus->root; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baus->root, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result == 0 ) + baue_temp = baus->root; + } + + if( baue_parent != NULL ) + { + if( compare_result <= 0 ) + { + compare = NULL; + baue->up = baue_parent; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baue_parent->left, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + + if( compare_result > 0 ) + { + compare = NULL; + baue->up = baue_parent; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baue_parent->right, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + + // TRD : if the insert fails, resume searching at the insert node + if( result == 0 ) + baue_temp = baue_parent; + } + } + + // TRD : if we get to here, we added (not failed or overwrite on exist) a new element + if( existing_baue != NULL ) + *existing_baue = NULL; + + return( LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h new file mode 100644 index 0000000000..54149bac99 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h @@ -0,0 +1,23 @@ +/***** the library-wide header file *****/ +#include "../liblfds700_internal.h" + +/***** enums *****/ +enum lfds700_btree_au_move +{ + LFDS700_BTREE_AU_MOVE_INVALID, + LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD, + LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD, + LFDS700_BTREE_AU_MOVE_GET_PARENT, + LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE +}; + +enum lfds700_btree_au_delete_action +{ + LFDS700_BTREE_AU_DELETE_SELF, + LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD, + LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD, + LFDS700_BTREE_AU_DELETE_MOVE_LEFT +}; + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c new file mode 100644 index 0000000000..dce9587929 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c @@ -0,0 +1,121 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + +/***** private prototypes *****/ +static void lfds700_btree_au_internal_validate( struct lfds700_btree_au_state *abs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_btree_au_validity ); + + + + + +/****************************************************************************/ +void lfds700_btree_au_query( struct lfds700_btree_au_state *baus, enum lfds700_btree_au_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( baus != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + { + struct lfds700_btree_au_element + *baue = NULL; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + while( lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) + ( *(lfds700_pal_uint_t *) query_output )++; + } + break; + + case LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_btree_au_internal_validate( baus, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_btree_au_internal_validate( struct lfds700_btree_au_state *baus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_btree_au_validity ) +{ + lfds700_pal_uint_t + number_elements_from_query_tree = 0, + number_elements_from_walk = 0; + + struct lfds700_btree_au_element + *baue = NULL, + *baue_prev = NULL; + + LFDS700_PAL_ASSERT( baus!= NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_btree_au_validity != NULL ); + + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : validation is performed by; + + performing an in-order walk + we should see every element is larger than the preceeding element + we count elements as we go along (visited elements, that is) + and check our tally equals the expected count + */ + + LFDS700_MISC_BARRIER_LOAD; + + while( lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) + { + // TRD : baue_prev should always be smaller than or equal to baue + if( baue_prev != NULL ) + if( baus->key_compare_function(baue_prev->key, baue->key) > 0 ) + { + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ORDER; + return; + } + + baue_prev = baue; + number_elements_from_walk++; + } + + if( *lfds700_btree_au_validity == LFDS700_MISC_VALIDITY_VALID ) + { + lfds700_btree_au_query( (struct lfds700_btree_au_state *) baus, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements_from_query_tree ); + + if( number_elements_from_walk > number_elements_from_query_tree ) + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( number_elements_from_walk < number_elements_from_query_tree ) + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + } + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_btree_au_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_btree_au_query( (struct lfds700_btree_au_state *) baus, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements_from_query_tree ); + + if( number_elements_from_query_tree < vi->min_elements ) + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements_from_query_tree > vi->max_elements ) + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c new file mode 100644 index 0000000000..f7a088a39a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c @@ -0,0 +1,36 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + + + + + +/****************************************************************************/ +void lfds700_freelist_cleanup( struct lfds700_freelist_state *fs, + void (*element_cleanup_callback)(struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe) ) +{ + struct lfds700_freelist_element + *fe, + *fe_temp; + + LFDS700_PAL_ASSERT( fs != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback != NULL ) + { + fe = fs->top[POINTER]; + + while( fe != NULL ) + { + fe_temp = fe; + fe = fe->next; + + element_cleanup_callback( fs, fe_temp ); + } + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c new file mode 100644 index 0000000000..fcacd1b32f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c @@ -0,0 +1,27 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + + + + + +/****************************************************************************/ +void lfds700_freelist_init_valid_on_current_logical_core( struct lfds700_freelist_state *fs, void *user_state ) +{ + LFDS700_PAL_ASSERT( fs != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) fs->top % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &fs->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : user_state can be NULL + + fs->top[POINTER] = NULL; + fs->top[COUNTER] = 0; + + fs->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c new file mode 100644 index 0000000000..c0a3545d91 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c @@ -0,0 +1,52 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + + + + + +/****************************************************************************/ +int lfds700_freelist_pop( struct lfds700_freelist_state *fs, struct lfds700_freelist_element **fe, struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *new_top[PAC_SIZE], + *volatile original_top[PAC_SIZE]; + + LFDS700_PAL_ASSERT( fs != NULL ); + LFDS700_PAL_ASSERT( fe != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_PAL_BARRIER_PROCESSOR_LOAD; + + original_top[COUNTER] = fs->top[COUNTER]; + original_top[POINTER] = fs->top[POINTER]; + + do + { + if( original_top[POINTER] == NULL ) + { + *fe = NULL; + return( 0 ); + } + + new_top[COUNTER] = original_top[COUNTER] + 1; + new_top[POINTER] = original_top[POINTER]->next; + + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &fs->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result != 1 ) + LFDS700_PAL_BARRIER_PROCESSOR_LOAD; + } + while( result != 1 ); + + *fe = original_top[POINTER]; + + return( 1 ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c new file mode 100644 index 0000000000..67fe38dadb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c @@ -0,0 +1,42 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + + + + + +/****************************************************************************/ +void lfds700_freelist_push( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe, struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *new_top[PAC_SIZE], + *volatile original_top[PAC_SIZE]; + + LFDS700_PAL_ASSERT( fs != NULL ); + LFDS700_PAL_ASSERT( fe != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + new_top[POINTER] = fe; + + original_top[COUNTER] = fs->top[COUNTER]; + original_top[POINTER] = fs->top[POINTER]; + + do + { + new_top[COUNTER] = original_top[COUNTER] + 1; + fe->next = original_top[POINTER]; + + LFDS700_PAL_BARRIER_PROCESSOR_STORE; + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &fs->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + while( result != 1 ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c new file mode 100644 index 0000000000..43b8bc263d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c @@ -0,0 +1,123 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + +/***** private prototypes *****/ +static void lfds700_freelist_internal_freelist_validate( struct lfds700_freelist_state *fs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_freelist_validity ); + + + + + +/****************************************************************************/ +void lfds700_freelist_query( struct lfds700_freelist_state *fs, enum lfds700_freelist_query query_type, void *query_input, void *query_output ) +{ + struct lfds700_freelist_element + *fe; + + LFDS700_PAL_ASSERT( fs != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + fe = (struct lfds700_freelist_element *) fs->top[POINTER]; + + while( fe != NULL ) + { + ( *(lfds700_pal_uint_t *) query_output )++; + fe = (struct lfds700_freelist_element *) fe->next; + } + break; + + case LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_freelist_internal_freelist_validate( fs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_freelist_internal_freelist_validate( struct lfds700_freelist_state *fs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_freelist_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_freelist_element + *fe_slow, + *fe_fast; + + LFDS700_PAL_ASSERT( fs != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_freelist_validity != NULL ); + + *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_VALID; + + fe_slow = fe_fast = (struct lfds700_freelist_element *) fs->top[POINTER]; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the top of the freelist + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the freelist) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( fe_slow != NULL ) + do + { + fe_slow = fe_slow->next; + + if( fe_fast != NULL ) + fe_fast = fe_fast->next; + + if( fe_fast != NULL ) + fe_fast = fe_fast->next; + } + while( fe_slow != NULL and fe_fast != fe_slow ); + + if( fe_fast != NULL and fe_slow != NULL and fe_fast == fe_slow ) + *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_freelist_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_freelist_query( fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c new file mode 100644 index 0000000000..af88b19179 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c @@ -0,0 +1,61 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + +/***** private prototypes*****/ +static void btree_au_element_cleanup_function( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue ); + + + + + +/****************************************************************************/ +void lfds700_hash_a_cleanup( struct lfds700_hash_a_state *has, + void (*element_cleanup_callback)(struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae) ) +{ + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( has != NULL ); + // TRD : element_cleanup_callback can be NULL + + if( element_cleanup_callback == NULL ) + return; + + LFDS700_MISC_BARRIER_LOAD; + + has->element_cleanup_callback = element_cleanup_callback; + + for( loop = 0 ; loop < has->array_size ; loop++ ) + lfds700_btree_au_cleanup( has->baus_array+loop, btree_au_element_cleanup_function ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void btree_au_element_cleanup_function( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue ) +{ + struct lfds700_hash_a_state + *has; + + struct lfds700_hash_a_element + *hae; + + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( baue != NULL ); + + hae = (struct lfds700_hash_a_element *) LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *baue ); + has = (struct lfds700_hash_a_state *) LFDS700_BTREE_AU_GET_USER_STATE_FROM_STATE( *baus ); + + has->element_cleanup_callback( has, hae ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c new file mode 100644 index 0000000000..8d010664ab --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c @@ -0,0 +1,37 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + + + + + +/****************************************************************************/ +int lfds700_hash_a_get_by_key( struct lfds700_hash_a_state *has, + void *key, + struct lfds700_hash_a_element **hae ) +{ + int + rv; + + lfds700_pal_uint_t + hash = 0; + + struct lfds700_btree_au_element + *baue; + + LFDS700_PAL_ASSERT( has != NULL ); + // TRD : key can be NULL + LFDS700_PAL_ASSERT( hae != NULL ); + + has->key_hash_function( key, &hash ); + + rv = lfds700_btree_au_get_by_key( has->baus_array + (hash % has->array_size), key, &baue ); + + if( rv == 1 ) + *hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *baue ); + else + *hae = NULL; + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c new file mode 100644 index 0000000000..022024ce27 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c @@ -0,0 +1,54 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + + + + + +/****************************************************************************/ +void lfds700_hash_a_init_valid_on_current_logical_core( struct lfds700_hash_a_state *has, + struct lfds700_btree_au_state *baus_array, + lfds700_pal_uint_t array_size, + int (*key_compare_function)(void const *new_key, void const *existing_key), + void (*key_hash_function)(void const *key, lfds700_pal_uint_t *hash), + enum lfds700_hash_a_existing_key existing_key, + void *user_state ) +{ + enum lfds700_btree_au_existing_key + btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE; // TRD : for compiler warning + + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( has != NULL ); + LFDS700_PAL_ASSERT( baus_array != NULL ); + LFDS700_PAL_ASSERT( array_size > 0 ); + LFDS700_PAL_ASSERT( key_compare_function != NULL ); + LFDS700_PAL_ASSERT( key_hash_function != NULL ); + // TRD : existing_key can be any value in its range + // TRD : user_state can be NULL + + has->array_size = array_size; + has->key_compare_function = key_compare_function; + has->key_hash_function = key_hash_function; + has->existing_key = existing_key; + has->baus_array = baus_array; + has->user_state = user_state; + + if( has->existing_key == LFDS700_HASH_A_EXISTING_KEY_OVERWRITE ) + btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE; + + if( has->existing_key == LFDS700_HASH_A_EXISTING_KEY_FAIL ) + btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_FAIL; + + // TRD : since the addonly_hash atomic counts, if that flag is set, the btree_addonly_unbalanceds don't have to + for( loop = 0 ; loop < array_size ; loop++ ) + lfds700_btree_au_init_valid_on_current_logical_core( has->baus_array+loop, key_compare_function, btree_au_existing_key, user_state ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c new file mode 100644 index 0000000000..25df3e7f93 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c @@ -0,0 +1,62 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + + + + + +/****************************************************************************/ +enum lfds700_hash_a_insert_result lfds700_hash_a_insert( struct lfds700_hash_a_state *has, + struct lfds700_hash_a_element *hae, + struct lfds700_hash_a_element **existing_hae, + struct lfds700_misc_prng_state *ps ) +{ + enum lfds700_hash_a_insert_result + apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS; + + enum lfds700_btree_au_insert_result + alr; + + lfds700_pal_uint_t + hash = 0; + + struct lfds700_btree_au_element + *existing_baue; + + LFDS700_PAL_ASSERT( has != NULL ); + LFDS700_PAL_ASSERT( hae != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &hae->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : existing_hae can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + // TRD : alignment checks + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &hae->baue % LFDS700_PAL_ALIGN_SINGLE_POINTER == 0 ); + + has->key_hash_function( hae->key, &hash ); + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( hae->baue, hae->key ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( hae->baue, hae ); + + alr = lfds700_btree_au_insert( has->baus_array + (hash % has->array_size), &hae->baue, &existing_baue, ps ); + + switch( alr ) + { + case LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY: + if( existing_hae != NULL ) + *existing_hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *existing_baue ); + + apr = LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY; + break; + + case LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE: + apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE; + break; + + case LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS: + apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS; + break; + } + + return( apr ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c new file mode 100644 index 0000000000..3e06be3f90 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c @@ -0,0 +1,58 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + + + + + +/****************************************************************************/ +void lfds700_hash_a_iterate_init( struct lfds700_hash_a_state *has, struct lfds700_hash_a_iterate *hai ) +{ + LFDS700_PAL_ASSERT( has != NULL ); + LFDS700_PAL_ASSERT( hai != NULL ); + + hai->baus = has->baus_array; + hai->baus_end = has->baus_array + has->array_size; + hai->baue = NULL; + + return; +} + + + + + +/****************************************************************************/ +int lfds700_hash_a_iterate( struct lfds700_hash_a_iterate *hai, struct lfds700_hash_a_element **hae ) +{ + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED; + + int + rv = 0; + + LFDS700_PAL_ASSERT( hai != NULL ); + LFDS700_PAL_ASSERT( hae != NULL ); + + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( hai->baus, &hai->baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE ); + + if( hai->baue != NULL ) + { + *hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *hai->baue ); + finished_flag = LFDS700_MISC_FLAG_RAISED; + rv = 1; + } + + if( hai->baue == NULL ) + if( ++hai->baus == hai->baus_end ) + { + *hae = NULL; + finished_flag = LFDS700_MISC_FLAG_RAISED; + } + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c new file mode 100644 index 0000000000..9d89a8838d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c @@ -0,0 +1,112 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + +/***** private prototypes *****/ +static void lfds700_hash_a_internal_validate( struct lfds700_hash_a_state *has, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_hash_a_validity ); + + + + + +/****************************************************************************/ +void lfds700_hash_a_query( struct lfds700_hash_a_state *has, enum lfds700_hash_a_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( has != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + { + struct lfds700_hash_a_iterate + ai; + + struct lfds700_hash_a_element + *hae; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + lfds700_hash_a_iterate_init( has, &ai ); + + while( lfds700_hash_a_iterate(&ai, &hae) ) + ( *(lfds700_pal_uint_t *) query_output )++; + } + break; + + case LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE: + // TRD: query_input can be any value in its range + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_hash_a_internal_validate( has, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_hash_a_internal_validate( struct lfds700_hash_a_state *has, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_hash_a_validity ) +{ + lfds700_pal_uint_t + lfds700_hash_a_total_number_elements = 0, + lfds700_btree_au_total_number_elements = 0, + number_elements; + + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( has!= NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_hash_a_validity != NULL ); + + /* TRD : validate every btree_addonly_unbalanced in the addonly_hash + sum elements in each btree_addonly_unbalanced + check matches expected element counts (if vi is provided) + */ + + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_VALID; + + for( loop = 0 ; *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID and loop < has->array_size ; loop++ ) + lfds700_btree_au_query( has->baus_array+loop, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, NULL, (void *) lfds700_hash_a_validity ); + + if( *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID ) + { + for( loop = 0 ; loop < has->array_size ; loop++ ) + { + lfds700_btree_au_query( has->baus_array+loop, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements ); + lfds700_btree_au_total_number_elements += number_elements; + } + + // TRD : first, check btree_addonly_unbalanced total vs the addonly_hash total + lfds700_hash_a_query( has, LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &lfds700_hash_a_total_number_elements ); + + // TRD : the btree_addonly_unbalanceds are assumed to speak the truth + if( lfds700_hash_a_total_number_elements < lfds700_btree_au_total_number_elements ) + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( lfds700_hash_a_total_number_elements > lfds700_btree_au_total_number_elements ) + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + // TRD : second, if we're still valid and vi is provided, check the btree_addonly_unbalanced total against vi + if( *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + if( lfds700_btree_au_total_number_elements < vi->min_elements ) + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( lfds700_btree_au_total_number_elements > vi->max_elements ) + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c new file mode 100644 index 0000000000..580fa9b3ac --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c @@ -0,0 +1,37 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_aos_cleanup( struct lfds700_list_aos_state *laoss, + void (*element_cleanup_callback)(struct lfds700_list_aos_state *laoss, struct lfds700_list_aos_element *laose) ) +{ + struct lfds700_list_aos_element + *laose, + *temp; + + LFDS700_PAL_ASSERT( laoss != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback == NULL ) + return; + + laose = LFDS700_LIST_AOS_GET_START( *laoss ); + + while( laose != NULL ) + { + temp = laose; + + laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); + + element_cleanup_callback( laoss, temp ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c new file mode 100644 index 0000000000..9d4cab5e53 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c @@ -0,0 +1,29 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + + + + + +/****************************************************************************/ +int lfds700_list_aos_get_by_key( struct lfds700_list_aos_state *laoss, + void *key, + struct lfds700_list_aos_element **laose ) +{ + int + cr = !0, + rv = 1; + + LFDS700_PAL_ASSERT( laoss != NULL ); + LFDS700_PAL_ASSERT( key != NULL ); + LFDS700_PAL_ASSERT( laose != NULL ); + + while( cr != 0 and LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(*laoss, *laose) ) + cr = laoss->key_compare_function( key, (*laose)->key ); + + if( *laose == NULL ) + rv = 0; + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c new file mode 100644 index 0000000000..4c92835ce5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c @@ -0,0 +1,37 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_aos_init_valid_on_current_logical_core( struct lfds700_list_aos_state *laoss, + int (*key_compare_function)(void const *new_key, void const *existing_key), + enum lfds700_list_aos_existing_key existing_key, + void *user_state ) +{ + LFDS700_PAL_ASSERT( laoss != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->start % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->dummy_element % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( key_compare_function != NULL ); + // TRD : existing_key can be any value in its range + // TRD : user_state can be NULL + + // TRD : dummy start element - makes code easier when you can always use ->next + laoss->start = &laoss->dummy_element; + + laoss->start->next = NULL; + laoss->start->value = NULL; + laoss->key_compare_function = key_compare_function; + laoss->existing_key = existing_key; + laoss->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c new file mode 100644 index 0000000000..9beead4e1d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c @@ -0,0 +1,134 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + + + + + +/****************************************************************************/ +enum lfds700_list_aos_insert_result lfds700_list_aos_insert( struct lfds700_list_aos_state *laoss, + struct lfds700_list_aos_element *laose, + struct lfds700_list_aos_element **existing_laose, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED; + + int + compare_result = 0; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_list_aos_element + *volatile laose_temp = NULL, + *volatile laose_trailing; + + LFDS700_PAL_ASSERT( laoss != NULL ); + LFDS700_PAL_ASSERT( laose != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : existing_laose can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + /* TRD : imagine a list, sorted small to large + + we arrive at an element + we obtain its next pointer + we check we are greater than the current element and smaller than the next element + this means we have found the correct location to insert + we try to CAS ourselves in; in the meantime, + someone else has *aready* swapped in an element which is smaller than we are + + e.g. + + the list is { 1, 10 } and we are the value 5 + + we arrive at 1; we check the next element and see it is 10 + so we are larger than the current element and smaller than the next + we are in the correct location to insert and we go to insert... + + in the meantime, someone else with the value 3 comes along + he too finds this is the correct location and inserts before we do + the list is now { 1, 3, 10 } and we are trying to insert now after + 1 and before 3! + + our insert CAS fails, because the next pointer of 1 has changed aready; + but we see we are in the wrong location - we need to move forward an + element + */ + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : we need to begin with the leading dummy element + as the element to be inserted + may be smaller than all elements in the list + */ + + laose_trailing = laoss->start; + laose_temp = laoss->start->next; + + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + if( laose_temp == NULL ) + compare_result = -1; + + if( laose_temp != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + compare_result = laoss->key_compare_function( laose->key, laose_temp->key ); + } + + if( compare_result == 0 ) + { + if( existing_laose != NULL ) + *existing_laose = laose_temp; + + switch( laoss->existing_key ) + { + case LFDS700_LIST_AOS_EXISTING_KEY_OVERWRITE: + LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( *laose_temp, laose->value ); + return( LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS_OVERWRITE ); + break; + + case LFDS700_LIST_AOS_EXISTING_KEY_FAIL: + return( LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY ); + break; + } + + finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( compare_result < 0 ) + { + laose->next = laose_temp; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &laose_trailing->next, &laose->next, laose, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result == 1 ) + finished_flag = LFDS700_MISC_FLAG_RAISED; + else + // TRD : if we fail to link, someone else has linked and so we need to redetermine our position is correct + laose_temp = laose_trailing->next; + } + + if( compare_result > 0 ) + { + // TRD : move trailing along by one element + laose_trailing = laose_trailing->next; + + /* TRD : set temp as the element after trailing + if the new element we're linking is larger than all elements in the list, + laose_temp will now go to NULL and we'll link at the end + */ + laose_temp = laose_trailing->next; + } + } + + return( LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c new file mode 100644 index 0000000000..a1d990ab79 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c @@ -0,0 +1,121 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + +/***** private prototypes *****/ +static void lfds700_list_aos_internal_validate( struct lfds700_list_aos_state *laoss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_aos_validity ); + + + + + +/****************************************************************************/ +void lfds700_list_aos_query( struct lfds700_list_aos_state *laoss, enum lfds700_list_aos_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( laoss != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + { + struct lfds700_list_aos_element + *laose = NULL; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + while( LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(*laoss, laose) ) + ( *(lfds700_pal_uint_t *) query_output )++; + } + break; + + case LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_list_aos_internal_validate( laoss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + + +/****************************************************************************/ +static void lfds700_list_aos_internal_validate( struct lfds700_list_aos_state *laoss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_aos_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_list_aos_element + *laose_fast, + *laose_slow; + + LFDS700_PAL_ASSERT( laoss!= NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_list_aos_validity != NULL ); + + *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_VALID; + + laose_slow = laose_fast = laoss->start->next; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the start of the list + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the queue) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( laose_slow != NULL ) + do + { + laose_slow = laose_slow->next; + + if( laose_fast != NULL ) + laose_fast = laose_fast->next; + + if( laose_fast != NULL ) + laose_fast = laose_fast->next; + } + while( laose_slow != NULL and laose_fast != laose_slow ); + + if( laose_fast != NULL and laose_slow != NULL and laose_fast == laose_slow ) + *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_list_aos_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_list_aos_query( laoss, LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c new file mode 100644 index 0000000000..ef19ce1f86 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c @@ -0,0 +1,37 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_asu_cleanup( struct lfds700_list_asu_state *lasus, + void (*element_cleanup_callback)(struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue) ) +{ + struct lfds700_list_asu_element + *lasue, + *temp; + + LFDS700_PAL_ASSERT( lasus != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback == NULL ) + return; + + lasue = LFDS700_LIST_ASU_GET_START( *lasus ); + + while( lasue != NULL ) + { + temp = lasue; + + lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); + + element_cleanup_callback( lasus, temp ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c new file mode 100644 index 0000000000..ae99ebfca4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c @@ -0,0 +1,29 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + + + + + +/****************************************************************************/ +int lfds700_list_asu_get_by_key( struct lfds700_list_asu_state *lasus, + void *key, + struct lfds700_list_asu_element **lasue ) +{ + int + cr = !0, + rv = 1; + + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( key != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + + while( cr != 0 and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*lasus, *lasue) ) + cr = lasus->key_compare_function( key, (*lasue)->key ); + + if( *lasue == NULL ) + rv = 0; + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c new file mode 100644 index 0000000000..78b0d8eae6 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c @@ -0,0 +1,35 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_asu_init_valid_on_current_logical_core( struct lfds700_list_asu_state *lasus, + int (*key_compare_function)(void const *new_key, void const *existing_key), + void *user_state ) +{ + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->end % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->start % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->dummy_element % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : key_compare_function can be NULL + // TRD : user_state can be NULL + + // TRD : dummy start element - makes code easier when you can always use ->next + lasus->start = lasus->end = &lasus->dummy_element; + + lasus->start->next = NULL; + lasus->start->value = NULL; + lasus->key_compare_function = key_compare_function; + lasus->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c new file mode 100644 index 0000000000..ce2ee825aa --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c @@ -0,0 +1,193 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_asu_insert_at_position( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_list_asu_element *lasue_predecessor, + enum lfds700_list_asu_position position, + struct lfds700_misc_prng_state *ps ) +{ + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : lasue_predecessor asserted in the switch + // TRD : position can be any value in its range + LFDS700_PAL_ASSERT( ps != NULL ); + + switch( position ) + { + case LFDS700_LIST_ASU_POSITION_START: + lfds700_list_asu_insert_at_start( lasus, lasue, ps ); + break; + + case LFDS700_LIST_ASU_POSITION_END: + lfds700_list_asu_insert_at_end( lasus, lasue, ps ); + break; + + case LFDS700_LIST_ASU_POSITION_AFTER: + lfds700_list_asu_insert_after_element( lasus, lasue, lasue_predecessor, ps ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +void lfds700_list_asu_insert_at_start( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + lasue->next = lasus->start->next; + + do + { + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasus->start->next, &lasue->next, lasue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + while( result != 1 ); + + return; +} + + + + + +/****************************************************************************/ +void lfds700_list_asu_insert_at_end( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_SINGLE_POINTER) + *compare; + + struct lfds700_list_asu_element + *volatile lasue_next, + *volatile lasue_end; + + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( ps != NULL ); + + /* TRD : begin by assuming end is correctly pointing to the final element + try to link (comparing for next being NULL) + if we fail, move down list till we find last element + and retry + when successful, update end to ourselves + + note there's a leading dummy element + so lasus->end always points to an element + */ + + LFDS700_MISC_BARRIER_LOAD; + + lasue->next = NULL; + lasue_end = lasus->end; + + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + compare = NULL; + + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasue_end->next, &compare, lasue, LFDS700_MISC_CAS_STRENGTH_STRONG, result, backoff_iteration, ps ); + + if( result == 1 ) + finished_flag = LFDS700_MISC_FLAG_RAISED; + else + { + lasue_end = compare; + lasue_next = LFDS700_LIST_ASU_GET_NEXT( *lasue_end ); + + while( lasue_next != NULL ) + { + lasue_end = lasue_next; + lasue_next = LFDS700_LIST_ASU_GET_NEXT( *lasue_end ); + } + } + } + + lasus->end = lasue; + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +void lfds700_list_asu_insert_after_element( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_list_asu_element *lasue_predecessor, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( lasue_predecessor != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + lasue->next = lasue_predecessor->next; + + do + { + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasue_predecessor->next, &lasue->next, lasue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + while( result != 1 ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c new file mode 100644 index 0000000000..0adf5a8032 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c @@ -0,0 +1,121 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + +/***** private prototypes *****/ +static void lfds700_list_asu_internal_validate( struct lfds700_list_asu_state *lasus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_asu_validity ); + + + + + +/****************************************************************************/ +void lfds700_list_asu_query( struct lfds700_list_asu_state *lasus, enum lfds700_list_asu_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( lasus != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + { + struct lfds700_list_asu_element + *lasue = NULL; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*lasus, lasue) ) + ( *(lfds700_pal_uint_t *) query_output )++; + } + break; + + case LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_list_asu_internal_validate( lasus, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + + +/****************************************************************************/ +static void lfds700_list_asu_internal_validate( struct lfds700_list_asu_state *lasus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_asu_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_list_asu_element + *lasue_fast, + *lasue_slow; + + LFDS700_PAL_ASSERT( lasus!= NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_list_asu_validity != NULL ); + + *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_VALID; + + lasue_slow = lasue_fast = lasus->start->next; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the start of the list + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the queue) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( lasue_slow != NULL ) + do + { + lasue_slow = lasue_slow->next; + + if( lasue_fast != NULL ) + lasue_fast = lasue_fast->next; + + if( lasue_fast != NULL ) + lasue_fast = lasue_fast->next; + } + while( lasue_slow != NULL and lasue_fast != lasue_slow ); + + if( lasue_fast != NULL and lasue_slow != NULL and lasue_fast == lasue_slow ) + *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_list_asu_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_list_asu_query( lasus, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c new file mode 100644 index 0000000000..d93c95db0f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c @@ -0,0 +1,15 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + + + + + +/****************************************************************************/ +void lfds700_misc_library_cleanup( void ) +{ + // TRD : we do nuuuuuuthin' + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c new file mode 100644 index 0000000000..af2826675a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c @@ -0,0 +1,11 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + + + + + +/****************************************************************************/ +struct lfds700_misc_globals + lfds700_misc_globals; + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c new file mode 100644 index 0000000000..32685077bf --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c @@ -0,0 +1,53 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + + + + + +/****************************************************************************/ +void lfds700_misc_library_init_valid_on_current_logical_core() +{ + /* TRD : the PRNG arrangement is that each thread has its own state, for a maximum-speed PRNG, where output + quality is second consideration to performance + + on 64-bit platforms this is xorshift64*, on 32-bit platforms, an unadorned xorshift32 + + the seed for each thread however comes from a single, global, maximum-quality PRNG, where quality of + output is the primary consideration + + for this, I'm using a xorshift1024* + + since the generation from this global PRNG state is not thread safe, but is still quick in + thread start-up terms, I run a little spin-lock around it + + regarding the seed for this high quality PRNG; it is customary to use time(), but this has a number of + drawbacks; + + 1. liblfds would depend on time() (currently it does not depend on a hosted implementation of standard library) + 2. the output from time may only be 32 bit, and even when it isn't, the top 32 bits are currently all zero... + 3. many threads can begin in the same second; I'd need to add in their thread number, + which means I'd need to *get* their thread number... + + as such, I've decided to use a *fixed* 64-bit seed for the high-quality PRNG; this seed is run + through the MurmerHash3 avalanche phase to generate successive 64-bit values, which populate + the 1024 state of xorshift1024* + + if you have access to a high-frequency clock (often 64-bit), you can use this for the seed + (don't use it for the per-thread PRNG, unless you know the clock can be read without a context switch) + + murmurhash3 code from here; http://xorshift.di.unimi.it/murmurhash3.c + */ + + lfds700_misc_prng_internal_big_slow_high_quality_init( LFDS700_MISC_PRNG_SEED ); + + lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas = EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_CAS; + lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas = EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_DWCAS; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h new file mode 100644 index 0000000000..9ed927efc9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h @@ -0,0 +1,10 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** defines *****/ +#define EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_CAS 8 +#define EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_DWCAS 16 + +/***** private prototypes *****/ +void lfds700_misc_prng_internal_big_slow_high_quality_init( int long long unsigned seed ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c new file mode 100644 index 0000000000..84ae25fe71 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c @@ -0,0 +1,144 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + +/***** defines *****/ +#define LFDS700_PRNG_STATE_SIZE 16 + +/***** struct *****/ +struct lfds700_misc_prng_big_slow_high_quality_state +{ + lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + xorshift1024star_spinlock; + + // TRD : must be a 32 bit signed int + int + xorshift1024star_index; + + int long long unsigned + xorshift1024star_state[LFDS700_PRNG_STATE_SIZE]; +}; + +/***** locals *****/ +struct lfds700_misc_prng_big_slow_high_quality_state + pbshqs; + +/***** private prototypes *****/ +static void lfds700_misc_prng_internal_hash_murmurhash3( int long long unsigned *murmurhash3_state ); +static void lfds700_misc_prng_internal_big_slow_high_quality_generate( struct lfds700_misc_prng_big_slow_high_quality_state *ps, lfds700_pal_uint_t *random_value ); + + + + + +/****************************************************************************/ +void lfds700_misc_prng_init( struct lfds700_misc_prng_state *ps ) +{ + LFDS700_PAL_ASSERT( ps != NULL ); + + /* TRD : we use the big, slow, high quality PRNG to generate the initial value + for the small, fast, low qulity PRNG, which is used in exponential backoff + + we need the load barrier to catch any changes to the backoff periods + */ + + lfds700_misc_prng_internal_big_slow_high_quality_generate( &pbshqs, &ps->prng_state ); + + LFDS700_MISC_BARRIER_LOAD; + + ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas; + ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; + + return; +} + + + + + +/****************************************************************************/ +void lfds700_misc_prng_internal_big_slow_high_quality_init( int long long unsigned seed ) +{ + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( seed != 0 ); // TRD : a 0 seed causes all zeros in the entropy state, so is forbidden + + pbshqs.xorshift1024star_spinlock = LFDS700_MISC_FLAG_LOWERED; + + for( loop = 0 ; loop < LFDS700_PRNG_STATE_SIZE ; loop++ ) + { + lfds700_misc_prng_internal_hash_murmurhash3( &seed ); + pbshqs.xorshift1024star_state[loop] = seed; + } + + pbshqs.xorshift1024star_index = 0; + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_misc_prng_internal_hash_murmurhash3( int long long unsigned *murmurhash3_state ) +{ + LFDS700_PAL_ASSERT( murmurhash3_state != NULL ); + + *murmurhash3_state ^= *murmurhash3_state >> 33; + *murmurhash3_state *= 0xff51afd7ed558ccdULL; + *murmurhash3_state ^= *murmurhash3_state >> 33; + *murmurhash3_state *= 0xc4ceb9fe1a85ec53ULL; + *murmurhash3_state ^= *murmurhash3_state >> 33; + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_misc_prng_internal_big_slow_high_quality_generate( struct lfds700_misc_prng_big_slow_high_quality_state *ps, lfds700_pal_uint_t *random_value ) +{ + char unsigned + result; + + int long long unsigned + xs_temp_one, + xs_temp_two; + + lfds700_pal_atom_t + compare = LFDS700_MISC_FLAG_LOWERED, + exchange = LFDS700_MISC_FLAG_LOWERED; + + LFDS700_PAL_ASSERT( ps != NULL ); + LFDS700_PAL_ASSERT( random_value != NULL ); + + // TRD : this is single-threaded code, on a per-state basis + do + { + compare = LFDS700_MISC_FLAG_LOWERED; + LFDS700_PAL_ATOMIC_CAS( &ps->xorshift1024star_spinlock, &compare, (lfds700_pal_atom_t) LFDS700_MISC_FLAG_RAISED, LFDS700_MISC_CAS_STRENGTH_STRONG, result ); + } + while( result == 0 ); + + // TRD : xorshift1024* code from here; http://xorshift.di.unimi.it/xorshift1024star.c + + xs_temp_one = ps->xorshift1024star_state[ ps->xorshift1024star_index ]; + ps->xorshift1024star_index = ( ps->xorshift1024star_index + 1 ) & 15; + xs_temp_two = ps->xorshift1024star_state[ ps->xorshift1024star_index ]; + + xs_temp_two ^= xs_temp_two << 31; + xs_temp_two ^= xs_temp_two >> 11; + xs_temp_one ^= xs_temp_one >> 30; + + ps->xorshift1024star_state[ ps->xorshift1024star_index ] = xs_temp_one ^ xs_temp_two; + + *random_value = (lfds700_pal_uint_t) ( ps->xorshift1024star_state[ ps->xorshift1024star_index ] * 1181783497276652981LL ); + + LFDS700_PAL_ATOMIC_EXCHANGE( &ps->xorshift1024star_spinlock, &exchange ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c new file mode 100644 index 0000000000..fd3595d86a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c @@ -0,0 +1,48 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + + + + + +/****************************************************************************/ +void lfds700_misc_query( enum lfds700_misc_query query_type, void *query_input, void *query_output ) +{ + // TRD : query type can be any value in its range + // TRD : query_input can be NULL in some cases + // TRD : query_outputput can be NULL in some cases + + switch( query_type ) + { + case LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS: + *(lfds700_pal_atom_t *) query_output = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas; + break; + + case LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS: + LFDS700_PAL_ATOMIC_EXCHANGE( &lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas, (lfds700_pal_atom_t *) query_input ); + break; + + case LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS: + *(lfds700_pal_atom_t *) query_output = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; + break; + + case LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS: + LFDS700_PAL_ATOMIC_EXCHANGE( &lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas, (lfds700_pal_atom_t *) query_input ); + break; + + case LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING: + { + char static const + * const build_and_version_string = "liblfds " LFDS700_MISC_VERSION_STRING " (" BUILD_TYPE_STRING ", " LFDS700_PAL_OS_STRING ", " MODE_TYPE_STRING ", " LFDS700_PAL_PROCESSOR_STRING ", " LFDS700_PAL_COMPILER_STRING ")"; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(char const **) query_output = build_and_version_string; + } + break; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c new file mode 100644 index 0000000000..f2da905dbe --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c @@ -0,0 +1,48 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_cleanup( struct lfds700_queue_state *qs, + void (*element_cleanup_callback)(struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag) ) +{ + struct lfds700_queue_element + *qe; + + void + *value; + + LFDS700_PAL_ASSERT( qs != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback != NULL ) + { + while( qs->dequeue[POINTER] != qs->enqueue[POINTER] ) + { + // TRD : trailing dummy element, so the first real value is in the next element + value = qs->dequeue[POINTER]->next[POINTER]->value; + + // TRD : user is given back *an* element, but not the one his user data was in + qe = qs->dequeue[POINTER]; + + // TRD : remove the element from queue + qs->dequeue[POINTER] = qs->dequeue[POINTER]->next[POINTER]; + + // TRD : write value into the qe we're going to give the user + qe->value = value; + + element_cleanup_callback( qs, qe, LFDS700_MISC_FLAG_LOWERED ); + } + + // TRD : and now the final element + element_cleanup_callback( qs, (struct lfds700_queue_element *) qs->dequeue[POINTER], LFDS700_MISC_FLAG_RAISED ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c new file mode 100644 index 0000000000..853c585039 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c @@ -0,0 +1,109 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + + + + + +/****************************************************************************/ +int lfds700_queue_dequeue( struct lfds700_queue_state *qs, + struct lfds700_queue_element **qe, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result = 0, + unwanted_result; + + enum lfds700_queue_queue_state + state = LFDS700_QUEUE_QUEUE_STATE_UNKNOWN; + + int + rv = 1, + finished_flag = LFDS700_MISC_FLAG_LOWERED; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *dequeue[PAC_SIZE], + *enqueue[PAC_SIZE], + *next[PAC_SIZE]; + + void + *key = NULL, + *value = NULL; + + LFDS700_PAL_ASSERT( qs != NULL ); + LFDS700_PAL_ASSERT( qe != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + do + { + dequeue[COUNTER] = qs->dequeue[COUNTER]; + dequeue[POINTER] = qs->dequeue[POINTER]; + + enqueue[COUNTER] = qs->enqueue[COUNTER]; + enqueue[POINTER] = qs->enqueue[POINTER]; + + next[COUNTER] = qs->dequeue[POINTER]->next[COUNTER]; + next[POINTER] = qs->dequeue[POINTER]->next[POINTER]; + + LFDS700_MISC_BARRIER_LOAD; + + if( dequeue[COUNTER] == qs->dequeue[COUNTER] and dequeue[POINTER] == qs->dequeue[POINTER] ) + { + if( enqueue[POINTER] == dequeue[POINTER] and next[POINTER] == NULL ) + state = LFDS700_QUEUE_QUEUE_STATE_EMPTY; + + if( enqueue[POINTER] == dequeue[POINTER] and next[POINTER] != NULL ) + state = LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE; + + if( enqueue[POINTER] != dequeue[POINTER] ) + state = LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE; + + switch( state ) + { + case LFDS700_QUEUE_QUEUE_STATE_UNKNOWN: + // TRD : eliminates compiler warning + break; + + case LFDS700_QUEUE_QUEUE_STATE_EMPTY: + rv = 0; + *qe = NULL; + finished_flag = LFDS700_MISC_FLAG_RAISED; + break; + + case LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE: + next[COUNTER] = enqueue[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, next, LFDS700_MISC_CAS_STRENGTH_WEAK, unwanted_result ); + break; + + case LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE: + key = next[POINTER]->key; + value = next[POINTER]->value; + + next[COUNTER] = dequeue[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( qs->dequeue, dequeue, next, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result == 1 ) + finished_flag = LFDS700_MISC_FLAG_RAISED; + break; + } + } + } + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ); + + if( result == 1 ) + { + *qe = dequeue[POINTER]; + (*qe)->key = key; + (*qe)->value = value; + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c new file mode 100644 index 0000000000..07df84d851 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c @@ -0,0 +1,74 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_enqueue( struct lfds700_queue_state *qs, + struct lfds700_queue_element *qe, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result = 0, + unwanted_result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *volatile enqueue[PAC_SIZE], + *new_enqueue[PAC_SIZE], + *volatile next[PAC_SIZE]; + + LFDS700_PAL_ASSERT( qs != NULL ); + LFDS700_PAL_ASSERT( qe != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) qe->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qe->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( ps != NULL ); + + qe->next[COUNTER] = (struct lfds700_queue_element *) LFDS700_MISC_PRNG_GENERATE( ps ); + qe->next[POINTER] = NULL; + + new_enqueue[POINTER] = qe; + + LFDS700_MISC_BARRIER_LOAD; + + do + { + enqueue[COUNTER] = qs->enqueue[COUNTER]; + enqueue[POINTER] = qs->enqueue[POINTER]; + + next[COUNTER] = qs->enqueue[POINTER]->next[COUNTER]; + next[POINTER] = qs->enqueue[POINTER]->next[POINTER]; + + LFDS700_MISC_BARRIER_LOAD; + + if( qs->enqueue[COUNTER] == enqueue[COUNTER] and qs->enqueue[POINTER] == enqueue[POINTER] ) + { + if( next[POINTER] == NULL ) + { + new_enqueue[COUNTER] = next[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( enqueue[POINTER]->next, next, new_enqueue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + else + { + next[COUNTER] = enqueue[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + // TRD : strictly, this is a weak CAS, but we do an extra iteration of the main loop on a fake failure, so we set it to be strong + LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, next, LFDS700_MISC_CAS_STRENGTH_STRONG, unwanted_result ); + } + } + } + while( result != 1 ); + + new_enqueue[COUNTER] = enqueue[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + // TRD : move enqueue along; only a weak CAS as the dequeue will solve this if its out of place + LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, new_enqueue, LFDS700_MISC_CAS_STRENGTH_WEAK, unwanted_result ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c new file mode 100644 index 0000000000..15f4e64d8d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c @@ -0,0 +1,43 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_init_valid_on_current_logical_core( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe_dummy, struct lfds700_misc_prng_state *ps, void *user_state ) +{ + LFDS700_PAL_ASSERT( qs != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->enqueue % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->dequeue % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( qe_dummy != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) qe_dummy->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qe_dummy->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( ps != NULL ); + // TRD : user_state can be UNLL + + /* TRD : qe_dummy is a dummy element, needed for init + the qs->enqueue and qs->dequeue counters do not need to be initialized + but it does no harm to do so, and stops a valgrind complaint + */ + + qs->enqueue[POINTER] = qe_dummy; + qs->enqueue[COUNTER] = (struct lfds700_queue_element *) 0; + qs->dequeue[POINTER] = qe_dummy; + qs->dequeue[COUNTER] = (struct lfds700_queue_element *) 0; + + qe_dummy->next[POINTER] = NULL; + qe_dummy->next[COUNTER] = (struct lfds700_queue_element *) LFDS700_MISC_PRNG_GENERATE( ps ); + qe_dummy->value = NULL; + + qs->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h new file mode 100644 index 0000000000..81c9b69f48 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h @@ -0,0 +1,14 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** enums *****/ +enum lfds700_queue_queue_state +{ + LFDS700_QUEUE_QUEUE_STATE_UNKNOWN, + LFDS700_QUEUE_QUEUE_STATE_EMPTY, + LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE, + LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE +}; + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c new file mode 100644 index 0000000000..15b4307ff2 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c @@ -0,0 +1,126 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + +/***** private prototypes *****/ +static void lfds700_queue_internal_validate( struct lfds700_queue_state *qs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity ); + + + + + +/****************************************************************************/ +void lfds700_queue_query( struct lfds700_queue_state *qs, enum lfds700_queue_query query_type, void *query_input, void *query_output ) +{ + struct lfds700_queue_element + *qe; + + LFDS700_MISC_BARRIER_LOAD; + + LFDS700_PAL_ASSERT( qs != NULL ); + // TRD : query_type can be any value in its range + + switch( query_type ) + { + case LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + qe = (struct lfds700_queue_element *) qs->dequeue[POINTER]; + + while( qe != NULL ) + { + ( *(lfds700_pal_uint_t *) query_output )++; + qe = (struct lfds700_queue_element *) qe->next[POINTER]; + } + + // TRD : remember there is a dummy element in the queue + ( *(lfds700_pal_uint_t *) query_output )--; + break; + + case LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_queue_internal_validate( qs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_queue_internal_validate( struct lfds700_queue_state *qs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_queue_element + *qe_fast, + *qe_slow; + + LFDS700_PAL_ASSERT( qs != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_queue_validity != NULL ); + + *lfds700_queue_validity = LFDS700_MISC_VALIDITY_VALID; + + qe_slow = qe_fast = (struct lfds700_queue_element *) qs->dequeue[POINTER]; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the dequeue end of the queue + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the queue) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( qe_slow != NULL ) + do + { + qe_slow = qe_slow->next[POINTER]; + + if( qe_fast != NULL ) + qe_fast = qe_fast->next[POINTER]; + + if( qe_fast != NULL ) + qe_fast = qe_fast->next[POINTER]; + } + while( qe_slow != NULL and qe_fast != qe_slow ); + + if( qe_fast != NULL and qe_slow != NULL and qe_fast == qe_slow ) + *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_queue_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_queue_query( qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c new file mode 100644 index 0000000000..2b157bd973 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c @@ -0,0 +1,30 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_bss_cleanup( struct lfds700_queue_bss_state *qbsss, + void (*element_cleanup_callback)(struct lfds700_queue_bss_state *qbsss, void *key, void *value) ) +{ + int long long unsigned + loop; + + struct lfds700_queue_bss_element + *qbsse; + + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : element_cleanup_callback can be NULL + + if( element_cleanup_callback != NULL ) + for( loop = qbsss->read_index ; loop < qbsss->read_index + qbsss->number_elements ; loop++ ) + { + qbsse = qbsss->element_array + (loop % qbsss->number_elements); + element_cleanup_callback( qbsss, qbsse->key, qbsse->value ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c new file mode 100644 index 0000000000..28f735f610 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c @@ -0,0 +1,42 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + + + + + +/****************************************************************************/ +int lfds700_queue_bss_dequeue( struct lfds700_queue_bss_state *qbsss, void **key, void **value ) +{ + int + rv = 0; + + struct lfds700_queue_bss_element + *qbsse; + + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : key can be NULL + // TRD : value can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( qbsss->read_index != qbsss->write_index ) + { + qbsse = qbsss->element_array + qbsss->read_index; + + if( key != NULL ) + *key = qbsse->key; + + if( value != NULL ) + *value = qbsse->value; + + qbsss->read_index = (qbsss->read_index + 1) & qbsss->mask; + + LFDS700_MISC_BARRIER_STORE; + + rv = 1; + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c new file mode 100644 index 0000000000..c74091a23e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c @@ -0,0 +1,39 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + + + + + +/****************************************************************************/ +int lfds700_queue_bss_enqueue( struct lfds700_queue_bss_state *qbsss, void *key, void *value ) +{ + int + rv = 0; + + struct lfds700_queue_bss_element + *qbsse; + + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : key can be NULL + // TRD : value can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( ( (qbsss->write_index+1) & qbsss->mask ) != qbsss->read_index ) + { + qbsse = qbsss->element_array + qbsss->write_index; + + qbsse->key = key; + qbsse->value = value; + + LFDS700_MISC_BARRIER_STORE; + + qbsss->write_index = (qbsss->write_index + 1) & qbsss->mask; + + rv = 1; + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c new file mode 100644 index 0000000000..9127fef443 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c @@ -0,0 +1,63 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_bss_init_valid_on_current_logical_core( struct lfds700_queue_bss_state *qbsss, + struct lfds700_queue_bss_element *element_array, + lfds700_pal_uint_t number_elements, + void *user_state ) +{ + LFDS700_PAL_ASSERT( qbsss != NULL ); + LFDS700_PAL_ASSERT( element_array != NULL ); + LFDS700_PAL_ASSERT( number_elements >= 2 ); + LFDS700_PAL_ASSERT( ( number_elements & (number_elements-1) ) == 0 ); // TRD : number_elements must be a positive integer power of 2 + // TRD : user_state can be NULL + + /* TRD : the use of mask and the restriction on a power of two + upon the number of elements bears some remark + + in this queue, there are a fixed number of elements + we have a read index and a write index + when we write, and thre is space to write, we increment the write index + (if no space to write, we just return) + when we read, and there are elements to be read, we after reading increment the read index + (if no elements to read, we just return) + the problem is - how do we handle wrap around? + e.g. when I write, but my write index is now equal to the number of elements + the usual solution is to modulus the write index by the nunmber of elements + problem is modulus is slow + there is a better way + first, we restrict the number of elements to be a power of two + so imagine we have a 64-bit system and we set the number of elements to be 2^64 + this gives us a bit pattern of 1000 0000 0000 0000 (...etc, lots of zeros) + now (just roll with this for a bit) subtract one from this + this gives us a mask (on a two's compliment machine) + 0111 1111 1111 1111 (...etc, lots of ones) + so what we do now, when we increment an index (think of the write index as the example) + we bitwise and it with the mask + now think about thwt happens + all the numbers up to 2^64 will be unchanged - their MSB is never set, and we and with all the other bits + but when we finally hit 2^64 and need to roll over... bingo! + we drop MSB (which we finally have) and have the value 0! + this is exactly what we want + bitwise and is much faster than modulus + */ + + qbsss->number_elements = number_elements; + qbsss->mask = qbsss->number_elements - 1; + qbsss->read_index = 0; + qbsss->write_index = 0; + qbsss->element_array = element_array; + qbsss->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c new file mode 100644 index 0000000000..aabcae23f3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c @@ -0,0 +1,70 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + +/***** private prototypes *****/ +static void lfds700_queue_bss_internal_validate( struct lfds700_queue_bss_state *qbsss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_validity ); + + + + + +/****************************************************************************/ +void lfds700_queue_bss_query( struct lfds700_queue_bss_state *qbsss, enum lfds700_queue_bss_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : query_type can be any value in its range + + switch( query_type ) + { + case LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + *(lfds700_pal_uint_t *) query_output = +( qbsss->write_index - qbsss->read_index ); + if( qbsss->read_index > qbsss->write_index ) + *(lfds700_pal_uint_t *) query_output = qbsss->number_elements - *(lfds700_pal_uint_t *) query_output; + break; + + case LFDS700_QUEUE_BSS_QUERY_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_queue_bss_internal_validate( qbsss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_queue_bss_internal_validate( struct lfds700_queue_bss_state *qbsss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_validity ) +{ + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_validity != NULL ); + + *lfds700_validity = LFDS700_MISC_VALIDITY_VALID; + + if( vi != NULL ) + { + lfds700_pal_uint_t + number_elements; + + lfds700_queue_bss_query( qbsss, LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c new file mode 100644 index 0000000000..447c93041e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c @@ -0,0 +1,86 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + +/***** private prototypes *****/ +static void lfds700_ringbuffer_internal_queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); +static void lfds700_ringbuffer_internal_freelist_element_cleanup_callback( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe ); + + + + + +/****************************************************************************/ +void lfds700_ringbuffer_cleanup( struct lfds700_ringbuffer_state *rs, + void (*element_cleanup_callback)(struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag) ) +{ + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : element_cleanup_callback can be NULL + + if( element_cleanup_callback != NULL ) + { + rs->element_cleanup_callback = element_cleanup_callback; + lfds700_queue_cleanup( &rs->qs, lfds700_ringbuffer_internal_queue_element_cleanup_callback ); + lfds700_freelist_cleanup( &rs->fs, lfds700_ringbuffer_internal_freelist_element_cleanup_callback ); + } + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void lfds700_ringbuffer_internal_queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) +{ + struct lfds700_ringbuffer_element + *re; + + struct lfds700_ringbuffer_state + *rs; + + LFDS700_PAL_ASSERT( qs != NULL ); + LFDS700_PAL_ASSERT( qe != NULL ); + // TRD : dummy_element can be any value in its range + + rs = (struct lfds700_ringbuffer_state *) LFDS700_QUEUE_GET_USER_STATE_FROM_STATE( *qs ); + re = (struct lfds700_ringbuffer_element *) LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( dummy_element_flag == LFDS700_MISC_FLAG_LOWERED ) + rs->element_cleanup_callback( rs, re->key, re->value, LFDS700_MISC_FLAG_RAISED ); + + return; +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void lfds700_ringbuffer_internal_freelist_element_cleanup_callback( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe ) +{ + struct lfds700_ringbuffer_element + *re; + + struct lfds700_ringbuffer_state + *rs; + + LFDS700_PAL_ASSERT( fs != NULL ); + LFDS700_PAL_ASSERT( fe != NULL ); + + rs = (struct lfds700_ringbuffer_state *) LFDS700_FREELIST_GET_USER_STATE_FROM_STATE( *fs ); + re = (struct lfds700_ringbuffer_element *) LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + + rs->element_cleanup_callback( rs, re->key, re->value, LFDS700_MISC_FLAG_LOWERED ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c new file mode 100644 index 0000000000..a6cd1e3616 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c @@ -0,0 +1,51 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + + + + + +/****************************************************************************/ +void lfds700_ringbuffer_init_valid_on_current_logical_core( struct lfds700_ringbuffer_state *rs, + struct lfds700_ringbuffer_element *re_array_inc_dummy, + lfds700_pal_uint_t number_elements, + struct lfds700_misc_prng_state *ps, + void *user_state ) +{ + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( rs != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &rs->fs % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &rs->qs % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( re_array_inc_dummy != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[0].fe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[0].qe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( number_elements >= 2 ); + LFDS700_PAL_ASSERT( ps != NULL ); + // TRD : user_state can be NULL + + rs->user_state = user_state; + + re_array_inc_dummy[0].qe_use = &re_array_inc_dummy[0].qe; + + lfds700_freelist_init_valid_on_current_logical_core( &rs->fs, rs ); + lfds700_queue_init_valid_on_current_logical_core( &rs->qs, &re_array_inc_dummy[0].qe, ps, rs ); + + for( loop = 1 ; loop < number_elements ; loop++ ) + { + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[loop].fe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[loop].qe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + + re_array_inc_dummy[loop].qe_use = &re_array_inc_dummy[loop].qe; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( re_array_inc_dummy[loop].fe, &re_array_inc_dummy[loop] ); + lfds700_freelist_push( &rs->fs, &re_array_inc_dummy[loop].fe, ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c new file mode 100644 index 0000000000..58b7b3a9cb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c @@ -0,0 +1,72 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + +/***** private prototypes *****/ +static void lfds700_ringbuffer_internal_validate( struct lfds700_ringbuffer_state *rs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity, enum lfds700_misc_validity *lfds700_freelist_validity ); + + + +/****************************************************************************/ +void lfds700_ringbuffer_query( struct lfds700_ringbuffer_state *rs, enum lfds700_ringbuffer_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, NULL, query_output ); + break; + + case LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_ringbuffer_internal_validate( rs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output, ((enum lfds700_misc_validity *) query_output)+1 ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_ringbuffer_internal_validate( struct lfds700_ringbuffer_state *rs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity, enum lfds700_misc_validity *lfds700_freelist_validity ) +{ + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_queue_validity != NULL ); + LFDS700_PAL_ASSERT( lfds700_freelist_validity != NULL ); + + if( vi == NULL ) + { + lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, NULL, lfds700_queue_validity ); + lfds700_freelist_query( &rs->fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, NULL, lfds700_freelist_validity ); + } + + if( vi != NULL ) + { + struct lfds700_misc_validation_info + freelist_vi, + queue_vi; + + queue_vi.min_elements = 0; + freelist_vi.min_elements = 0; + queue_vi.max_elements = vi->max_elements; + freelist_vi.max_elements = vi->max_elements; + + lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &queue_vi, lfds700_queue_validity ); + lfds700_freelist_query( &rs->fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, &freelist_vi, lfds700_freelist_validity ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c new file mode 100644 index 0000000000..42dbe189e2 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c @@ -0,0 +1,44 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + + + + + +/****************************************************************************/ +int lfds700_ringbuffer_read( struct lfds700_ringbuffer_state *rs, + void **key, + void **value, + struct lfds700_misc_prng_state *ps ) +{ + int + rv; + + struct lfds700_queue_element + *qe; + + struct lfds700_ringbuffer_element + *re; + + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : key can be NULL + // TRD : value can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + rv = lfds700_queue_dequeue( &rs->qs, &qe, ps ); + + if( rv == 1 ) + { + re = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + re->qe_use = (struct lfds700_queue_element *) qe; + if( key != NULL ) + *key = re->key; + if( value != NULL ) + *value = re->value; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( re->fe, re ); + lfds700_freelist_push( &rs->fs, &re->fe, ps ); + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c new file mode 100644 index 0000000000..a16a8686c1 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c @@ -0,0 +1,78 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + + + + + +/****************************************************************************/ +void lfds700_ringbuffer_write( struct lfds700_ringbuffer_state *rs, + void *key, + void *value, + enum lfds700_misc_flag *overwrite_occurred_flag, + void **overwritten_key, + void **overwritten_value, + struct lfds700_misc_prng_state *ps ) +{ + int + rv = 0; + + struct lfds700_freelist_element + *fe; + + struct lfds700_queue_element + *qe; + + struct lfds700_ringbuffer_element + *re = NULL; + + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : key can be NULL + // TRD : value can be NULL + // TRD : overwrite_occurred_flag can be NULL + // TRD : overwritten_key can be NULL + // TRD : overwritten_value can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + if( overwrite_occurred_flag != NULL ) + *overwrite_occurred_flag = LFDS700_MISC_FLAG_LOWERED; + + do + { + rv = lfds700_freelist_pop( &rs->fs, &fe, ps ); + + if( rv == 1 ) + re = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + + if( rv == 0 ) + { + // TRD : the queue can return empty as well - remember, we're lock-free; anything could have happened since the previous instruction + rv = lfds700_queue_dequeue( &rs->qs, &qe, ps ); + + if( rv == 1 ) + { + re = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + re->qe_use = (struct lfds700_queue_element *) qe; + + if( overwrite_occurred_flag != NULL ) + *overwrite_occurred_flag = LFDS700_MISC_FLAG_RAISED; + + if( overwritten_key != NULL ) + *overwritten_key = re->key; + + if( overwritten_value != NULL ) + *overwritten_value = re->value; + } + } + } + while( rv == 0 ); + + re->key = key; + re->value = value; + + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *re->qe_use, re ); + lfds700_queue_enqueue( &rs->qs, re->qe_use, ps ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c new file mode 100644 index 0000000000..efcebf3543 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c @@ -0,0 +1,36 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + + + + + +/****************************************************************************/ +void lfds700_stack_cleanup( struct lfds700_stack_state *ss, + void (*element_cleanup_callback)(struct lfds700_stack_state *ss, struct lfds700_stack_element *se) ) +{ + struct lfds700_stack_element + *se, + *se_temp; + + LFDS700_PAL_ASSERT( ss != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback != NULL ) + { + se = ss->top[POINTER]; + + while( se != NULL ) + { + se_temp = se; + se = se->next; + + element_cleanup_callback( ss, se_temp ); + } + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c new file mode 100644 index 0000000000..745017c029 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c @@ -0,0 +1,27 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + + + + + +/****************************************************************************/ +void lfds700_stack_init_valid_on_current_logical_core( struct lfds700_stack_state *ss, void *user_state ) +{ + LFDS700_PAL_ASSERT( ss != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) ss->top % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &ss->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : user_state can be NULL + + ss->top[POINTER] = NULL; + ss->top[COUNTER] = 0; + + ss->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c new file mode 100644 index 0000000000..3cae2e563e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c @@ -0,0 +1,52 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + + + + + +/****************************************************************************/ +int lfds700_stack_pop( struct lfds700_stack_state *ss, struct lfds700_stack_element **se, struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *new_top[PAC_SIZE], + *volatile original_top[PAC_SIZE]; + + LFDS700_PAL_ASSERT( ss != NULL ); + LFDS700_PAL_ASSERT( se != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_PAL_BARRIER_PROCESSOR_LOAD; + + original_top[COUNTER] = ss->top[COUNTER]; + original_top[POINTER] = ss->top[POINTER]; + + do + { + if( original_top[POINTER] == NULL ) + { + *se = NULL; + return( 0 ); + } + + new_top[COUNTER] = original_top[COUNTER] + 1; + new_top[POINTER] = original_top[POINTER]->next; + + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &ss->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result != 1 ) + LFDS700_PAL_BARRIER_PROCESSOR_LOAD; + } + while( result != 1 ); + + *se = original_top[POINTER]; + + return( 1 ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c new file mode 100644 index 0000000000..ff84c5ed55 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c @@ -0,0 +1,42 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + + + + + +/****************************************************************************/ +void lfds700_stack_push( struct lfds700_stack_state *ss, struct lfds700_stack_element *se, struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *new_top[PAC_SIZE], + *volatile original_top[PAC_SIZE]; + + LFDS700_PAL_ASSERT( ss != NULL ); + LFDS700_PAL_ASSERT( se != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + new_top[POINTER] = se; + + original_top[COUNTER] = ss->top[COUNTER]; + original_top[POINTER] = ss->top[POINTER]; + + do + { + new_top[COUNTER] = original_top[COUNTER] + 1; + se->next = original_top[POINTER]; + + LFDS700_PAL_BARRIER_PROCESSOR_STORE; + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &ss->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + while( result != 1 ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c new file mode 100644 index 0000000000..b9abdf9f2d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c @@ -0,0 +1,123 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + +/***** private prototypes *****/ +static void lfds700_stack_internal_stack_validate( struct lfds700_stack_state *ss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_stack_validity ); + + + + + +/****************************************************************************/ +void lfds700_stack_query( struct lfds700_stack_state *ss, enum lfds700_stack_query query_type, void *query_input, void *query_output ) +{ + struct lfds700_stack_element + *se; + + LFDS700_MISC_BARRIER_LOAD; + + LFDS700_PAL_ASSERT( ss != NULL ); + // TRD : query_type can be any value in its range + + switch( query_type ) + { + case LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + se = (struct lfds700_stack_element *) ss->top[POINTER]; + + while( se != NULL ) + { + ( *(lfds700_pal_uint_t *) query_output )++; + se = (struct lfds700_stack_element *) se->next; + } + break; + + case LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_stack_internal_stack_validate( ss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_stack_internal_stack_validate( struct lfds700_stack_state *ss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_stack_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_stack_element + *se_fast, + *se_slow; + + LFDS700_PAL_ASSERT( ss != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_stack_validity != NULL ); + + *lfds700_stack_validity = LFDS700_MISC_VALIDITY_VALID; + + se_slow = se_fast = (struct lfds700_stack_element *) ss->top[POINTER]; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the top of the stack + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the stack) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( se_slow != NULL ) + do + { + se_slow = se_slow->next; + + if( se_fast != NULL ) + se_fast = se_fast->next; + + if( se_fast != NULL ) + se_fast = se_fast->next; + } + while( se_slow != NULL and se_fast != se_slow ); + + if( se_fast != NULL and se_slow != NULL and se_fast == se_slow ) + *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_stack_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_stack_query( ss, LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h new file mode 100644 index 0000000000..fdd8c363eb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h @@ -0,0 +1,93 @@ +/***** public prototypes *****/ +#include "../inc/liblfds700.h" + +/***** defines *****/ +#define and && +#define or || + +#define NO_FLAGS 0x0 + +#define LFDS700_ABSTRACTION_BACKOFF_LIMIT (0x1 << 10) + +#if( defined _KERNEL_MODE ) + #define MODE_TYPE_STRING "kernel-mode" +#endif + +#if( !defined _KERNEL_MODE ) + #define MODE_TYPE_STRING "user-mode" +#endif + +#if( defined NDEBUG && !defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "release" +#endif + +#if( !defined NDEBUG && !defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "debug" +#endif + +#if( !defined NDEBUG && defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "coverage" +#endif + +#if( !defined NDEBUG && !defined COVERAGE && defined TSAN ) + #define BUILD_TYPE_STRING "threadsanitizer" +#endif + +// TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *compare, lfds700_pal_atom_t new_destination, enum lfds700_misc_cas_strength cas_strength, char unsigned result, lfds700_pal_uint_t *backoff_iteration +#define LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result, backoff_iteration, ps ) \ +{ \ + LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ); \ + \ + if( result == 0 ) \ + { \ + lfds700_pal_uint_t \ + endloop; \ + \ + lfds700_pal_uint_t volatile \ + loop; \ + \ + if( (backoff_iteration) == LFDS700_ABSTRACTION_BACKOFF_LIMIT ) \ + (backoff_iteration) = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; \ + \ + if( (backoff_iteration) == LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE ) \ + (backoff_iteration) = 1; \ + else \ + { \ + endloop = ( LFDS700_MISC_PRNG_GENERATE(ps) % (backoff_iteration) ) * ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas; \ + for( loop = 0 ; loop < endloop ; loop++ ); \ + } \ + \ + (backoff_iteration) <<= 1; \ + } \ +} + +// TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, char unsigned result, lfds700_pal_uint_t *backoff_iteration +#define LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result, backoff_iteration, ps ) \ +{ \ + LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ); \ + \ + if( result == 0 ) \ + { \ + lfds700_pal_uint_t \ + endloop; \ + \ + lfds700_pal_uint_t volatile \ + loop; \ + \ + if( (backoff_iteration) == LFDS700_ABSTRACTION_BACKOFF_LIMIT ) \ + (backoff_iteration) = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; \ + \ + if( (backoff_iteration) == LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE ) \ + (backoff_iteration) = 1; \ + else \ + { \ + endloop = ( LFDS700_MISC_PRNG_GENERATE(ps) % (backoff_iteration) ) * ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; \ + for( loop = 0 ; loop < endloop ; loop++ ); \ + } \ + \ + (backoff_iteration) <<= 1; \ + } \ +} + +/***** library-wide prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile new file mode 100644 index 0000000000..489e5b19e5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile @@ -0,0 +1,129 @@ +##### paths ##### +BINDIR := ../../bin +OBJDIR := ../../obj +SRCDIR := ../../src +LIBINCDIRS := ../../../liblfds700/inc/ +LIBBINDIRS := ../../../liblfds700/bin/ + +##### misc ##### +QUIETLY := 1>nul 2>nul + +##### sources, objects and libraries ##### +BINNAME := test +BINARY := $(BINDIR)/$(BINNAME) +SRCDIRS := . +SOURCES := main.c misc.c \ + test_lfds700_btree_addonly_unbalanced.c test_lfds700_btree_addonly_unbalanced_alignment.c test_lfds700_btree_addonly_unbalanced_random_adds_fail.c test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c \ + test_lfds700_freelist.c test_lfds700_freelist_alignment.c test_lfds700_freelist_popping.c test_lfds700_freelist_popping_and_pushing.c test_lfds700_freelist_pushing.c test_lfds700_freelist_rapid_popping_and_pushing.c \ + test_lfds700_hash_addonly.c test_lfds700_hash_addonly_alignment.c test_lfds700_hash_addonly_iterate.c test_lfds700_hash_addonly_random_adds_fail.c test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c test_lfds700_hash_addonly_random_adds_overwrite.c \ + test_lfds700_list_addonly_ordered_singlylinked.c test_lfds700_list_addonly_ordered_singlylinked_alignment.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c \ + test_lfds700_list_addonly_singlylinked_unordered.c test_lfds700_list_addonly_singlylinked_unordered_alignment.c test_lfds700_list_addonly_singlylinked_unordered_new_after.c test_lfds700_list_addonly_singlylinked_unordered_new_end.c test_lfds700_list_addonly_singlylinked_unordered_new_start.c \ + test_lfds700_porting_abstraction_layer_atomic.c test_lfds700_porting_abstraction_layer_atomic_cas.c test_lfds700_porting_abstraction_layer_atomic_dcas.c test_lfds700_porting_abstraction_layer_atomic_exchange.c \ + test_lfds700_queue.c test_lfds700_queue_alignment.c test_lfds700_queue_dequeuing.c test_lfds700_queue_enqueuing.c test_lfds700_queue_enqueuing_and_dequeuing.c test_lfds700_queue_enqueuing_and_dequeuing_with_free.c test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c test_lfds700_queue_rapid_enqueuing_and_dequeuing.c \ + test_lfds700_queue_bounded_singleconsumer_singleproducer.c test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c \ + test_lfds700_ringbuffer.c test_lfds700_ringbuffer_reading.c test_lfds700_ringbuffer_reading_and_writing.c test_lfds700_ringbuffer_writing.c \ + test_lfds700_stack.c test_lfds700_stack_alignment.c test_lfds700_stack_popping.c test_lfds700_stack_popping_and_pushing.c test_lfds700_stack_pushing.c test_lfds700_stack_rapid_popping_and_pushing.c \ + test_porting_abstraction_layer_get_logical_core_ids.c test_porting_abstraction_layer_thread_start.c test_porting_abstraction_layer_thread_wait.c \ + util_cmdline.c util_memory_helpers.c util_thread_starter.c +OBJECTS := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES))) +SYSLIBS := -lm -lpthread -lrt +USRLIBS := -llfds700 + +##### default paths ##### +CPATH += $(LIBINCDIRS) +LIBRARY_PATH += $(LIBBINDIRS) +export CPATH +export LIBRARY_PATH + +##### tools ##### +MAKE := make +MFLAGS := + +DG := gcc +DGFLAGS := -MM -std=gnu89 + +CC := gcc +CFBASE := -c -pthread -std=gnu89 -Wall -Wno-unknown-pragmas +CFCOV := -O0 -ggdb -DCOVERAGE -fprofile-arcs -ftest-coverage +CFDBG := -O0 -ggdb -D_DEBUG +CFPROF := -O0 -ggdb -DPROF -pg +CFREL := -O2 -DNDEBUG -finline-functions -Wno-strict-aliasing +CFTSAN := -O0 -ggdb -DTSAN -fsanitize=thread -fPIE + +LD := gcc +LFBASE := -pthread -std=gnu89 -Wall -Werror +LFCOV := -O0 -fprofile-arcs -ftest-coverage +LFDBG := -O0 -ggdb +LFPROF := -O0 -pg +LFREL := -O2 -s -finline-functions +LFTSAN := -O0 -fsanitize=thread -pie + +PROF := gprof +PFBASE := -b -p -Q $(BINARY) gmon.out + +##### variants and libnuma check ##### +CFLAGS += $(CFBASE) +LFLAGS += $(LFBASE) + +ifeq ($(MAKECMDGOALS),) + CFLAGS += $(CFDBG) + LFLAGS += $(LFDBG) +endif + +ifeq ($(MAKECMDGOALS),cov) + CFLAGS += $(CFCOV) + LFLAGS += $(LFCOV) + SYSLIBS += -lgcov +endif + +ifeq ($(MAKECMDGOALS),dbg) + CFLAGS += $(CFDBG) + LFLAGS += $(LFDBG) +endif + +ifeq ($(MAKECMDGOALS),prof) + CFLAGS += $(CFPROF) + LFLAGS += $(LFPROF) +endif + +ifeq ($(MAKECMDGOALS),rel) + CFLAGS += $(CFREL) + LFLAGS += $(LFREL) +endif + +ifeq ($(MAKECMDGOALS),tsan) + CFLAGS += $(CFTSAN) + LFLAGS += $(LFTSAN) +endif + +##### search paths ##### +vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS)) + +##### implicit rules ##### +$(OBJDIR)/%.o : %.c + $(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d + $(CC) $(CFLAGS) -o $@ $< + +##### explicit rules ##### +$(BINARY) : $(OBJECTS) + $(LD) -o $(BINARY) $(LFLAGS) $(OBJECTS) $(USRLIBS) $(SYSLIBS) + chmod +x $(BINARY) + +##### phony ##### +.PHONY : clean cov dbg prof rel tsan + +clean : + @rm -f $(BINDIR)/$(BINNAME) $(OBJDIR)/*.o $(OBJDIR)/*.d $(OBJDIR)/*.gcno + +cov : $(BINARY) +dbg : $(BINARY) +prof : $(BINARY) +rel : $(BINARY) +tsan : $(BINARY) + +genprof : + @$(PROF) $(PFBASE) + +##### dependencies ##### +-include $(DEPENDS) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile new file mode 100644 index 0000000000..c54d16635b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile @@ -0,0 +1,106 @@ +##### paths ##### +BINDIR := ..\..\bin +OBJDIR := ..\..\obj +SRCDIR := ..\..\src + +##### misc ##### +QUIETLY := 1>nul 2>nul +NULL := +SPACE := $(NULL) # TRD : necessary trailing space after the close bracket + +##### sources, objects and libraries ##### +BINNAME := test +BINARY := $(BINDIR)\$(BINNAME).exe +SRCDIRS := . +SOURCES := main.c misc.c \ + test_lfds700_btree_addonly_unbalanced.c test_lfds700_btree_addonly_unbalanced_alignment.c test_lfds700_btree_addonly_unbalanced_random_adds_fail.c test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c \ + test_lfds700_freelist.c test_lfds700_freelist_alignment.c test_lfds700_freelist_popping.c test_lfds700_freelist_popping_and_pushing.c test_lfds700_freelist_pushing.c test_lfds700_freelist_rapid_popping_and_pushing.c \ + test_lfds700_hash_addonly.c test_lfds700_hash_addonly_alignment.c test_lfds700_hash_addonly_iterate.c test_lfds700_hash_addonly_random_adds_fail.c test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c test_lfds700_hash_addonly_random_adds_overwrite.c \ + test_lfds700_list_addonly_ordered_singlylinked.c test_lfds700_list_addonly_ordered_singlylinked_alignment.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c \ + test_lfds700_list_addonly_singlylinked_unordered.c test_lfds700_list_addonly_singlylinked_unordered_alignment.c test_lfds700_list_addonly_singlylinked_unordered_new_after.c test_lfds700_list_addonly_singlylinked_unordered_new_end.c test_lfds700_list_addonly_singlylinked_unordered_new_start.c \ + test_lfds700_porting_abstraction_layer_atomic.c test_lfds700_porting_abstraction_layer_atomic_cas.c test_lfds700_porting_abstraction_layer_atomic_dcas.c test_lfds700_porting_abstraction_layer_atomic_exchange.c \ + test_lfds700_queue.c test_lfds700_queue_alignment.c test_lfds700_queue_dequeuing.c test_lfds700_queue_enqueuing.c test_lfds700_queue_enqueuing_and_dequeuing.c test_lfds700_queue_enqueuing_and_dequeuing_with_free.c test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c test_lfds700_queue_rapid_enqueuing_and_dequeuing.c \ + test_lfds700_queue_bounded_singleconsumer_singleproducer.c test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c \ + test_lfds700_ringbuffer.c test_lfds700_ringbuffer_reading.c test_lfds700_ringbuffer_reading_and_writing.c test_lfds700_ringbuffer_writing.c \ + test_lfds700_stack.c test_lfds700_stack_alignment.c test_lfds700_stack_popping.c test_lfds700_stack_popping_and_pushing.c test_lfds700_stack_pushing.c test_lfds700_stack_rapid_popping_and_pushing.c \ + test_porting_abstraction_layer_get_logical_core_ids.c test_porting_abstraction_layer_thread_start.c test_porting_abstraction_layer_thread_wait.c \ + util_cmdline.c util_memory_helpers.c util_thread_starter.c +OBJECTS := $(patsubst %.c,$(OBJDIR)/%.obj,$(notdir $(SOURCES))) +RESFILE := $(patsubst %.rc,$(OBJDIR)/%.res,$(notdir $(RCFILE))) +SYSLIBS := kernel32.lib +EXTLIBS := +USRLIBS := ../../../liblfds700/bin/liblfds700.lib + +##### default paths fix up ##### +INCLUDE += ;../../../../liblfds700/inc/ +LIB += ;../../../../liblfds700/bin/ + +##### tools ##### +MAKE := make +MFLAGS := + +CC := cl +CFBASE := /c /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN /DUNICODE /D_UNICODE /DUNICODE "/Fd$(BINDIR)\$(BINNAME).pdb" /nologo /W4 /WX +CFREL := /DNDEBUG /Ox +CFDBG := /D_DEBUG /Od /Gm /Zi + +LD := link +LFBASE := /nologo /subsystem:console /nodefaultlib /nxcompat /wx +LFREL := /incremental:no +LFDBG := /debug "/pdb:$(BINDIR)\$(BINNAME).pdb" + +##### variants ##### +CFLAGS := $(CFBASE) $(CFDBG) /MTd +LFLAGS := $(LFBASE) $(LFDBG) +CLIB := libcmtd.lib + +ifeq ($(MAKECMDGOALS),librel) + CFLAGS := $(CFBASE) $(CFREL) /MT + LFLAGS := $(LFBASE) $(LFREL) + CLIB := libcmt.lib +endif + +ifeq ($(MAKECMDGOALS),libdbg) + CFLAGS := $(CFBASE) $(CFDBG) /MTd + LFLAGS := $(LFBASE) $(LFDBG) + CLIB := libcmtd.lib +endif + +ifeq ($(MAKECMDGOALS),dllrel) + CFLAGS := $(CFBASE) $(CFREL) /MD + LFLAGS := $(LFBASE) $(LFREL) + CLIB := msvcrt.lib +endif + +ifeq ($(MAKECMDGOALS),dlldbg) + CFLAGS := $(CFBASE) $(CFDBG) /MDd + LFLAGS := $(LFBASE) $(LFDBG) + CLIB := msvcrtd.lib +endif + +##### search paths ##### +vpath %.c $(patsubst %,$(SRCDIR)/%;,$(SRCDIRS)) + +##### implicit rules ##### +$(OBJDIR)/%.obj : %.c + $(CC) $(CFLAGS) "/Fo$@" $< + +##### explicit rules ##### +$(BINARY) : $(OBJECTS) $(USRLIBS) + $(LD) $(LFLAGS) $(CLIB) $(SYSLIBS) $(EXTLIBS) $(USRLIBS) $(OBJECTS) /out:$(BINARY) + +##### phony ##### +.PHONY : clean librel libdbg dllrel dlldbg + +clean : + @erase /Q $(OBJDIR)\*.obj $(OBJDIR)\*.res $(BINDIR)\$(BINNAME).* $(QUIETLY) + +dlldbg : $(BINARY) +dllrel : $(BINARY) + +libdbg : $(BINARY) +librel : $(BINARY) + +##### notes ##### +# TRD : we fix up the default paths because cl and link require an extra argument per additional path, which is ugly as hell + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln new file mode 100644 index 0000000000..cc8727482f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln @@ -0,0 +1,67 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}" + ProjectSection(ProjectDependencies) = postProject + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} = {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "..\..\..\liblfds700\build\visual_studio_professional_2012\liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug DLL|x64 = Debug DLL|x64 + Debug LIB|Win32 = Debug LIB|Win32 + Debug LIB|x64 = Debug LIB|x64 + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release LIB|Win32 = Release LIB|Win32 + Release LIB|x64 = Release LIB|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.Build.0 = Release DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.Deploy.0 = Release DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.Build.0 = Release LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.Deploy.0 = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj new file mode 100644 index 0000000000..3fbf8d78ee --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj @@ -0,0 +1,554 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug DLL|Win32"> + <Configuration>Debug DLL</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug DLL|x64"> + <Configuration>Debug DLL</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|Win32"> + <Configuration>Debug LIB</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug LIB|x64"> + <Configuration>Debug LIB</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|Win32"> + <Configuration>Release DLL</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release DLL|x64"> + <Configuration>Release DLL</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|Win32"> + <Configuration>Release LIB</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release LIB|x64"> + <Configuration>Release LIB</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\internal.h" /> + <ClInclude Include="..\..\src\test_porting_abstraction_layer_operating_system.h" /> + <ClInclude Include="..\..\src\util_cmdline.h" /> + <ClInclude Include="..\..\src\util_memory_helpers.h" /> + <ClInclude Include="..\..\src\util_thread_starter.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\main.c" /> + <ClCompile Include="..\..\src\misc.c" /> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced.c" /> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced_alignment.c" /> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced_random_adds_fail.c" /> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c" /> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c" /> + <ClCompile Include="..\..\src\test_lfds700_freelist.c" /> + <ClCompile Include="..\..\src\test_lfds700_freelist_alignment.c" /> + <ClCompile Include="..\..\src\test_lfds700_freelist_popping.c" /> + <ClCompile Include="..\..\src\test_lfds700_freelist_popping_and_pushing.c" /> + <ClCompile Include="..\..\src\test_lfds700_freelist_pushing.c" /> + <ClCompile Include="..\..\src\test_lfds700_freelist_rapid_popping_and_pushing.c" /> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly.c" /> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_alignment.c" /> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_iterate.c" /> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_random_adds_fail.c" /> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c" /> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_random_adds_overwrite.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_ordered_singlylinked.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_ordered_singlylinked_alignment.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered_alignment.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered_new_after.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered_new_end.c" /> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered_new_start.c" /> + <ClCompile Include="..\..\src\test_lfds700_porting_abstraction_layer_atomic.c" /> + <ClCompile Include="..\..\src\test_lfds700_porting_abstraction_layer_atomic_cas.c" /> + <ClCompile Include="..\..\src\test_lfds700_porting_abstraction_layer_atomic_dcas.c" /> + <ClCompile Include="..\..\src\test_lfds700_porting_abstraction_layer_atomic_exchange.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_alignment.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_bounded_singleconsumer_singleproducer.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_dequeuing.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_enqueuing.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_enqueuing_and_dequeuing.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_enqueuing_and_dequeuing_with_free.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c" /> + <ClCompile Include="..\..\src\test_lfds700_queue_rapid_enqueuing_and_dequeuing.c" /> + <ClCompile Include="..\..\src\test_lfds700_ringbuffer.c" /> + <ClCompile Include="..\..\src\test_lfds700_ringbuffer_reading.c" /> + <ClCompile Include="..\..\src\test_lfds700_ringbuffer_reading_and_writing.c" /> + <ClCompile Include="..\..\src\test_lfds700_ringbuffer_writing.c" /> + <ClCompile Include="..\..\src\test_lfds700_stack.c" /> + <ClCompile Include="..\..\src\test_lfds700_stack_alignment.c" /> + <ClCompile Include="..\..\src\test_lfds700_stack_popping.c" /> + <ClCompile Include="..\..\src\test_lfds700_stack_popping_and_pushing.c" /> + <ClCompile Include="..\..\src\test_lfds700_stack_pushing.c" /> + <ClCompile Include="..\..\src\test_lfds700_stack_rapid_popping_and_pushing.c" /> + <ClCompile Include="..\..\src\test_porting_abstraction_layer_get_logical_core_ids.c" /> + <ClCompile Include="..\..\src\test_porting_abstraction_layer_thread_start.c" /> + <ClCompile Include="..\..\src\test_porting_abstraction_layer_thread_wait.c" /> + <ClCompile Include="..\..\src\util_cmdline.c" /> + <ClCompile Include="..\..\src\util_memory_helpers.c" /> + <ClCompile Include="..\..\src\util_thread_starter.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\liblfds700\build\visual_studio_professional_2012\liblfds700.vcxproj"> + <Project>{1e5d7d09-94f2-455d-ae5e-6c7f4c96bce0}</Project> + </ProjectReference> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(ProjectDir)..\..\bin\$(Platform) $(Configuration)\</OutDir> + <IntDir>$(ProjectDir)..\..\obj\$(Platform) $(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <SDLCheck>true</SDLCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <MinimalRebuild>false</MinimalRebuild> + <ExceptionHandling>false</ExceptionHandling> + <FunctionLevelLinking>false</FunctionLevelLinking> + <EnableParallelCodeGeneration>false</EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <ErrorReporting>None</ErrorReporting> + <AdditionalIncludeDirectories>..\liblfds700\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <BufferSecurityCheck>true</BufferSecurityCheck> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <LinkTimeCodeGeneration> + </LinkTimeCodeGeneration> + <LinkStatus> + </LinkStatus> + <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <SDLCheck>true</SDLCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <MinimalRebuild>false</MinimalRebuild> + <ExceptionHandling>false</ExceptionHandling> + <FunctionLevelLinking>false</FunctionLevelLinking> + <EnableParallelCodeGeneration>false</EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <ErrorReporting>None</ErrorReporting> + <AdditionalIncludeDirectories>..\liblfds700\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <BufferSecurityCheck>true</BufferSecurityCheck> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <LinkTimeCodeGeneration> + </LinkTimeCodeGeneration> + <LinkStatus> + </LinkStatus> + <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <SDLCheck>true</SDLCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <MinimalRebuild>false</MinimalRebuild> + <ExceptionHandling>false</ExceptionHandling> + <FunctionLevelLinking>false</FunctionLevelLinking> + <EnableParallelCodeGeneration>false</EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <ErrorReporting>None</ErrorReporting> + <BufferSecurityCheck>true</BufferSecurityCheck> + <OmitFramePointers>false</OmitFramePointers> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <LinkTimeCodeGeneration> + </LinkTimeCodeGeneration> + <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug LIB|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <Optimization>Disabled</Optimization> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <TreatWarningAsError>true</TreatWarningAsError> + <SDLCheck>true</SDLCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <IntrinsicFunctions>true</IntrinsicFunctions> + <StringPooling>true</StringPooling> + <MinimalRebuild>false</MinimalRebuild> + <ExceptionHandling>false</ExceptionHandling> + <FunctionLevelLinking>false</FunctionLevelLinking> + <EnableParallelCodeGeneration>false</EnableParallelCodeGeneration> + <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet> + <FloatingPointExceptions>false</FloatingPointExceptions> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <BrowseInformation>true</BrowseInformation> + <CompileAs>CompileAsC</CompileAs> + <ErrorReporting>None</ErrorReporting> + <BufferSecurityCheck>true</BufferSecurityCheck> + <OmitFramePointers>false</OmitFramePointers> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <LinkTimeCodeGeneration> + </LinkTimeCodeGeneration> + <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <ExceptionHandling>false</ExceptionHandling> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <CompileAs>CompileAsC</CompileAs> + <TreatWarningAsError>true</TreatWarningAsError> + <SDLCheck> + </SDLCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <WholeProgramOptimization>true</WholeProgramOptimization> + <StringPooling>true</StringPooling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> + <FloatingPointExceptions>false</FloatingPointExceptions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <ErrorReporting>None</ErrorReporting> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <SetChecksum>true</SetChecksum> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <ExceptionHandling>false</ExceptionHandling> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <CompileAs>CompileAsC</CompileAs> + <TreatWarningAsError>true</TreatWarningAsError> + <SDLCheck> + </SDLCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <WholeProgramOptimization>true</WholeProgramOptimization> + <StringPooling>true</StringPooling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> + <FloatingPointExceptions>false</FloatingPointExceptions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <ErrorReporting>None</ErrorReporting> + </ClCompile> + <Link> + <TargetMachine>MachineX86</TargetMachine> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <SetChecksum>true</SetChecksum> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <ExceptionHandling>false</ExceptionHandling> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <CompileAs>CompileAsC</CompileAs> + <TreatWarningAsError>true</TreatWarningAsError> + <SDLCheck> + </SDLCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <WholeProgramOptimization>true</WholeProgramOptimization> + <StringPooling>true</StringPooling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> + <FloatingPointExceptions>false</FloatingPointExceptions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <ErrorReporting>None</ErrorReporting> + </ClCompile> + <Link> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <SetChecksum>true</SetChecksum> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release LIB|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAsManaged>false</CompileAsManaged> + <CompileAsWinRT>false</CompileAsWinRT> + <ExceptionHandling>false</ExceptionHandling> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <CompileAs>CompileAsC</CompileAs> + <TreatWarningAsError>true</TreatWarningAsError> + <SDLCheck> + </SDLCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <WholeProgramOptimization>true</WholeProgramOptimization> + <StringPooling>true</StringPooling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> + <FloatingPointExceptions>false</FloatingPointExceptions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <OpenMPSupport>false</OpenMPSupport> + <ErrorReporting>None</ErrorReporting> + </ClCompile> + <Link> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> + <SetChecksum>true</SetChecksum> + <LinkErrorReporting>NoErrorReport</LinkErrorReporting> + <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters new file mode 100644 index 0000000000..69da4b9836 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\test_porting_abstraction_layer_operating_system.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\util_cmdline.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\util_memory_helpers.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\util_thread_starter.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\main.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\misc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced_alignment.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced_random_adds_fail.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_freelist.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_freelist_alignment.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_freelist_popping.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_freelist_popping_and_pushing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_freelist_pushing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_freelist_rapid_popping_and_pushing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_alignment.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_iterate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_random_adds_fail.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_hash_addonly_random_adds_overwrite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_ordered_singlylinked.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_ordered_singlylinked_alignment.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered_alignment.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered_new_after.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered_new_end.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_list_addonly_singlylinked_unordered_new_start.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_porting_abstraction_layer_atomic.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_porting_abstraction_layer_atomic_cas.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_porting_abstraction_layer_atomic_dcas.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_porting_abstraction_layer_atomic_exchange.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_alignment.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_bounded_singleconsumer_singleproducer.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_dequeuing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_enqueuing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_enqueuing_and_dequeuing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_enqueuing_and_dequeuing_with_free.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_queue_rapid_enqueuing_and_dequeuing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_ringbuffer.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_ringbuffer_reading.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_ringbuffer_reading_and_writing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_ringbuffer_writing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_stack.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_stack_alignment.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_stack_popping.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_stack_popping_and_pushing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_stack_pushing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_lfds700_stack_rapid_popping_and_pushing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_porting_abstraction_layer_get_logical_core_ids.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_porting_abstraction_layer_thread_start.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\test_porting_abstraction_layer_thread_wait.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\util_cmdline.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\util_memory_helpers.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\util_thread_starter.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user new file mode 100644 index 0000000000..7cbb3216ad --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project> \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h new file mode 100644 index 0000000000..14bf02c74c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h @@ -0,0 +1,157 @@ +/***** includes *****/ +#define _GNU_SOURCE +#include <assert.h> +#include <ctype.h> +#include <limits.h> +#include <math.h> +#include <stdarg.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include "../../liblfds700/inc/liblfds700.h" +#include "test_porting_abstraction_layer_operating_system.h" + +/***** defines *****/ +#define and && +#define or || + +#define NO_FLAGS 0x0 + +#define BITS_PER_BYTE 8 + +#define TEST_DURATION_IN_SECONDS 5 +#define TIME_LOOP_COUNT 10000 +#define REDUCED_TIME_LOOP_COUNT 1000 +#define NUMBER_OF_NANOSECONDS_IN_ONE_SECOND 1000000000LLU +#define ONE_MEGABYTE_IN_BYTES (1024 * 1024) +#define DEFAULT_TEST_MEMORY_IN_MEGABYTES 512U +#define TEST_PAL_DEFAULT_NUMA_NODE_ID 0 +#define LFDS700_TEST_VERSION_STRING "7.0.0" +#define LFDS700_TEST_VERSION_INTEGER 700 + +#if( defined _KERNEL_MODE ) + #define MODE_TYPE_STRING "kernel-mode" +#endif + +#if( !defined _KERNEL_MODE ) + #define MODE_TYPE_STRING "user-mode" +#endif + +#if( defined NDEBUG && !defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "release" +#endif + +#if( !defined NDEBUG && !defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "debug" +#endif + +#if( !defined NDEBUG && defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "coverage" +#endif + +#if( !defined NDEBUG && !defined COVERAGE && defined TSAN ) + #define BUILD_TYPE_STRING "threadsanitizer" +#endif + +/***** enums *****/ +enum flag +{ + LOWERED, + RAISED +}; + +/***** structs *****/ +struct test_pal_logical_processor +{ + lfds700_pal_uint_t + logical_processor_number, + windows_logical_processor_group_number; + + struct lfds700_list_asu_element + lasue; +}; + +/***** prototypes *****/ +int main( int argc, char **argv ); + +void internal_display_test_name( char *format_string, ... ); +void internal_display_test_result( lfds700_pal_uint_t number_name_dvs_pairs, ... ); +void internal_display_data_structure_validity( enum lfds700_misc_validity dvs ); +void internal_show_version( void ); +void internal_logical_core_id_element_cleanup_callback( struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue ); + +int test_pal_thread_start( test_pal_thread_state_t *thread_state, struct test_pal_logical_processor *lp, test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), void *thread_user_state ); +void test_pal_thread_wait( test_pal_thread_state_t thread_state ); +void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ); + +void test_lfds700_pal_atomic( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_pal_atomic_cas( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_pal_atomic_dwcas( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_pal_atomic_exchange( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_hash_a( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_hash_a_alignment( void ); + void test_lfds700_hash_a_fail_and_overwrite_on_existing_key( void ); + void test_lfds700_hash_a_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_hash_a_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_hash_a_iterate( void ); + +void test_lfds700_list_aos( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_aos_alignment( void ); + void test_lfds700_list_aos_new_ordered( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_aos_new_ordered_with_cursor( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_list_asu( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_asu_alignment( void ); + void test_lfds700_list_asu_new_start( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_asu_new_end( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_asu_new_after( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_btree_au( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_btree_au_alignment( void ); + void test_lfds700_btree_au_fail_and_overwrite_on_existing_key( void ); + void test_lfds700_btree_au_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_btree_au_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_freelist( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_freelist_alignment( void ); + void test_lfds700_freelist_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_freelist_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_freelist_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_freelist_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_freelist_pushing_array( void ); + +void test_lfds700_queue( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_alignment( void ); + void test_lfds700_queue_enqueuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_queue_rapid_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_enqueuing_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors ); + +void test_lfds700_queue_bss( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_queue_bss_enqueuing( void ); + void test_lfds700_queue_bss_dequeuing( void ); + void test_lfds700_queue_bss_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ); + +void test_lfds700_ringbuffer( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_ringbuffer_reading( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_ringbuffer_reading_and_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_ringbuffer_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_stack( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_stack_alignment( void ); + void test_lfds700_stack_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_stack_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_stack_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_stack_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_stack_pushing_array( void ); + +/***** late includes *****/ +#include "util_cmdline.h" +#include "util_memory_helpers.h" +#include "util_thread_starter.h" + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c new file mode 100644 index 0000000000..fa6afc8747 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c @@ -0,0 +1,135 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +int main( int argc, char **argv ) +{ + enum flag + run_flag = LOWERED, + show_error_flag = LOWERED, + show_help_flag = LOWERED, + show_version_flag = LOWERED; + + int + rv; + + lfds700_pal_uint_t + loop, + iterations = 1, + memory_in_megabytes = DEFAULT_TEST_MEMORY_IN_MEGABYTES; + + struct lfds700_list_asu_state + list_of_logical_processors; + + struct util_cmdline_state + cs; + + union util_cmdline_arg_data + *arg_data; + + assert( argc >= 1 ); + assert( argv != NULL ); + + lfds700_misc_library_init_valid_on_current_logical_core(); + + util_cmdline_init( &cs ); + + util_cmdline_add_arg( &cs, 'h', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); + util_cmdline_add_arg( &cs, 'i', LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER ); + util_cmdline_add_arg( &cs, 'm', LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER ); + util_cmdline_add_arg( &cs, 'r', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); + util_cmdline_add_arg( &cs, 'v', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); + + rv = util_cmdline_process_args( &cs, argc, argv ); + + if( rv == 0 ) + show_error_flag = RAISED; + + if( rv == 1 ) + { + util_cmdline_get_arg_data( &cs, 'h', &arg_data ); + if( arg_data != NULL ) + show_help_flag = RAISED; + + util_cmdline_get_arg_data( &cs, 'i', &arg_data ); + if( arg_data != NULL ) + iterations = (lfds700_pal_uint_t) arg_data->integer.integer; + + util_cmdline_get_arg_data( &cs, 'm', &arg_data ); + if( arg_data != NULL ) + memory_in_megabytes = (lfds700_pal_uint_t) arg_data->integer.integer; + + util_cmdline_get_arg_data( &cs, 'r', &arg_data ); + if( arg_data != NULL ) + run_flag = RAISED; + + util_cmdline_get_arg_data( &cs, 'v', &arg_data ); + if( arg_data != NULL ) + show_version_flag = RAISED; + } + + util_cmdline_cleanup( &cs ); + + if( argc == 1 or (run_flag == LOWERED and show_version_flag == LOWERED) ) + show_help_flag = RAISED; + + if( show_error_flag == RAISED ) + { + printf( "\nInvalid arguments. Sorry - it's a simple parser, so no clues.\n" + "-h or run with no args to see the help text.\n" ); + + return( EXIT_SUCCESS ); + } + + if( show_help_flag == RAISED ) + { + printf( "test -h -i [n] -m [n] -r -v\n" + " -h : help\n" + " -i [n] : number of iterations (default : 1)\n" + " -m [n] : memory for tests, in mb (default : %u)\n" + " -r : run (causes test to run; present so no args gives help)\n" + " -v : version\n", DEFAULT_TEST_MEMORY_IN_MEGABYTES ); + + return( EXIT_SUCCESS ); + } + + if( show_version_flag == RAISED ) + { + internal_show_version(); + return( EXIT_SUCCESS ); + } + + if( run_flag == RAISED ) + { + test_pal_get_logical_core_ids( &list_of_logical_processors ); + + for( loop = 0 ; loop < (lfds700_pal_uint_t) iterations ; loop++ ) + { + printf( "\n" + "Test Iteration %02llu\n" + "=================\n", (int long long unsigned) (loop+1) ); + + test_lfds700_pal_atomic( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_btree_au( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_freelist( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_hash_a( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_aos( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_asu( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_bss( &list_of_logical_processors ); + test_lfds700_ringbuffer( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_stack( &list_of_logical_processors, memory_in_megabytes ); + } + + lfds700_list_asu_cleanup( &list_of_logical_processors, internal_logical_core_id_element_cleanup_callback ); + } + + lfds700_misc_library_cleanup(); + + return( EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c new file mode 100644 index 0000000000..4fa794f68d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c @@ -0,0 +1,191 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void internal_display_test_name( char *format_string, ... ) +{ + va_list + va; + + assert( format_string != NULL ); + + va_start( va, format_string ); + + vprintf( format_string, va ); + + printf( "..." ); + + va_end( va ); + + fflush( stdout ); + + return; +} + + + + + +/****************************************************************************/ +void internal_display_test_result( lfds700_pal_uint_t number_name_dvs_pairs, ... ) +{ + char + *name; + + enum flag + passed_flag = RAISED; + + enum lfds700_misc_validity + dvs; + + lfds700_pal_uint_t + loop; + + va_list + va; + + // TRD : number_name_dvs_pairs can be any value in its range + + va_start( va, number_name_dvs_pairs ); + + for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ ) + { + name = va_arg( va, char * ); + dvs = va_arg( va, enum lfds700_misc_validity ); + + if( dvs != LFDS700_MISC_VALIDITY_VALID ) + { + passed_flag = LOWERED; + break; + } + } + + va_end( va ); + + if( passed_flag == RAISED ) + puts( "passed" ); + + if( passed_flag == LOWERED ) + { + printf( "failed (" ); + + va_start( va, number_name_dvs_pairs ); + + for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ ) + { + name = va_arg( va, char * ); + dvs = va_arg( va, enum lfds700_misc_validity ); + + printf( "%s ", name ); + internal_display_data_structure_validity( dvs ); + + if( loop+1 < number_name_dvs_pairs ) + printf( ", " ); + } + + va_end( va ); + + printf( ")\n" ); + + /* TRD : quick hack + the whole test programme needs rewriting + and for now I just want to make it so we + exit with failure upon any test failing + */ + + exit( EXIT_FAILURE ); + } + + return; +} + + + + + +/****************************************************************************/ +void internal_display_data_structure_validity( enum lfds700_misc_validity dvs ) +{ + char + *string = NULL; + + switch( dvs ) + { + case LFDS700_MISC_VALIDITY_VALID: + string = "valid"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_LOOP: + string = "invalid - loop detected"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_ORDER: + string = "invalid - invalid order detected"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS: + string = "invalid - missing elements"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS: + string = "invalid - additional elements"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_TEST_DATA: + string = "invalid - invalid test data"; + break; + } + + printf( "%s", string ); + + return; +} + + + + + +/****************************************************************************/ +void internal_show_version() +{ + char const + *version_and_build_string; + + printf( "test %s (%s, %s) (" __DATE__ " " __TIME__ ")\n", LFDS700_TEST_VERSION_STRING, BUILD_TYPE_STRING, MODE_TYPE_STRING ); + + lfds700_misc_query( LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING, NULL, (void **) &version_and_build_string ); + + printf( "%s\n", version_and_build_string ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +void internal_logical_core_id_element_cleanup_callback( struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue ) +{ + struct test_pal_logical_processor + *lp; + + assert( lasus != NULL ); + assert( lasue != NULL ); + + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + util_aligned_free( lp ); + + return; +} + +#pragma warning( default : 4100 ) + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c new file mode 100644 index 0000000000..55b94ca5bb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c @@ -0,0 +1,32 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_btree_au( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS and LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE ) + { + printf( "\n" + "Binary Tree (add-only, unbalanced) Tests\n" + "========================================\n" ); + + test_lfds700_btree_au_alignment(); + test_lfds700_btree_au_fail_and_overwrite_on_existing_key(); + test_lfds700_btree_au_random_adds_fail_on_existing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_btree_au_random_adds_overwrite_on_existing( list_of_logical_processors, memory_in_megabytes ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c new file mode 100644 index 0000000000..ecdaf29adb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c @@ -0,0 +1,64 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_btree_au_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_btree_au_element + if( offsetof(struct lfds700_btree_au_element,up) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,left) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,right) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : struct lfds700_btree_au_state + if( offsetof(struct lfds700_btree_au_state,root) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "btree_au", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c new file mode 100644 index 0000000000..ae043a0669 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c @@ -0,0 +1,319 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_btree_au_element + baue; + + lfds700_pal_uint_t + key; +}; + +struct test_state +{ + lfds700_pal_uint_t + insert_fail_count, + number_elements; + + struct lfds700_btree_au_state + *baus; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int key_compare_function( void const *new_value, void const *value_in_tree ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_btree_au_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + actual_sum_insert_failure_count, + expected_sum_insert_failure_count, + index = 0, + *key_count_array, + loop, + number_elements, + number_logical_processors, + random_value, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_btree_au_element + *baue = NULL; + + struct lfds700_btree_au_state + baus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + void + *key; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single btree_au + we generate 10k elements per thread (one per logical processor) in an array + we set a random number in each element, which is the key + random numbers are generated are from 0 to 5000, so we must have some duplicates + (we don't use value, so we always pass in a NULL for that when we insert) + + each thread loops, adds those elements into the btree, and counts the total number of insert fails + (we don't count on a per value basis because of the performance hit - we'll be TLBing all the time) + this test has the btree_au set to fail on add, so duplicates should be eliminated + + we then merge the per-thread arrays + + we should find in the tree one of every value, and the sum of the counts of each value (beyond the + first value, which was inserted) in the merged arrays should equal the sum of the insert fails from + each thread + + we check the count of unique values in the merged array and use that when calling the btree_au validation function + + we in-order walk and check that what we have in the tree matches what we have in the merged array + and then check the fail counts + */ + + internal_display_test_name( "Random adds and walking (fail on existing key)" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_FAIL, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->baus = &baus; + (ts+loop)->element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + (ts+loop)->number_elements = number_elements; + (ts+loop)->insert_fail_count = 0; + + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); + ((ts+loop)->element_array+subloop)->key = (lfds700_pal_uint_t) floor( (number_elements/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); + } + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : now for validation + make an array equal to number_elements, set all to 0 + iterate over every per-thread array, counting the number of each value into this array + so we can know how many elements ought to have failed to be inserted + as well as being able to work out the actual number of elements which should be present in the btree, for the btree validation call + */ + + key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); + for( loop = 0 ; loop < number_elements ; loop++ ) + *(key_count_array+loop) = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + ( *(key_count_array+( (ts+loop)->element_array+subloop)->key) )++; + + // TRD : first, btree validation function + vi.min_elements = number_elements; + + for( loop = 0 ; loop < number_elements ; loop++ ) + if( *(key_count_array+loop) == 0 ) + vi.min_elements--; + + vi.max_elements = vi.min_elements; + + lfds700_btree_au_query( &baus, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + /* TRD : now check the sum of per-thread insert failures + is what it should be, which is the sum of key_count_array, + but with every count minus one (for the single succesful insert) + and where elements of 0 are ignored (i.e. do not have -1 applied) + */ + + expected_sum_insert_failure_count = 0; + + for( loop = 0 ; loop < number_elements ; loop++ ) + if( *(key_count_array+loop) != 0 ) + expected_sum_insert_failure_count += *(key_count_array+loop) - 1; + + actual_sum_insert_failure_count = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + actual_sum_insert_failure_count += (ts+loop)->insert_fail_count; + + if( expected_sum_insert_failure_count != actual_sum_insert_failure_count ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + /* TRD : now compared the combined array and an in-order walk of the tree + ignoring array elements with the value 0, we should find an exact match + */ + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + { + // TRD : in-order walk over btree_au and check key_count_array matches + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(&baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) + { + key = LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( *baue ); + + while( *(key_count_array+index) == 0 ) + index++; + + if( index++ != (lfds700_pal_uint_t) key ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + } + + // TRD : cleanup + free( key_count_array ); + + lfds700_btree_au_cleanup( &baus, NULL ); + + // TRD : cleanup + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->element_array ); + + free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "btree_au", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *key_in_tree ) +{ + int + cr = 0; + + // TRD : key_new can be any value in its range + // TRD : key_in_tree can be any value in its range + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) +{ + enum lfds700_btree_au_insert_result + alr; + + lfds700_pal_uint_t + index = 0; + + struct test_state + *ts; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( index < ts->number_elements ) + { + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( (ts->element_array+index)->baue, (ts->element_array+index)->key ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->baue, 0 ); + alr = lfds700_btree_au_insert( ts->baus, &(ts->element_array+index)->baue, NULL, &ps ); + + if( alr == LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ) + ts->insert_fail_count++; + + index++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c new file mode 100644 index 0000000000..4c638c8600 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c @@ -0,0 +1,140 @@ +/***** includes *****/ +#include "internal.h" + +/***** private prototypes *****/ +static int key_compare_function( void const *new_value, void const *value_in_tree ); + + + + + +/****************************************************************************/ +void test_lfds700_btree_au_fail_and_overwrite_on_existing_key() +{ + enum lfds700_btree_au_insert_result + alr; + + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + struct lfds700_btree_au_element + baue_one, + baue_two, + *existing_baue; + + struct lfds700_btree_au_state + baus; + + struct lfds700_misc_prng_state + ps; + + void + *value; + + /* TRD : the random_adds tests with fail and overwrite don't (can't, not in a performant manner) + test that the fail and/or overwrite of user data has *actually* happened - they use the + return value from the link function call, rather than empirically observing the final + state of the tree + + as such, we now have a couple of single threaded tests where we check that the user data + value really is being modified (or not modified, as the case may be) + */ + + internal_display_test_name( "Fail and overwrite on existing key" ); + + lfds700_misc_prng_init( &ps ); + + /* TRD : so, we make a tree which is fail on existing + add one element, with a known user data + we then try to add the same key again, with a different user data + the call should fail, and then we get the element by its key + and check its user data is unchanged + (and confirm the failed link returned the correct existing_baue) + that's the first test done + */ + + lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_FAIL, NULL ); + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_one, 0 ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_one, 1 ); + alr = lfds700_btree_au_insert( &baus, &baue_one, NULL, &ps ); + + if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_two, 0 ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_two, 2 ); + alr = lfds700_btree_au_insert( &baus, &baue_two, &existing_baue, &ps ); + + if( alr != LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( existing_baue != &baue_one ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + value = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *existing_baue ); + + if( (void *) (lfds700_pal_uint_t) value != (void *) (lfds700_pal_uint_t) 1 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + lfds700_btree_au_cleanup( &baus, NULL ); + + /* TRD : second test, make a tree which is overwrite on existing + add one element, with a known user data + we then try to add the same key again, with a different user data + the call should succeed, and then we get the element by its key + and check its user data is changed + (and confirm the failed link returned the correct existing_baue) + that's the secondtest done + */ + + lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, NULL ); + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_one, 0 ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_one, 1 ); + alr = lfds700_btree_au_insert( &baus, &baue_one, NULL, &ps ); + + if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_two, 0 ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_two, 2 ); + alr = lfds700_btree_au_insert( &baus, &baue_two, NULL, &ps ); + + if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + lfds700_btree_au_cleanup( &baus, NULL ); + + // TRD : print the test result + internal_display_test_result( 1, "btree_au", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *key_in_tree ) +{ + int + cr = 0; + + // TRD : key_new can be any value in its range + // TRD : key_in_tree can be any value in its range + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c new file mode 100644 index 0000000000..c9b162128b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c @@ -0,0 +1,322 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_btree_au_element + baue; + + lfds700_pal_uint_t + key; +}; + +struct test_state +{ + lfds700_pal_uint_t + insert_existing_count, + number_elements; + + struct lfds700_btree_au_state + *baus; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int key_compare_function( void const *new_value, void const *value_in_tree ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_btree_au_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + actual_sum_insert_existing_count, + expected_sum_insert_existing_count, + index = 0, + *key_count_array, + loop, + number_elements, + number_logical_processors, + random_value, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_btree_au_element + *baue = NULL; + + struct lfds700_btree_au_state + baus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + void + *key; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single btree_au + we generate 10k elements per thread (one per logical processor) in an array + we set a random number in each element, which is the key + random numbers are generated are from 0 to 5000, so we must have some duplicates + (we don't use value, so we always pass in a NULL for that when we insert) + + each thread loops, adds those elements into the btree, and counts the total number of insert fails + (we don't count on a per value basis because of the performance hit - we'll be TLBing all the time) + this test has the btree_au set to overwrite on add, so duplicates should be eliminated + + we then merge the per-thread arrays + + we should find in the tree one of every value, and the sum of the counts of each value (beyond the + first value, which was inserted) in the merged arrays should equal the sum of the existing_baues returned + from each thread when they inserted and found an existing element + + we check the count of unique values in the merged array and use that when calling the btree_au validation function + + we in-order walk and check that what we have in the tree matches what we have in the merged array + and then check the fail counts + */ + + internal_display_test_name( "Random adds and walking (overwrite on existing key)" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->baus = &baus; + (ts+loop)->element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + (ts+loop)->number_elements = number_elements; + (ts+loop)->insert_existing_count = 0; + + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); + ((ts+loop)->element_array+subloop)->key = (lfds700_pal_uint_t) floor( (number_elements/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); + } + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : now for validation + make an array equal to number_elements, set all to 0 + iterate over every per-thread array, counting the number of each value into this array + so we can know how many elements ought to have failed to be inserted + as well as being able to work out the actual number of elements which should be present in the btree, for the btree validation call + */ + + key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); + for( loop = 0 ; loop < number_elements ; loop++ ) + *(key_count_array+loop) = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + ( *(key_count_array+( (ts+loop)->element_array+subloop)->key) )++; + + // TRD : first, btree validation function + vi.min_elements = number_elements; + + for( loop = 0 ; loop < number_elements ; loop++ ) + if( *(key_count_array+loop) == 0 ) + vi.min_elements--; + + vi.max_elements = vi.min_elements; + + lfds700_btree_au_query( &baus, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + /* TRD : now check the sum of per-thread insert failures + is what it should be, which is the sum of key_count_array, + but with every count minus one (for the single succesful insert) + and where elements of 0 are ignored (i.e. do not have -1 applied) + */ + + expected_sum_insert_existing_count = 0; + + for( loop = 0 ; loop < number_elements ; loop++ ) + if( *(key_count_array+loop) != 0 ) + expected_sum_insert_existing_count += *(key_count_array+loop) - 1; + + actual_sum_insert_existing_count = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + actual_sum_insert_existing_count += (ts+loop)->insert_existing_count; + + if( expected_sum_insert_existing_count != actual_sum_insert_existing_count ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + /* TRD : now compared the combined array and an in-order walk of the tree + ignoring array elements with the value 0, we should find an exact match + */ + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + { + // TRD : in-order walk over btree_au and check key_count_array matches + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(&baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) + { + key = LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( *baue ); + + while( *(key_count_array+index) == 0 ) + index++; + + if( index++ != (lfds700_pal_uint_t) key ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + } + + // TRD : cleanup + free( key_count_array ); + + lfds700_btree_au_cleanup( &baus, NULL ); + + // TRD : cleanup + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->element_array ); + + free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "btree_au", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *key_in_tree ) +{ + int + cr = 0; + + // TRD : key_new can be any value in its range + // TRD : key_in_tree can be any value in its range + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) +{ + enum lfds700_btree_au_insert_result + alr; + + lfds700_pal_uint_t + index = 0; + + struct test_state + *ts; + + struct lfds700_btree_au_element + *existing_baue; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( index < ts->number_elements ) + { + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( (ts->element_array+index)->baue, (ts->element_array+index)->key ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->baue, 0 ); + alr = lfds700_btree_au_insert( ts->baus, &(ts->element_array+index)->baue, &existing_baue, &ps ); + + if( alr == LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ) + ts->insert_existing_count++; + + index++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c new file mode 100644 index 0000000000..1968ae7167 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c @@ -0,0 +1,33 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_freelist( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + { + printf( "\n" + "Freelist Tests\n" + "==============\n" ); + + test_lfds700_freelist_alignment(); + test_lfds700_freelist_popping( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_freelist_pushing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_freelist_popping_and_pushing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_freelist_rapid_popping_and_pushing( list_of_logical_processors ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c new file mode 100644 index 0000000000..885ecbf8c4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c @@ -0,0 +1,43 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_freelist_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_freelist_state + if( offsetof(struct lfds700_freelist_state,top) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_freelist_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c new file mode 100644 index 0000000000..6dcbd0847a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c @@ -0,0 +1,205 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_freelist_state + *fs; +}; + +struct test_element +{ + struct lfds700_freelist_element + fe; + + enum flag + popped_flag; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_freelist_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_freelist_state + fs; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a freelist with 1,000,000 elements + + the creation function runs in a single thread and creates + and pushes those elements onto the freelist + + each element contains a void pointer to the container test element + + we then run one thread per CPU + where each thread loops, popping as quickly as possible + each test element has a flag which indicates it has been popped + + the threads run till the source freelist is empty + + we then check the test elements + every element should have been popped + + then tidy up + + we have no extra code for CAS/GC as we're only popping + */ + + internal_display_test_name( "Popping" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements ; loop++ ) + { + (te_array+loop)->popped_flag = LOWERED; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); + lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); + } + + ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->fs = &fs; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_freelist_query( &fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + // TRD : now we check each element has popped_flag set to RAISED + for( loop = 0 ; loop < number_elements ; loop++ ) + if( (te_array+loop)->popped_flag == LOWERED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : cleanup + lfds700_freelist_cleanup( &fs, NULL ); + util_aligned_free( ts ); + util_aligned_free( te_array ); + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ) +{ + struct lfds700_freelist_element + *fe; + + struct lfds700_misc_prng_state + ps; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( lfds700_freelist_pop(ts->fs, &fe, &ps) ) + { + te = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + te->popped_flag = RAISED; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c new file mode 100644 index 0000000000..8c411151d3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c @@ -0,0 +1,319 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element; + +struct test_state +{ + struct lfds700_freelist_state + fs_thread_local, + *fs; + + lfds700_pal_uint_t + number_elements; + + struct test_element + *fs_thread_local_te_array; +}; + +struct test_element +{ + struct lfds700_freelist_element + fe, + thread_local_fe; + + lfds700_pal_uint_t + datum; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_freelist_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_freelist_state + fs; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we have two threads per CPU + the threads loop for ten seconds + the first thread pushes 10000 elements then pops 10000 elements + the second thread pops 10000 elements then pushes 10000 elements + all pushes and pops go onto the single main freelist + with a per-thread local freelist to store the pops + + after time is up, all threads push what they have remaining onto + the main freelist + + we then validate the main freelist + */ + + internal_display_test_name( "Popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors * 2 ); + + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + // TRD : we allocate half the total elements here, and half again later, which is why *2 above, but not here + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + // TRD : initial elements in the main freelist so the popping threads can start immediately + for( loop = 0 ; loop < number_elements * number_logical_processors ; loop++ ) + { + (te_array+loop)->datum = loop; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); + lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); + } + + ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors * 2, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + // TRD : first set of threads (poppers) + (ts+loop)->fs = &fs; + (ts+loop)->number_elements = number_elements; + lfds700_freelist_init_valid_on_current_logical_core( &(ts+loop)->fs_thread_local, NULL ); + + // TRD : second set of threads (pushers - who need elements in their per-thread freelists) + (ts+loop+number_logical_processors)->fs = &fs; + (ts+loop+number_logical_processors)->number_elements = number_elements; + lfds700_freelist_init_valid_on_current_logical_core( &(ts+loop+number_logical_processors)->fs_thread_local, NULL ); + + // TRD : fill the pushing thread freelists + (ts+loop+number_logical_processors)->fs_thread_local_te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + ((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->datum = loop; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( ((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->thread_local_fe, (ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop ); + lfds700_freelist_push( &(ts+loop+number_logical_processors)->fs_thread_local, &((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->thread_local_fe, &ps ); + } + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); + + util_thread_starter_new( &tts, number_logical_processors * 2 ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping_and_pushing_start_popping, ts+loop ); + util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, thread_popping_and_pushing_start_pushing, ts+loop+number_logical_processors ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors * 2; + + lfds700_freelist_query( &fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + lfds700_freelist_cleanup( &fs, NULL ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + lfds700_freelist_cleanup( &(ts+loop)->fs_thread_local, NULL ); + lfds700_freelist_cleanup( &(ts+loop+number_logical_processors)->fs_thread_local, NULL ); + util_aligned_free( (ts+loop+number_logical_processors)->fs_thread_local_te_array ); + } + + util_aligned_free( ts ); + + util_aligned_free( te_array ); + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + count; + + struct lfds700_freelist_element + *fe; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + struct test_state + *ts; + + time_t + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + start_time = time( NULL ); + + while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) + { + count = 0; + + while( count < ts->number_elements ) + if( lfds700_freelist_pop(ts->fs, &fe, &ps) ) + { + // TRD : we do nothing with the test data, so there'ss no GET or SET here + lfds700_freelist_push( &ts->fs_thread_local, fe, &ps ); + count++; + } + + // TRD : return our local freelist to the main freelist + while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) + lfds700_freelist_push( ts->fs, fe, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + count; + + struct lfds700_freelist_element + *fe; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + start_time = time( NULL ); + + while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) + { + // TRD : return our local freelist to the main freelist + while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) + lfds700_freelist_push( ts->fs, fe, &ps ); + + count = 0; + + while( count < ts->number_elements ) + if( lfds700_freelist_pop(ts->fs, &fe, &ps) ) + { + lfds700_freelist_push( &ts->fs_thread_local, fe, &ps ); + count++; + } + } + + // TRD : now push whatever we have in our local freelist + while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) + lfds700_freelist_push( ts->fs, fe, &ps ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c new file mode 100644 index 0000000000..0e756c5e2d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c @@ -0,0 +1,246 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + number_elements, + thread_number; + + struct lfds700_freelist_state + *fs; + + struct test_element + *te_array; +}; + +struct test_element +{ + struct lfds700_freelist_element + fe; + + lfds700_pal_uint_t + datum, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_freelist_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_freelist_element + *fe; + + struct lfds700_freelist_state + fs; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te, + *first_te = NULL; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create an empty freelist + + we then create one thread per CPU, where each thread + pushes 100,000 elements each as quickly as possible to the freelist + + the data pushed is a counter and a thread ID + + the threads exit when the freelist is full + + we then validate the freelist; + + checking that the counts increment on a per unique ID basis + and that the number of elements we pop equals 100,000 per thread + (since each element has an incrementing counter which is + unique on a per unique ID basis, we can know we didn't lose + any elements) + */ + + internal_display_test_name( "Pushing" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + // TRD : the main freelist + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->fs = &fs; + (ts+loop)->thread_number = loop; + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_pushing, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = number_elements - 1; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_freelist_query( &fs, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_freelist_pop(&fs, &fe, &ps) ) + { + te = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + + if( first_te == NULL ) + first_te = te; + + if( te->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( te->datum > per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->datum < per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( te->datum == per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number]--; + } + + // TRD : clean up + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->te_array ); + + free( per_thread_counters ); + + free( ts ); + + lfds700_freelist_cleanup( &fs, NULL ); + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + (ts->te_array+loop)->thread_number = ts->thread_number; + (ts->te_array+loop)->datum = loop; + } + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->fe, ts->te_array+loop ); + lfds700_freelist_push( ts->fs, &(ts->te_array+loop)->fe, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c new file mode 100644 index 0000000000..15a0f9fd69 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c @@ -0,0 +1,216 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_freelist_state + *fs; +}; + +struct test_element +{ + struct lfds700_freelist_element + fe; + + lfds700_pal_uint_t + datum; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_freelist_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_freelist_state + fs; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + + /* TRD : in these tests there is a fundamental antagonism between + how much checking/memory clean up that we do and the + likelyhood of collisions between threads in their lock-free + operations + + the lock-free operations are very quick; if we do anything + much at all between operations, we greatly reduce the chance + of threads colliding + + so we have some tests which do enough checking/clean up that + they can tell the freelist is valid and don't leak memory + and here, this test now is one of those which does minimal + checking - in fact, the nature of the test is that you can't + do any real checking - but goes very quickly + + what we do is create a small freelist and then run one thread + per CPU, where each thread simply pushes and then immediately + pops + + the test runs for ten seconds + + after the test is done, the only check we do is to traverse + the freelist, checking for loops and ensuring the number of + elements is correct + */ + + internal_display_test_name( "Rapid popping and pushing (10 seconds)" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->fs = &fs; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + // TRD : we need one element per thread + te_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); + lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); + } + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_popping_and_pushing, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_logical_processors; + + lfds700_freelist_query( &fs, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + lfds700_freelist_cleanup( &fs, NULL ); + + util_aligned_free( te_array ); + + free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_freelist_element + *fe; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_freelist_pop( ts->fs, &fe, &ps ); + lfds700_freelist_push( ts->fs, fe, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c new file mode 100644 index 0000000000..eeb98727c5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c @@ -0,0 +1,33 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_hash_a( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) + { + printf( "\n" + "Hash (add-only) Tests\n" + "=====================\n" ); + + test_lfds700_hash_a_alignment(); + test_lfds700_hash_a_fail_and_overwrite_on_existing_key(); + test_lfds700_hash_a_random_adds_fail_on_existing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_hash_a_random_adds_overwrite_on_existing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_hash_a_iterate(); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c new file mode 100644 index 0000000000..2d0a0a5b8e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c @@ -0,0 +1,40 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_hash_a_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_hash_a_element + if( offsetof(struct lfds700_hash_a_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c new file mode 100644 index 0000000000..cf4899e31b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c @@ -0,0 +1,224 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_btree_au_element + baue; + + lfds700_pal_uint_t + datum; +}; + +struct test_state +{ + enum lfds700_misc_flag + error_flag; + + struct lfds700_hash_a_state + *has; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int key_compare_function( void const *new_key, void const *existing_key ); +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); + + + + + +/****************************************************************************/ +void test_lfds700_hash_a_iterate( void ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + *counter_array, + loop; + + struct lfds700_hash_a_element + *hae; + + struct lfds700_hash_a_iterate + hai; + + struct lfds700_hash_a_state + has; + + struct lfds700_hash_a_element + *element_array; + + struct lfds700_btree_au_state + *baus; + + struct lfds700_misc_prng_state + ps; + + void + *value; + + /* TRD : single-threaded test + we create a single hash_a + we populate with 1000 elements + where key and value is the number of the element (e.g. 0 to 999) + we then allocate 1000 counters, init to 0 + we then iterate + we increment each element as we see it in the iterate + if any are missing or seen more than once, problemo! + + we do this once with a table of 10, to ensure each table has (or almost certainly has) something in + and then a second tiem with a table of 10000, to ensure some empty tables exist + */ + + internal_display_test_name( "Iterate" ); + + lfds700_misc_prng_init( &ps ); + + element_array = util_aligned_malloc( sizeof(struct lfds700_hash_a_element) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + counter_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * 1000 ); + + // TRD : first time around + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); + + for( loop = 0 ; loop < 1000 ; loop++ ) + { + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( *(element_array+loop), loop ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( *(element_array+loop), loop ); + lfds700_hash_a_insert( &has, element_array+loop, NULL, &ps ); + } + + for( loop = 0 ; loop < 1000 ; loop++ ) + *(counter_array+loop) = 0; + + lfds700_hash_a_iterate_init( &has, &hai ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) + { + value = LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); + ( *(counter_array + (lfds700_pal_uint_t) value) )++; + } + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + for( loop = 0 ; loop < 1000 ; loop++ ) + { + if( *(counter_array+loop) > 1 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( *(counter_array+loop) == 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + } + + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + + // TRD : second time around + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + { + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); + + for( loop = 0 ; loop < 1000 ; loop++ ) + { + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( *(element_array+loop), loop ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( *(element_array+loop), loop ); + lfds700_hash_a_insert( &has, element_array+loop, NULL, &ps ); + } + + for( loop = 0 ; loop < 1000 ; loop++ ) + *(counter_array+loop) = 0; + + lfds700_hash_a_iterate_init( &has, &hai ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) + { + value = LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); + ( *(counter_array + (lfds700_pal_uint_t) value ) )++; + } + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + for( loop = 0 ; loop < 1000 ; loop++ ) + { + if( *(counter_array+loop) > 1 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( *(counter_array+loop) == 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + } + + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + } + + // TRD : cleanup + util_aligned_free( element_array ); + free( counter_array ); + + // TRD : print the test result + internal_display_test_result( 1, "hash_a", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *existing_key ) +{ + int + cr = 0; + + // TRD : new_key can be NULL (i.e. 0) + // TRD : existing_key can be NULL (i.e. 0) + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) +{ + // TRD : key can be NULL + assert( hash != NULL ); + + *hash = 0; + + /* TRD : this function iterates over the user data + and we are using the void pointer AS user data + so here we need to pass in the addy of value + */ + + LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c new file mode 100644 index 0000000000..5d36e47a31 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c @@ -0,0 +1,314 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_hash_a_element + hae; + + lfds700_pal_uint_t + datum, + key; +}; + +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + number_elements_per_thread; + + struct lfds700_hash_a_state + *has; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); +static int key_compare_function( void const *new_key, void const *existing_key ); +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); + + + + + +/****************************************************************************/ +void test_lfds700_hash_a_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements_per_thread, + number_elements_total, + number_logical_processors, + offset, + temp, + value; + + struct lfds700_hash_a_element + *hae; + + struct lfds700_hash_a_state + has; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_btree_au_state + *baus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single hash_a + we generate 100k elements per thread (with one thread per logical processor) in an array + each element is unique + we randomly sort the elements + then each thread loops, adds those elements into the hash_a + we check that each datum inserts okay - failure will occur on non-unique data, i.e. two identical keys + we should have no failures + we then call the hash_a validation function + then using the hash_a get() we check all the elements we added are present + */ + + internal_display_test_name( "Random adds and get (fail on existing key)" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 1000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); + + number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + number_elements_total = number_elements_per_thread * number_logical_processors; + + // TRD : created an ordered list of unique numbers + element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + (element_array+loop)->key = loop; + // TRD : + number_elements just to make it different to the key + (element_array+loop)->datum = loop + number_elements_total; + } + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + offset = LFDS700_MISC_PRNG_GENERATE( &ps ); + offset %= number_elements_total; + temp = (element_array + offset)->key; + (element_array + offset)->key = (element_array + loop)->key; + (element_array + loop)->key = temp; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->has = &has; + (ts+loop)->element_array = element_array + number_elements_per_thread*loop; + (ts+loop)->error_flag = LOWERED; + (ts+loop)->number_elements_per_thread = number_elements_per_thread; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : now for validation + vi.min_elements = vi.max_elements = number_elements_total; + lfds700_hash_a_query( &has, LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + /* TRD : now we attempt to lfds700_hash_a_get_by_key() for every element in number_array + any failure to find is an error + we also check we've obtained the correct element + */ + + for( loop = 0 ; dvs == LFDS700_MISC_VALIDITY_VALID and loop < number_elements_total ; loop++ ) + if( 0 == lfds700_hash_a_get_by_key(&has, (void *) (ts->element_array+loop)->key, &hae) ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + else + { + value = (lfds700_pal_uint_t) LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); + if( (ts->element_array+loop)->datum != value ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + + // TRD : just check error_flags weren't raised + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : cleanup + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + + free( ts ); + + util_aligned_free( element_array ); + + // TRD : print the test result + internal_display_test_result( 1, "hash_a", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) +{ + enum lfds700_hash_a_insert_result + apr; + + lfds700_pal_uint_t + index = 0; + + struct test_state + *ts; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( index < ts->number_elements_per_thread ) + { + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->key ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->datum ); + apr = lfds700_hash_a_insert( ts->has, &(ts->element_array+index)->hae, NULL, &ps ); + + if( apr == LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY ) + ts->error_flag = RAISED; + + index++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *existing_key ) +{ + int + cr = 0; + + // TRD : new_key can be NULL (i.e. 0) + // TRD : existing_key can be NULL (i.e. 0) + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) +{ + // TRD : key can be NULL + assert( hash != NULL ); + + *hash = 0; + + /* TRD : this function iterates over the user data + and we are using the void pointer *as* key data + so here we need to pass in the addy of key + */ + + LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c new file mode 100644 index 0000000000..cc18900273 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c @@ -0,0 +1,137 @@ +/***** includes *****/ +#include "internal.h" + +/***** private prototypes *****/ +static int key_compare_function( void const *new_value, void const *value_in_tree ); +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); + + + + + +/****************************************************************************/ +void test_lfds700_hash_a_fail_and_overwrite_on_existing_key() +{ + enum lfds700_hash_a_insert_result + apr; + + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + struct lfds700_hash_a_element + hae_one, + hae_two; + + struct lfds700_hash_a_state + has; + + struct lfds700_btree_au_state + *baus; + + struct lfds700_misc_prng_state + ps; + + internal_display_test_name( "Fail and overwrite on existing key" ); + + lfds700_misc_prng_init( &ps ); + + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + // TRD : fail on overwrite + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); + + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_one, 1 ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_one, 0 ); + apr = lfds700_hash_a_insert( &has, &hae_one, NULL, &ps ); + + if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_two, 1 ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_two, 1 ); + apr = lfds700_hash_a_insert( &has, &hae_two, NULL, &ps ); + + if( apr != LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + lfds700_hash_a_cleanup( &has, NULL ); + + // TRD : success on overwrite + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, NULL ); + + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_one, 1 ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_one, 1 ); + apr = lfds700_hash_a_insert( &has, &hae_one, NULL, &ps ); + + if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_two, 1 ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_two, 1 ); + apr = lfds700_hash_a_insert( &has, &hae_two, NULL, &ps ); + + if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + + // TRD : print the test result + internal_display_test_result( 1, "hash_a", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *key_in_tree ) +{ + int + cr = 0; + + // TRD : key_new can be any value in its range + // TRD : key_in_tree can be any value in its range + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) +{ + // TRD : key can be NULL + assert( hash != NULL ); + + *hash = 0; + + /* TRD : this function iterates over the user data + and we are using the void pointer *as* key data + so here we need to pass in the addy of key + */ + + LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c new file mode 100644 index 0000000000..29c5fae865 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c @@ -0,0 +1,388 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_hash_a_element + hae; + + lfds700_pal_uint_t + key; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements_per_thread, + overwrite_count; + + struct lfds700_hash_a_state + *has; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); +static int key_compare_function( void const *new_key, void const *existing_key ); +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); +static int qsort_and_bsearch_key_compare_function( void const *e1, void const *e2 ); + + + + + +/****************************************************************************/ +void test_lfds700_hash_a_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + int + rv; + + lfds700_pal_uint_t + actual_sum_overwrite_existing_count, + expected_sum_overwrite_existing_count, + *key_count_array, + loop, + number_elements_per_thread, + number_elements_total, + number_logical_processors, + random_value; + + struct lfds700_hash_a_iterate + hai; + + struct lfds700_hash_a_element + *hae; + + struct lfds700_hash_a_state + has; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_btree_au_state + *baus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + void + *key_pointer, + *key; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single hash_a + we generate n elements per thread + each element contains a key value, which is set to a random value + (we don't use value, so it's just set to 0) + the threads then run, putting + the threads count their number of overwrite hits + once the threads are done, then we + count the number of each key + from this we figure out the min/max element for hash_a validation, so we call validation + we check the sum of overwrites for each thread is what it should be + then using the hash_a get() we check all the elements we expect are present + and then we iterate over the hash_a + checking we see each key once + */ + + internal_display_test_name( "Random adds, get and iterate (overwrite on existing key)" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 1000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, NULL ); + + // TRD : we divide by 2 beccause we have to allocate a second array of this size later + number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ) / 2; + number_elements_total = number_elements_per_thread * number_logical_processors; + + // TRD : created an ordered list of unique numbers + element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); + (element_array+loop)->key = (lfds700_pal_uint_t) floor( (number_elements_total/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->has = &has; + (ts+loop)->element_array = element_array + number_elements_per_thread*loop; + (ts+loop)->overwrite_count = 0; + (ts+loop)->number_elements_per_thread = number_elements_per_thread; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : now for validation + key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements_total ); + for( loop = 0 ; loop < number_elements_total ; loop++ ) + *(key_count_array+loop) = 0; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + ( *(key_count_array + (element_array+loop)->key) )++; + + vi.min_elements = number_elements_total; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + if( *(key_count_array+loop) == 0 ) + vi.min_elements--; + + vi.max_elements = vi.min_elements; + + lfds700_hash_a_query( &has, LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + expected_sum_overwrite_existing_count = 0; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + if( *(key_count_array+loop) != 0 ) + expected_sum_overwrite_existing_count += *(key_count_array+loop) - 1; + + actual_sum_overwrite_existing_count = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + actual_sum_overwrite_existing_count += (ts+loop)->overwrite_count; + + if( expected_sum_overwrite_existing_count != actual_sum_overwrite_existing_count ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : now loop over the expected array and check we can get() every element + for( loop = 0 ; loop < number_elements_total ; loop++ ) + if( *(key_count_array+loop) > 0 ) + { + rv = lfds700_hash_a_get_by_key( &has, (void *) loop, &hae ); + + if( rv != 1 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + + /* TRD : now iterate, checking we find every element and no others + to do this in a timely manner, we need to qsort() the key values + and use bsearch() to check for items in the array + */ + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + if( *(key_count_array+loop) != 0 ) + *(key_count_array+loop) = loop; + else + *(key_count_array+loop) = 0; + + qsort( key_count_array, number_elements_total, sizeof(lfds700_pal_uint_t), qsort_and_bsearch_key_compare_function ); + + lfds700_hash_a_iterate_init( &has, &hai ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) + { + key = LFDS700_HASH_A_GET_KEY_FROM_ELEMENT( *hae ); + + key_pointer = bsearch( &key, key_count_array, number_elements_total, sizeof(lfds700_pal_uint_t), qsort_and_bsearch_key_compare_function ); + + if( key_pointer == NULL ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + + // TRD : cleanup + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + + free( ts ); + + util_aligned_free( element_array ); + + free( key_count_array ); + + // TRD : print the test result + internal_display_test_result( 1, "hash_a", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) +{ + enum lfds700_hash_a_insert_result + apr; + + lfds700_pal_uint_t + index = 0; + + struct test_state + *ts; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( index < ts->number_elements_per_thread ) + { + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->key ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->hae, 0 ); + apr = lfds700_hash_a_insert( ts->has, &(ts->element_array+index)->hae, NULL, &ps ); + + if( apr == LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE ) + ts->overwrite_count++; + + index++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *existing_key ) +{ + int + cr = 0; + + // TRD : new_key can be NULL (i.e. 0) + // TRD : existing_key can be NULL (i.e. 0) + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) +{ + // TRD : key can be NULL + assert( hash != NULL ); + + *hash = 0; + + /* TRD : this function iterates over the user data + and we are using the void pointer *as* key data + so here we need to pass in the addy of key + */ + + LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); + + return; +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static int qsort_and_bsearch_key_compare_function( void const *e1, void const *e2 ) +{ + int + cr = 0; + + lfds700_pal_uint_t + s1, + s2; + + s1 = *(lfds700_pal_uint_t *) e1; + s2 = *(lfds700_pal_uint_t *) e2; + + if( s1 > s2 ) + cr = 1; + + if( s1 < s2 ) + cr = -1; + + return( cr ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c new file mode 100644 index 0000000000..5720aa2428 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c @@ -0,0 +1,31 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_list_aos( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) + { + printf( "\n" + "List (add-only, ordered, singly-linked) Tests\n" + "=============================================\n" ); + + test_lfds700_list_aos_alignment(); + test_lfds700_list_aos_new_ordered( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_aos_new_ordered_with_cursor( list_of_logical_processors, memory_in_megabytes ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c new file mode 100644 index 0000000000..7726346366 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c @@ -0,0 +1,58 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_list_aos_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_list_aos_element + if( offsetof(struct lfds700_list_aos_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_aos_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_aos_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : struct lfds700_list_asu_state + if( offsetof(struct lfds700_list_aos_state,start) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_aos_state,dummy_element) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_aos_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "list_aos", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c new file mode 100644 index 0000000000..3a392b33bd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c @@ -0,0 +1,278 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_aos_element + laose; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements_per_thread; + + struct lfds700_list_aos_state + *laoss; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int new_ordered_compare_function( void const *value_new, void const *value_in_list ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_aos_new_ordered( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + expected_element_number, + number_elements_per_thread, + number_elements_total, + number_logical_processors, + offset, + temp; + + struct lfds700_list_aos_element + *laose = NULL; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_list_aos_state + laoss; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct test_element + *element_array, + *element; + + struct test_state + *ts; + + struct util_thread_starter_state + *tts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run one thread per logical processor + we have a single array of 10k elements per thread + this is set to be randomly ordered (but with contigious numbers from 0 to n) + we give 10k to each thread (a pointer into the array at the correct point) + which then loops through that array + calling lfds700_list_aos_insert_element_by_position( LFDS700_LIST_AOS_POSITION_ORDERED ) + verification should show list is sorted + */ + + internal_display_test_name( "New ordered" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_list_aos_init_valid_on_current_logical_core( &laoss, new_ordered_compare_function, LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, NULL ); + + /* TRD : create randomly ordered number array with unique elements + + unique isn't necessary - the list will sort anyway - but + it permits slightly better validation + */ + + number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + // TRD : or the test takes a looooooong time... + if( number_elements_per_thread > 10000 ) + number_elements_per_thread = 10000; + + number_elements_total = number_elements_per_thread * number_logical_processors; + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + (element_array+loop)->element_number = loop; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + offset = LFDS700_MISC_PRNG_GENERATE( &ps ); + offset %= number_elements_total; + temp = (element_array + offset)->element_number; + (element_array + offset)->element_number = (element_array + loop)->element_number; + (element_array + loop)->element_number = temp; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->laoss = &laoss; + (ts+loop)->element_array = element_array + (loop*number_elements_per_thread); + (ts+loop)->number_elements_per_thread = number_elements_per_thread; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_ordered_thread, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + free( ts ); + + /* TRD : validate the resultant list + iterate over the list + we expect to find the list is sorted, + which means that element_number will + increment from zero + */ + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements_total; + + lfds700_list_aos_query( &laoss, LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + { + expected_element_number = 0; + + // TRD : traverse the list and check combined_data_array matches + while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(laoss, laose) ) + { + element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); + + if( element->element_number != expected_element_number++ ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + } + + lfds700_list_aos_cleanup( &laoss, NULL ); + + util_aligned_free( element_array ); + + internal_display_test_result( 1, "list_aos", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int new_ordered_compare_function( void const *value_new, void const *value_in_list ) +{ + int + cr = 0; + + struct test_element + *e1, + *e2; + + // TRD : value_new can be any value in its range + // TRD : value_in_list can be any value in its range + + e1 = (struct test_element *) value_new; + e2 = (struct test_element *) value_in_list; + + if( e1->element_number < e2->element_number ) + cr = -1; + + if( e1->element_number > e2->element_number ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements_per_thread ; loop++ ) + { + LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); + LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); + lfds700_list_aos_insert( ts->laoss, &(ts->element_array+loop)->laose, NULL, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c new file mode 100644 index 0000000000..42e0ebc7a5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c @@ -0,0 +1,366 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_aos_element + laose; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + number_elements_per_thread; + + struct lfds700_list_aos_state + *laoss; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int new_ordered_with_cursor_compare_function( void const *value_new, void const *value_in_list ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_insert_thread( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_cursor_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_aos_new_ordered_with_cursor( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements_per_thread, + number_elements_total, + number_logical_processors, + offset, + temp; + + struct lfds700_list_aos_state + laoss; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run two threads per logical processor + + the test runs for 10 seconds + + the first thread loops over a pre-set list of random numbers + continually adding them using ordered insert + + the second thread keeps iterating over the list, checking that + each element is larger than its predecessor + */ + + internal_display_test_name( "New ordered with cursor (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_list_aos_init_valid_on_current_logical_core( &laoss, new_ordered_with_cursor_compare_function, LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, NULL ); + + /* TRD : create randomly ordered number array with unique elements + + unique isn't necessary - the list will sort anyway - but + it permits slightly better validation + */ + + number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + // TRD : or the test takes a looooooong time... + if( number_elements_per_thread > 1000 ) + number_elements_per_thread = 1000; + + number_elements_total = number_elements_per_thread * number_logical_processors; + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + (element_array+loop)->element_number = loop; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + offset = LFDS700_MISC_PRNG_GENERATE( &ps ); + offset %= number_elements_total; + temp = (element_array + offset)->element_number; + (element_array + offset)->element_number = (element_array + loop)->element_number; + (element_array + loop)->element_number = temp; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors * 2 ); + + // TRD : the insert threads + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->laoss = &laoss; + (ts+loop)->element_array = element_array + number_elements_per_thread*loop; + (ts+loop)->error_flag = LOWERED; + (ts+loop)->number_elements_per_thread = number_elements_per_thread; + } + + // TRD : the cursor threads + for( loop = number_logical_processors ; loop < number_logical_processors * 2 ; loop++ ) + { + (ts+loop)->laoss = &laoss; + (ts+loop)->element_array = NULL; + (ts+loop)->error_flag = LOWERED; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); + + util_thread_starter_new( &tts, number_logical_processors * 2 ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_ordered_with_cursor_insert_thread, ts+loop ); + util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, new_ordered_with_cursor_cursor_thread, ts+loop+number_logical_processors ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + /* TRD : validate the resultant list + + the cursor threads were checking for orderedness + if that failed, they raise their error_flag + so validate the list, then check error_flags + */ + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements_total; + + lfds700_list_aos_query( &laoss, LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + for( loop = number_logical_processors ; loop < number_logical_processors * 2 ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ORDER; + + lfds700_list_aos_cleanup( &laoss, NULL ); + + util_aligned_free( element_array ); + + free( ts ); + + internal_display_test_result( 1, "list_aos", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int new_ordered_with_cursor_compare_function( void const *value_new, void const *value_in_list ) +{ + int + cr = 0; + + struct test_element + *e1, + *e2; + + // TRD : value_new can be any value in its range + // TRD : value_in_list can be any value in its range + + e1 = (struct test_element *) value_new; + e2 = (struct test_element *) value_in_list; + + if( e1->element_number < e2->element_number ) + cr = -1; + + if( e1->element_number > e2->element_number ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_insert_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements_per_thread ; loop++ ) + { + LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); + LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); + lfds700_list_aos_insert( ts->laoss, &(ts->element_array+loop)->laose, NULL, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_cursor_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + prev_element_number; + + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_list_aos_element + *laose; + + struct test_element + *element; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + prev_element_number = 0; + + laose = LFDS700_LIST_AOS_GET_START( *ts->laoss ); + + // TRD : we may get start before any element has been added to the list + if( laose == NULL ) + continue; + + element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); + + if( element->element_number < prev_element_number ) + ts->error_flag = RAISED; + + prev_element_number = element->element_number; + + laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); + + while( laose != NULL ) + { + element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); + + if( element->element_number <= prev_element_number ) + ts->error_flag = RAISED; + + prev_element_number = element->element_number; + + laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); + } + + if( time_loop++ == REDUCED_TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c new file mode 100644 index 0000000000..37c37f2529 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c @@ -0,0 +1,32 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_list_asu( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) + { + printf( "\n" + "List (add-only, singly-linked, unordered) Tests\n" + "===============================================\n" ); + + test_lfds700_list_asu_alignment(); + test_lfds700_list_asu_new_start( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_asu_new_end( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_asu_new_after( list_of_logical_processors, memory_in_megabytes ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c new file mode 100644 index 0000000000..43f451d4bf --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c @@ -0,0 +1,61 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_list_asu_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_list_asu_element + if( offsetof(struct lfds700_list_asu_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : struct lfds700_list_asu_state + if( offsetof(struct lfds700_list_asu_state,end) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_state,start) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_state,dummy_element) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "list_asu", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c new file mode 100644 index 0000000000..5dcd6954aa --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c @@ -0,0 +1,254 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_asu_element + lasue; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements; + + struct lfds700_list_asu_state + *lasus; + + struct test_element + *element_array; + + struct lfds700_list_asu_element + *first_element; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_after_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_asu_new_after( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters, + subloop; + + struct lfds700_list_asu_element + *lasue, + first_element; + + struct lfds700_list_asu_state + lasus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array, + *element; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run one thread per logical processor + run for 250k elements + we put a single first element into the list and + each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_AFTER ), + inserting after the single first element + data element contain s thread_number and element_number + verification should show element_number decreasing on a per thread basis + */ + + internal_display_test_name( "New after" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); + + LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( first_element, NULL ); + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( first_element, NULL ); + lfds700_list_asu_insert_at_position( &lasus, &first_element, NULL, LFDS700_LIST_ASU_POSITION_START, &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + (element_array+(loop*number_elements)+subloop)->thread_number = loop; + (element_array+(loop*number_elements)+subloop)->element_number = subloop; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + {\ + (ts+loop)->lasus = &lasus; + (ts+loop)->element_array = element_array + (loop*number_elements); + (ts+loop)->first_element = &first_element; + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_after_thread, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + free( ts ); + + /* TRD : validate the resultant list + iterate over each element + we expect to find element numbers increment on a per thread basis + */ + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors + 1; + + lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = number_elements - 1; + + /* TRD : we have a leading element, after which all inserts occurred + we need to get past that element for validation + this is why we're not using lfds700_list_asu_get_start_and_then_next() + */ + + lasue = LFDS700_LIST_ASU_GET_START( lasus ); + + lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lasue != NULL ) + { + element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + if( element->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( element->element_number < per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( element->element_number > per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( element->element_number == per_thread_counters[element->thread_number] ) + per_thread_counters[element->thread_number]--; + + lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); + } + + free( per_thread_counters ); + + lfds700_list_asu_cleanup( &lasus, NULL ); + + util_aligned_free( element_array ); + + internal_display_test_result( 1, "list_asu", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_after_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, ts->first_element, LFDS700_LIST_ASU_POSITION_AFTER, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c new file mode 100644 index 0000000000..c6c66d007c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c @@ -0,0 +1,229 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_asu_element + lasue; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements; + + struct lfds700_list_asu_state + *lasus; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_end_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_asu_new_end( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters, + subloop; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_list_asu_state + lasus; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array, + *element; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run one thread per logical processor + run for 250k elements + each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_END ) + data element contain a thread_number and element_number + verification should show element_number increasing on a per thread basis + */ + + internal_display_test_name( "New end" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + (element_array+(loop*number_elements)+subloop)->thread_number = loop; + (element_array+(loop*number_elements)+subloop)->element_number = subloop; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->lasus = &lasus; + (ts+loop)->element_array = element_array + (loop*number_elements); + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_end_thread, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + free( ts ); + + /* TRD : validate the resultant list + iterate over each element + we expect to find element numbers increment on a per thread basis + */ + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = 0; + + lasue = NULL; + + while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(lasus, lasue) ) + { + element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + if( element->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( element->element_number > per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( element->element_number < per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( element->element_number == per_thread_counters[element->thread_number] ) + per_thread_counters[element->thread_number]++; + } + + free( per_thread_counters ); + + lfds700_list_asu_cleanup( &lasus, NULL ); + + util_aligned_free( element_array ); + + internal_display_test_result( 1, "list_asu", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_end_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, NULL, LFDS700_LIST_ASU_POSITION_END, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c new file mode 100644 index 0000000000..f4244e2a12 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c @@ -0,0 +1,229 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_asu_element + lasue; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements; + + struct lfds700_list_asu_state + *lasus; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_start_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_asu_new_start( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters, + subloop; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_list_asu_state + lasus; + + struct lfds700_misc_validation_info + vi; + + struct test_element + *element_array, + *element; + + struct test_state + *ts; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run one thread per logical processor + run for 250k elements + each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_START ) + data element contain s thread_number and element_number + verification should show element_number decreasing on a per thread basis + */ + + internal_display_test_name( "New start" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + (element_array+(loop*number_elements)+subloop)->thread_number = loop; + (element_array+(loop*number_elements)+subloop)->element_number = subloop; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->lasus = &lasus; + (ts+loop)->element_array = element_array + (loop*number_elements); + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_start_thread, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + free( ts ); + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : validate the resultant list + iterate over each element + we expect to find element numbers increment on a per thread basis + */ + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = number_elements - 1; + + lasue = NULL; + + while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(lasus, lasue) ) + { + element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + if( element->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( element->element_number < per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( element->element_number > per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( element->element_number == per_thread_counters[element->thread_number] ) + per_thread_counters[element->thread_number]--; + } + + free( per_thread_counters ); + + lfds700_list_asu_cleanup( &lasus, NULL ); + + util_aligned_free( element_array ); + + internal_display_test_result( 1, "list_asu", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_start_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, NULL, LFDS700_LIST_ASU_POSITION_START, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c new file mode 100644 index 0000000000..2f733909a7 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c @@ -0,0 +1,33 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_pal_atomic( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + printf( "\n" + "Abstraction Atomic Tests\n" + "========================\n" ); + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) + test_lfds700_pal_atomic_cas( list_of_logical_processors ); + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + test_lfds700_pal_atomic_dwcas( list_of_logical_processors ); + + if( LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE ) + test_lfds700_pal_atomic_exchange( list_of_logical_processors, memory_in_megabytes ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c new file mode 100644 index 0000000000..543528d99c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c @@ -0,0 +1,176 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_lfds700_pal_atomic_cas_state +{ + lfds700_pal_uint_t + local_counter; + + lfds700_pal_atom_t volatile + *shared_counter; +}; + +/***** private prototyps *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_cas( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_pal_atomic_cas( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + shared_counter; + + lfds700_pal_uint_t + local_total = 0; + + lfds700_pal_uint_t + loop, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_lfds700_pal_atomic_cas_state + *atcs; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + + /* TRD : here we test pal_cas + + we run one thread per CPU + we use pal_cas() to increment a shared counter + every time a thread successfully increments the counter, + it increments a thread local counter + the threads run for ten seconds + after the threads finish, we total the local counters + they should equal the shared counter + */ + + internal_display_test_name( "Atomic CAS" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + shared_counter = 0; + + atcs = util_malloc_wrapper( sizeof(struct test_lfds700_pal_atomic_cas_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (atcs+loop)->shared_counter = &shared_counter; + (atcs+loop)->local_counter = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_cas, atcs+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + // TRD : results + LFDS700_MISC_BARRIER_LOAD; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + local_total += (atcs+loop)->local_counter; + + if( local_total == shared_counter ) + puts( "passed" ); + + if( local_total != shared_counter ) + { + puts( "failed" ); + exit( EXIT_FAILURE ); + } + + // TRD : cleanup + free( atcs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_cas( void *util_thread_starter_thread_state ) +{ + char unsigned + result; + + lfds700_pal_uint_t + loop = 0; + + lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_SINGLE_POINTER) + exchange, + compare; + + struct test_lfds700_pal_atomic_cas_state + *atcs; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + atcs = (struct test_lfds700_pal_atomic_cas_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + while( loop++ < 10000000 ) + { + compare = *atcs->shared_counter; + + do + { + exchange = compare + 1; + LFDS700_PAL_ATOMIC_CAS( atcs->shared_counter, &compare, exchange, LFDS700_MISC_CAS_STRENGTH_WEAK, result ); + } + while( result == 0 ); + + atcs->local_counter++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c new file mode 100644 index 0000000000..4973e73770 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c @@ -0,0 +1,177 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_lfds700_pal_atomic_dwcas_state +{ + lfds700_pal_uint_t + local_counter; + + lfds700_pal_atom_t volatile + (*shared_counter)[2]; +}; + +/***** private prototyps *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dwcas( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_pal_atomic_dwcas( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + lfds700_pal_uint_t + local_total = 0, + loop, + number_logical_processors; + + lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + shared_counter[2] = { 0, 0 }; + + struct lfds700_list_asu_element + *lasue; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_lfds700_pal_atomic_dwcas_state + *atds; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + + /* TRD : here we test pal_dwcas + + we run one thread per CPU + we use pal_dwcas() to increment a shared counter + every time a thread successfully increments the counter, + it increments a thread local counter + the threads run for ten seconds + after the threads finish, we total the local counters + they should equal the shared counter + */ + + internal_display_test_name( "Atomic DWCAS" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + atds = util_malloc_wrapper( sizeof(struct test_lfds700_pal_atomic_dwcas_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (atds+loop)->shared_counter = &shared_counter; + (atds+loop)->local_counter = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_dwcas, atds+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + // TRD : results + LFDS700_MISC_BARRIER_LOAD; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + local_total += (atds+loop)->local_counter; + + if( local_total == shared_counter[0] ) + puts( "passed" ); + + if( local_total != shared_counter[0] ) + { + printf( "%llu != %llu\n", (int long long unsigned) local_total, (int long long unsigned) shared_counter[0] ); + puts( "failed" ); + exit( EXIT_FAILURE ); + } + + // TRD : cleanup + free( atds ); + + return; +} + +#pragma warning( disable : 4702 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dwcas( void *util_thread_starter_thread_state ) +{ + char unsigned + result; + + lfds700_pal_uint_t + loop = 0; + + lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + exchange[2], + compare[2]; + + struct test_lfds700_pal_atomic_dwcas_state + *atds; + + struct util_thread_starter_thread_state + *tsts; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + atds = (struct test_lfds700_pal_atomic_dwcas_state *) tsts->thread_user_state; + + LFDS700_MISC_BARRIER_LOAD; + + util_thread_starter_ready_and_wait( tsts ); + + while( loop++ < 10000000 ) + { + compare[0] = (*atds->shared_counter)[0]; + compare[1] = (*atds->shared_counter)[1]; + + do + { + exchange[0] = compare[0] + 1; + exchange[1] = compare[1]; + LFDS700_PAL_ATOMIC_DWCAS( atds->shared_counter, compare, exchange, LFDS700_MISC_CAS_STRENGTH_WEAK, result ); + } + while( result == 0 ); + + atds->local_counter++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c new file mode 100644 index 0000000000..ba6366e524 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c @@ -0,0 +1,333 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + counter, + *counter_array, + number_elements, + number_logical_processors; + + lfds700_pal_uint_t volatile + *shared_exchange; +}; + +/***** private prototyps *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_exchange( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_atomic_exchange( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_pal_atomic_exchange( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum flag + atomic_exchange_success_flag = RAISED, + exchange_success_flag = RAISED; + + lfds700_pal_uint_t + loop, + *merged_counter_arrays, + number_elements, + number_logical_processors, + subloop; + + lfds700_pal_uint_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + exchange; + + struct lfds700_list_asu_element + *lasue; + + struct test_state + *ts; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : here we test pal_atomic_exchange + + we have one thread per logical core + there is one variable which every thread will exchange to/from + we know the number of logical cores + the threads have a counter each, which begins with their logical core number plus one + (plus one because the exchange counter begins with 0 already in place) + (e.g. thread 0 begins with its counter at 1, thread 1 begins with its counter at 2, etc) + + there is an array per thread of 1 million elements, each a counter, set to 0 + + when running, each thread increments its counter by the number of threads + the threads busy loop, exchanging + every time aa thread pulls a number off the central, shared exchange variable, + it increments the counter for that variable in its thread-local counter array + + (we're not using a global array, because we'd have to be atomic in our increments, + which is a slow-down we don't want) + + at the end, we merge all the counter arrays and if the frequency for a counter is a value + other than 1, the exchange was not atomic + + we perform the test twice, once with pal_atomic_exchange, once with a non-atomic exchange + + we expect the atomic to pass and the non-atomic to fail + */ + + internal_display_test_name( "Atomic exchange" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(lfds700_pal_uint_t) * (number_logical_processors + 1) ); + + merged_counter_arrays = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); + + for( loop = 0 ; loop < number_elements ; loop++ ) + *(merged_counter_arrays+loop) = 0; + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->counter = loop + 1; + (ts+loop)->counter_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + *((ts+loop)->counter_array+subloop) = 0; + (ts+loop)->number_logical_processors = number_logical_processors; + (ts+loop)->shared_exchange = &exchange; + (ts+loop)->number_elements = number_elements; + } + + exchange = 0; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + // TRD : non-atomic + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_exchange, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + LFDS700_MISC_BARRIER_LOAD; + + for( loop = 0 ; loop < number_elements ; loop++ ) + for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) + *(merged_counter_arrays+loop) += *( (ts+subloop)->counter_array+loop ); + + /* TRD : the worker threads exit when their per-thread counter exceeds 1,000,000 + as such the final number_logical_processors numbers are not read + we could change the threads to exit when the number they read exceeds 1,000,000 + but then we'd need an if() in their work-loop, + and we need to go as fast as possible + */ + + for( loop = 0 ; loop < number_elements - number_logical_processors ; loop++ ) + if( *(merged_counter_arrays+loop) != 1 ) + exchange_success_flag = LOWERED; + + // TRD : now for atomic exchange - we need to re-init the data structures + + for( loop = 0 ; loop < number_elements ; loop++ ) + *(merged_counter_arrays+loop) = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + *((ts+loop)->counter_array+subloop) = 0; + + exchange = 0; + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_atomic_exchange, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + for( loop = 0 ; loop < number_elements ; loop++ ) + for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) + *(merged_counter_arrays+loop) += *( (ts+subloop)->counter_array+loop ); + + for( loop = 0 ; loop < number_elements - number_logical_processors ; loop++ ) + if( *(merged_counter_arrays+loop) != 1 ) + atomic_exchange_success_flag = LOWERED; + + // TRD : cleanup + free( merged_counter_arrays ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + free( (ts+loop)->counter_array ); + + util_thread_starter_delete( tts ); + free( thread_handles ); + free( ts ); + + /* TRD : results + + on a single core, atomic and non-atomic exchange should both work + + if we find our non-atomic test passes, then we can't really say anything + about whether or not the atomic test is really working + */ + + LFDS700_MISC_BARRIER_LOAD; + + if( number_logical_processors == 1 ) + { + if( exchange_success_flag == RAISED and atomic_exchange_success_flag == RAISED ) + puts( "passed" ); + + if( exchange_success_flag != RAISED or atomic_exchange_success_flag != RAISED ) + puts( "failed (atomic and non-atomic both failed)" ); + } + + if( number_logical_processors >= 2 ) + { + if( atomic_exchange_success_flag == RAISED and exchange_success_flag == LOWERED ) + puts( "passed" ); + + if( atomic_exchange_success_flag == RAISED and exchange_success_flag == RAISED ) + puts( "indeterminate (atomic and non-atomic both passed)" ); + + if( atomic_exchange_success_flag == LOWERED ) + { + puts( "failed (atomic failed)" ); + exit( EXIT_FAILURE ); + } + } + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_exchange( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + local_counter, + exchange; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + local_counter = ts->counter; + + while( local_counter < ts->number_elements ) + { + exchange = *ts->shared_exchange; + *ts->shared_exchange = local_counter; + + ( *(ts->counter_array + exchange) )++; + + local_counter += ts->number_logical_processors; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_atomic_exchange( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + local_counter, + exchange; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + local_counter = ts->counter; + + while( local_counter < ts->number_elements ) + { + exchange = local_counter; + + LFDS700_PAL_ATOMIC_EXCHANGE( ts->shared_exchange, &exchange ); + + ( *(ts->counter_array + exchange) )++; + + local_counter += ts->number_logical_processors; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c new file mode 100644 index 0000000000..8e41b01b5d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c @@ -0,0 +1,35 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_queue( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + { + printf( "\n" + "Queue Tests\n" + "===========\n" ); + + test_lfds700_queue_alignment(); + test_lfds700_queue_enqueuing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_dequeuing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_enqueuing_and_dequeuing( list_of_logical_processors ); + test_lfds700_queue_rapid_enqueuing_and_dequeuing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_enqueuing_and_dequeuing_with_free( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( list_of_logical_processors ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c new file mode 100644 index 0000000000..6f723825ea --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c @@ -0,0 +1,55 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_queue_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_queue_element + if( offsetof(struct lfds700_queue_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_queue_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : struct lfds700_queue_state + if( offsetof(struct lfds700_queue_state,enqueue) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_queue_state,dequeue) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_queue_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "queue", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c new file mode 100644 index 0000000000..4c660ab3e1 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c @@ -0,0 +1,25 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void test_lfds700_queue_bss( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + printf( "\n" + "Queue (bounded, single consumer, single producer) Tests\n" + "=======================================================\n" ); + + // TRD : no alignment checks are required for queue_bss + test_lfds700_queue_bss_enqueuing(); + test_lfds700_queue_bss_dequeuing(); + test_lfds700_queue_bss_enqueuing_and_dequeuing( list_of_logical_processors ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c new file mode 100644 index 0000000000..971555c443 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c @@ -0,0 +1,61 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void test_lfds700_queue_bss_dequeuing() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop; + + struct lfds700_queue_bss_element + element_array[128]; + + struct lfds700_queue_bss_state + qs; + + struct lfds700_misc_validation_info + vi; + + void + *value; + + /* TRD : create an empty queue + enqueue 128 elements + then dequeue the elements, in the same thread - we're API testing + it's a single producer queue, so we just do this in our current thread + since we're enqueuing and dequeuing in the same thread, + + */ + + internal_display_test_name( "Dequeuing" ); + + lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 128, NULL ); + + for( loop = 0 ; loop < 127 ; loop++ ) + lfds700_queue_bss_enqueue( &qs, NULL, (void *) loop ); + + for( loop = 0 ; loop < 127 ; loop++ ) + { + lfds700_queue_bss_dequeue( &qs, NULL, &value ); + if( (lfds700_pal_uint_t) value != 127 - loop ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + + vi.min_elements = vi.max_elements = 0; + + lfds700_queue_bss_query( &qs, LFDS700_QUEUE_BSS_QUERY_VALIDATE, &vi, &dvs ); + + lfds700_queue_bss_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue_bss", dvs ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c new file mode 100644 index 0000000000..807337864a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c @@ -0,0 +1,59 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void test_lfds700_queue_bss_enqueuing() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + int + rv; + + lfds700_pal_uint_t + loop; + + struct lfds700_queue_bss_element + element_array[128]; + + struct lfds700_queue_bss_state + qs; + + struct lfds700_misc_validation_info + vi; + + /* TRD : create an empty queue + enqueue 128 elements + it's a single producer queue, so we just do this in our current thread + it's an API test + */ + + internal_display_test_name( "Enqueuing" ); + + lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 128, NULL ); + + for( loop = 0 ; loop < 127 ; loop++ ) + if( 1 != lfds700_queue_bss_enqueue(&qs, NULL, (void *) loop) ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : at this point enqueuing one more should return 0 + rv = lfds700_queue_bss_enqueue( &qs, NULL, (void *) loop ); + + if( rv != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + vi.min_elements = vi.max_elements = 127; + + lfds700_queue_bss_query( &qs, LFDS700_QUEUE_BSS_QUERY_VALIDATE, &vi, &dvs ); + + lfds700_queue_bss_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue_bss", dvs ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c new file mode 100644 index 0000000000..ad218609fd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c @@ -0,0 +1,260 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + struct lfds700_queue_bss_state + *qs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dequeuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_bss_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_queue_bss_element + element_array[4]; + + struct lfds700_queue_bss_state + qs; + + struct test_pal_logical_processor + *lp, + *lp_first; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + + /* TRD : so, this is the real test + problem is, because we use memory barriers only + and we only support one producer and one consumer + we need to ensure these threads are on different physical cores + if they're on the same core, the code would work even without memory barriers + + problem is, in the test application, we only know the *number* of logical cores + obtaining topology information adds a great deal of complexity to the test app + and makes porting much harder + + so, we know how many logical cores there are; my thought is to partially + permutate over them - we always run the producer on core 0, but we iterate + over the other logical cores, running the test once each time, with the + consumer being run on core 0, then core 1, then core 2, etc + + (we run on core 0 for the single-cpu case; it's redundent, since a single + logical core running both producer and consumer will work, but otherwise + we have to skip the test, which is confusing for the user) + + the test is one thread enqueuing and one thread dequeuing for two seconds + */ + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + internal_display_test_name( "Enqueuing and dequeuing (%d seconds)", number_logical_processors * 2 ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * 2 ); + + for( loop = 0 ; loop < 2 ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->error_flag = LOWERED; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * 2 ); + + /* TRD : producer always on core 0 + iterate over the other cores with consumer + */ + + lasue = LFDS700_LIST_ASU_GET_START( *list_of_logical_processors ); + lp_first = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + while( lasue != NULL ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 4, NULL ); + + util_thread_starter_new( &tts, 2 ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + util_thread_starter_start( tts, &thread_handles[0], 0, lp_first, thread_enqueuer, ts ); + util_thread_starter_start( tts, &thread_handles[1], 1, lp, thread_dequeuer, ts+1 ); + + util_thread_starter_run( tts ); + + for( subloop = 0 ; subloop < 2 ; subloop++ ) + test_pal_thread_wait( thread_handles[subloop] ); + + util_thread_starter_delete( tts ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_queue_bss_cleanup( &qs, NULL ); + + lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); + } + + if( (ts+1)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + free( thread_handles ); + + free( ts ); + + internal_display_test_result( 1, "queue_bss", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer( void *util_thread_starter_thread_state ) +{ + int + rv; + + lfds700_pal_uint_t + datum = 0, + time_loop = 0; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + 2 ) + { + rv = lfds700_queue_bss_enqueue( ts->qs, NULL, (void *) datum ); + + if( rv == 1 ) + if( ++datum == 4 ) + datum = 0; + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dequeuer( void *util_thread_starter_thread_state ) +{ + int + rv; + + lfds700_pal_uint_t + datum, + expected_datum = 0, + time_loop = 0; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + 2 ) + { + rv = lfds700_queue_bss_dequeue( ts->qs, NULL, (void *) &datum ); + + if( rv == 1 ) + { + if( datum != expected_datum ) + ts->error_flag = RAISED; + + if( ++expected_datum == 4 ) + expected_datum = 0; + } + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c new file mode 100644 index 0000000000..74f271d320 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c @@ -0,0 +1,215 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + struct lfds700_queue_state + *qs; +}; + +struct test_element +{ + struct lfds700_queue_element + qe; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_dequeuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : create a queue, add 1,000,000 elements + + use a single thread to enqueue every element + each elements user data is an incrementing counter + + then run one thread per CPU + where each busy-works dequeuing + + when an element is dequeued, we check (on a per-thread basis) the + value dequeued is greater than the element previously dequeued + + note we have no variation in the test for CAS+GC vs DWCAS + this is because all we do is dequeue + what we actually want to stress test is the queue + not CAS + so it's better to let the dequeue run as fast as possible + */ + + internal_display_test_name( "Dequeuing" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array + number_elements_without_dummy_element)->qe, &ps, NULL ); + + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + { + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, loop ); + lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->error_flag = LOWERED; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_dequeuer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : check queue is empty + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + // TRD : check for raised error flags + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + free( ts ); + + util_aligned_free( te_array ); + + lfds700_queue_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_dequeuer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + *prev_value, + *value; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + lfds700_queue_dequeue( ts->qs, &qe, &ps ); + prev_value = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + util_thread_starter_ready_and_wait( tsts ); + + while( lfds700_queue_dequeue(ts->qs, &qe, &ps) ) + { + value = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( value <= prev_value ) + ts->error_flag = RAISED; + + prev_value = value; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c new file mode 100644 index 0000000000..89ccf30fcb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c @@ -0,0 +1,239 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + number_elements, + thread_number; + + struct lfds700_queue_state + *qs; + + struct test_element + *te_array; +}; + +struct test_element +{ + struct lfds700_queue_element + qe; + + lfds700_pal_uint_t + counter, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_enqueuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_enqueuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + *per_thread_counters, + loop, + number_elements, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + dummy_qe, + *qe; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : create an empty queue + then run one thread per CPU + where each thread busy-works, enqueuing elements from a freelist (one local freelist per thread) + until 100000 elements are enqueued, per thread + each element's void pointer of user data is a struct containing thread number and element number + where element_number is a thread-local counter starting at 0 + + when we're done, we check that all the elements are present + and increment on a per-thread basis + */ + + internal_display_test_name( "Enqueuing" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, &dummy_qe, &ps, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->thread_number = loop; + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_enqueuer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : first, validate the queue + + then dequeue + we expect to find element numbers increment on a per thread basis + */ + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = 0; + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_queue_dequeue(&qs, &qe, &ps) ) + { + te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( te->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( te->counter > per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( te->counter < per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->counter == per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number]++; + } + + free( per_thread_counters ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->te_array ); + + free( ts ); + + lfds700_queue_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_enqueuer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + (ts->te_array+loop)->thread_number = ts->thread_number; + (ts->te_array+loop)->counter = loop; + } + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->qe, ts->te_array+loop ); + lfds700_queue_enqueue( ts->qs, &(ts->te_array+loop)->qe, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c new file mode 100644 index 0000000000..1469635fd4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c @@ -0,0 +1,250 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + counter, + number_logical_processors, + *per_thread_counters, + thread_number; + + struct lfds700_queue_state + *qs; +}; + +struct test_element +{ + struct lfds700_queue_element + qe, + *qe_use; + + lfds700_pal_uint_t + counter, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : qt can be any value in its range + + /* TRD : create a queue with one element per thread + each thread constly dequeues and enqueues from that one queue + where when enqueuing sets in the element + its thread number and counter + and when dequeuing, checks the thread number and counter + against previously seen counter for that thread + where it should always see a higher number + */ + + internal_display_test_name( "Enqueuing and dequeuing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + te_array = util_aligned_malloc( sizeof(struct test_element) * (number_logical_processors+1), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array+number_logical_processors)->qe, &ps, NULL ); + + // TRD : we assume the test will iterate at least once (or we'll have a false negative) + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (te_array+loop)->thread_number = loop; + (te_array+loop)->counter = 0; + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, te_array+loop ); + lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->thread_number = loop; + (ts+loop)->counter = 0; + (ts+loop)->error_flag = LOWERED; + (ts+loop)->per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + (ts+loop)->number_logical_processors = number_logical_processors; + + for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) + *((ts+loop)->per_thread_counters+subloop) = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueuer_and_dequeuer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_logical_processors; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + free( (ts+loop)->per_thread_counters ); + + util_aligned_free( te_array ); + + free( ts ); + + lfds700_queue_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_queue_dequeue( ts->qs, &qe, &ps ); + te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( te->thread_number >= ts->number_logical_processors ) + ts->error_flag = RAISED; + else + { + if( te->counter < ts->per_thread_counters[te->thread_number] ) + ts->error_flag = RAISED; + + if( te->counter >= ts->per_thread_counters[te->thread_number] ) + ts->per_thread_counters[te->thread_number] = te->counter+1; + } + + te->thread_number = ts->thread_number; + te->counter = ++ts->counter; + + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *qe, te ); + lfds700_queue_enqueue( ts->qs, qe, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c new file mode 100644 index 0000000000..21be07052d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c @@ -0,0 +1,241 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + number_of_elements_per_thread; + + struct lfds700_queue_state + *qs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueue_dequeuer_with_free( void *util_thread_starter_thread_state ); +static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_enqueuing_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + number_of_elements_per_thread; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct test_state + *ts; + + struct util_thread_starter_state + *tts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : the M&Q queue supports free()ing queue elements after they've been dequeued + we need to test this + we spawn one thread per logical core + there's one master queue which all threads work on + we create one freelist per thread + and allocate as many queue elements as we can (no payload) + - but note each allocate is its own malloc() + each freelist receives an equal share (i.e. we get the mallocs out of the way) + each thread enqueues as rapidly as possible + and dequeues as rapidly as possible + (i.e. each thread loops, doing an enqueue and a dequeue) + when the dequeue is done, the element is free()ed + */ + + internal_display_test_name( "Enqueuing and dequeuing with free" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct lfds700_freelist_element) + sizeof(struct lfds700_queue_element) ); + number_of_elements_per_thread = number_elements / number_logical_processors; + qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), (lfds700_pal_uint_t) LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + lfds700_queue_init_valid_on_current_logical_core( &qs, qe, &ps, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->number_of_elements_per_thread = number_of_elements_per_thread; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueue_dequeuer_with_free, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = 0; + vi.max_elements = 0; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + lfds700_queue_cleanup( &qs, queue_element_cleanup_callback ); + + free( ts ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueue_dequeuer_with_free( void *util_thread_starter_thread_state ) +{ + enum flag + finished_flag = LOWERED; + + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_freelist_element + *fe, + *fe_array; + + struct lfds700_freelist_state + fs; + + struct lfds700_queue_element + *qe; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + fe_array = util_malloc_wrapper( sizeof(struct lfds700_freelist_element) * ts->number_of_elements_per_thread ); + + for( loop = 0 ; loop < ts->number_of_elements_per_thread ; loop++ ) + { + qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( fe_array[loop], qe ); + lfds700_freelist_push( &fs, &fe_array[loop], &ps ); + } + + util_thread_starter_ready_and_wait( tsts ); + + while( finished_flag == LOWERED ) + { + loop = 0; + while( loop++ < 1000 and lfds700_freelist_pop(&fs, &fe, &ps) ) + { + qe = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + lfds700_queue_enqueue( ts->qs, qe, &ps ); + } + + if( loop < 1000 ) + finished_flag = RAISED; + + loop = 0; + while( loop++ < 1000 and lfds700_queue_dequeue(ts->qs, &qe, &ps) ) + util_aligned_free( qe ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + lfds700_freelist_cleanup( &fs, NULL ); + + free( fe_array ); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) +{ + assert( qs != NULL ); + assert( qe != NULL ); + // TRD : dummy_element_flag can be any value in its range + + util_aligned_free( qe ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c new file mode 100644 index 0000000000..0f0fa7f081 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c @@ -0,0 +1,208 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_queue_state + *qs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_with_malloc_and_dequeuer_with_free( void *util_thread_starter_thread_state ); +static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : qt can be any value in its range + + /* TRD : one thread per logical core + each thread loops for ten seconds + mallocs and enqueues 1k elements, then dequeues and frees 1k elements + */ + + internal_display_test_name( "Enqueuing with malloc dequeuing with free (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, qe, &ps, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->qs = &qs; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueuer_with_malloc_and_dequeuer_with_free, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = 0; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + free( ts ); + + lfds700_queue_cleanup( &qs, queue_element_cleanup_callback ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_with_malloc_and_dequeuer_with_free( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop, + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + for( loop = 0 ; loop < 1000 ; loop++ ) + { + qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + lfds700_queue_enqueue( ts->qs, qe, &ps ); + } + + for( loop = 0 ; loop < 1000 ; loop++ ) + { + lfds700_queue_dequeue( ts->qs, &qe, &ps ); + util_aligned_free( qe ); + } + + if( time_loop++ == REDUCED_TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) +{ + assert( qs != NULL ); + assert( qe != NULL ); + // TRD : dummy_element_flag can be any value in its range + + util_aligned_free( qe ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c new file mode 100644 index 0000000000..ec3963a336 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c @@ -0,0 +1,264 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + counter, + thread_number; + + struct lfds700_queue_state + *qs; +}; + +struct test_element +{ + struct lfds700_queue_element + qe, + *qe_use; + + lfds700_pal_uint_t + counter, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_rapid_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors, + *per_thread_counters; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct lfds700_misc_validation_info + vi; + + struct lfds700_queue_state + qs; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array, + *te; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single queue with 50,000 elements + we don't want too many elements, so we ensure plenty of element re-use + each thread simply loops dequeuing and enqueuing + where the user data indicates thread number and an increment counter + vertification is that the counter increments on a per-thread basis + */ + + internal_display_test_name( "Rapid enqueuing and dequeuing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); + + if( number_elements_with_dummy_element > (10000 * number_logical_processors) + 1 ) + number_elements_with_dummy_element = (10000 * number_logical_processors) + 1; + + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + vi.min_elements = number_elements_without_dummy_element; + vi.max_elements = number_elements_without_dummy_element; + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array+number_elements_without_dummy_element)->qe, &ps, NULL ); + + // TRD : we assume the test will iterate at least once (or we'll have a false negative) + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + { + (te_array+loop)->thread_number = loop; + (te_array+loop)->counter = 0; + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, te_array+loop ); + lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->thread_number = loop; + (ts+loop)->counter = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_enqueuer_and_dequeuer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + // TRD : now check results + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = 0; + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_queue_dequeue(&qs, &qe, &ps) ) + { + te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( te->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( per_thread_counters[te->thread_number] == 0 ) + per_thread_counters[te->thread_number] = te->counter; + + if( te->counter > per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( te->counter < per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->counter == per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number]++; + } + + free( per_thread_counters ); + + lfds700_queue_cleanup( &qs, NULL ); + + util_aligned_free( te_array ); + + free( ts ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_queue_dequeue( ts->qs, &qe, &ps ); + te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + te->thread_number = ts->thread_number; + te->counter = ts->counter++; + + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *qe, te ); + lfds700_queue_enqueue( ts->qs, qe, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c new file mode 100644 index 0000000000..0a7de0761b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c @@ -0,0 +1,31 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_ringbuffer( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + { + printf( "\n" + "Ringbuffer Tests\n" + "================\n" ); + + test_lfds700_ringbuffer_reading( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_ringbuffer_reading_and_writing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_ringbuffer_writing( list_of_logical_processors, memory_in_megabytes ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c new file mode 100644 index 0000000000..00d378992e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c @@ -0,0 +1,217 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + read_count; + + struct lfds700_ringbuffer_state + *rs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_reader( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_ringbuffer_reading( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors, + total_read = 0; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_ringbuffer_element + *re_array; + + struct lfds700_ringbuffer_state + rs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single ringbuffer + with 1,000,000 elements + we populate the ringbuffer, where the + user data is an incrementing counter + + we create one thread per CPU + where each thread busy-works, + reading until the ringbuffer is empty + + each thread keep track of the number of reads it manages + and that each user data it reads is greater than the + previous user data that was read + */ + + internal_display_test_name( "Reading" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct lfds700_ringbuffer_element); + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + vi.min_elements = 0; + vi.max_elements = number_elements_without_dummy_element; + + re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); + + // TRD : init the ringbuffer contents for the test + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + lfds700_ringbuffer_write( &rs, NULL, (void *) (size_t) loop, NULL, NULL, NULL, &ps ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->rs = &rs; + (ts+loop)->read_count = 0; + (ts+loop)->error_flag = LOWERED; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_reader, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) dvs ); + + // TRD : check for raised error flags + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : check thread reads total to 1,000,000 + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + total_read += (ts+loop)->read_count; + + if( total_read < number_elements_without_dummy_element ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( total_read > number_elements_without_dummy_element ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + free( ts ); + + lfds700_ringbuffer_cleanup( &rs, NULL ); + + util_aligned_free( re_array ); + + internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_reader( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + *prev_value, + *value; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + lfds700_ringbuffer_read( ts->rs, NULL, (void **) &prev_value, &ps ); + ts->read_count++; + + util_thread_starter_ready_and_wait( tsts ); + + while( lfds700_ringbuffer_read(ts->rs, NULL, (void **) &value, &ps) ) + { + if( value <= prev_value ) + ts->error_flag = RAISED; + + prev_value = value; + + ts->read_count++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c new file mode 100644 index 0000000000..152c331892 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c @@ -0,0 +1,261 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + counter, + number_logical_processors, + *per_thread_counters, + thread_number; + + struct lfds700_ringbuffer_state + *rs; +}; + +struct test_element +{ + lfds700_pal_uint_t + datum, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_reader_writer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_ringbuffer_reading_and_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors, + subloop; + + test_pal_thread_state_t + *thread_handles; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_ringbuffer_element + *re_array; + + struct lfds700_ringbuffer_state + rs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single ringbuffer + with 100,000 elements + the ringbuffers starts empty + + we create one thread per CPU + where each thread busy-works writing + and then immediately reading + for ten seconds + + the user data in each written element is a combination + of the thread number and the counter + + while a thread runs, it keeps track of the + counters for the other threads and throws an error + if it sees the number stay the same or decrease + */ + + internal_display_test_name( "Reading and writing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) + sizeof(struct lfds700_ringbuffer_element) ); + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + vi.min_elements = 0; + vi.max_elements = number_elements_without_dummy_element; + + re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); + + te_array = util_malloc_wrapper( sizeof(struct test_element) * number_elements_without_dummy_element ); + + // TRD : populate the ringbuffer + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + { + te_array[loop].thread_number = 0; + te_array[loop].datum = (lfds700_pal_uint_t) -1 ; + lfds700_ringbuffer_write( &rs, NULL, &te_array[loop], NULL, NULL, NULL, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->rs = &rs; + (ts+loop)->thread_number = loop; + (ts+loop)->counter = 0; + (ts+loop)->number_logical_processors = number_logical_processors; + (ts+loop)->error_flag = LOWERED; + (ts+loop)->per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) + *((ts+loop)->per_thread_counters+subloop) = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_reader_writer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) dvs ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + free( (ts+loop)->per_thread_counters ); + + free( ts ); + + lfds700_ringbuffer_cleanup( &rs, NULL ); + + util_aligned_free( re_array ); + + free( te_array ); + + internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_reader_writer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_ringbuffer_read( ts->rs, NULL, (void **) &te, &ps ); + + if( te->thread_number >= ts->number_logical_processors ) + ts->error_flag = RAISED; + else + { + if( te->datum < ts->per_thread_counters[te->thread_number] ) + ts->error_flag = RAISED; + + if( te->datum >= ts->per_thread_counters[te->thread_number] ) + ts->per_thread_counters[te->thread_number] = te->datum+1; + } + + te->thread_number = ts->thread_number; + te->datum = ts->counter++; + + lfds700_ringbuffer_write( ts->rs, NULL, te, NULL, NULL, NULL, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c new file mode 100644 index 0000000000..702aabc58d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c @@ -0,0 +1,272 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + lfds700_pal_uint_t + thread_number, + datum; +}; + +struct test_state +{ + lfds700_pal_uint_t + thread_number, + write_count; + + struct test_element + te; + + struct lfds700_ringbuffer_state + *rs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_writer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_ringbuffer_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors, + *per_thread_counters; + + test_pal_thread_state_t + *thread_handles; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_ringbuffer_element + *re_array; + + struct lfds700_ringbuffer_state + rs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te, + *te_array; + + struct test_state + *ts; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single ringbuffer + with n elements + we create n test elements + which are thread_number/counter pairs + init them to safe values + and fully populate the ringbuffer + + we create one thread per CPU + where each thread busy-works writing + for ten seconds; each thread has one extra element + which it uses for the first write and after that + it uses the element it picks up from overwriting + + the user data in each written element is a combination + of the thread number and the counter + + after the threads are complete, we validate by + checking the user data counters increment on a per thread + basis + */ + + internal_display_test_name( "Writing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) + sizeof(struct lfds700_ringbuffer_element) ); + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + vi.min_elements = number_elements_without_dummy_element; + vi.max_elements = number_elements_without_dummy_element; + + re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); + + te_array = util_malloc_wrapper( sizeof(struct lfds700_ringbuffer_element) * number_elements_without_dummy_element ); + + // TRD : init the test elements and write them into the ringbuffer + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + { + te_array[loop].thread_number = 0; + te_array[loop].datum = 0; + lfds700_ringbuffer_write( &rs, NULL, &te_array[loop], NULL, NULL, NULL, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->rs = &rs; + (ts+loop)->thread_number = loop; + (ts+loop)->write_count = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_writer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : now check results + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = 0; + + lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, &vi, dvs ); + + while( dvs[0] == LFDS700_MISC_VALIDITY_VALID and dvs[1] == LFDS700_MISC_VALIDITY_VALID and lfds700_ringbuffer_read(&rs, NULL, (void **) &te, &ps) ) + { + if( te->thread_number >= number_logical_processors ) + { + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( per_thread_counters[te->thread_number] == 0 ) + per_thread_counters[te->thread_number] = te->datum; + + if( te->datum < per_thread_counters[te->thread_number] ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->datum >= per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number] = te->datum+1; + } + + free( per_thread_counters ); + + lfds700_ringbuffer_cleanup( &rs, NULL ); + + free( ts ); + + util_aligned_free( re_array ); + + free( te_array ); + + internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_writer( void *util_thread_starter_thread_state ) +{ + enum lfds700_misc_flag + overwrite_occurred_flag; + + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + ts->te.thread_number = 0; + ts->te.datum = 0; + + lfds700_ringbuffer_write( ts->rs, NULL, &ts->te, &overwrite_occurred_flag, NULL, (void **) &te, &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + te->thread_number = ts->thread_number; + te->datum = ts->write_count++; + + lfds700_ringbuffer_write( ts->rs, NULL, te, &overwrite_occurred_flag, NULL, (void **) &te, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c new file mode 100644 index 0000000000..af3a37512a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c @@ -0,0 +1,33 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_stack( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + { + printf( "\n" + "Stack Tests\n" + "===========\n" ); + + test_lfds700_stack_alignment(); + test_lfds700_stack_popping( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_stack_pushing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_stack_popping_and_pushing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_stack_rapid_popping_and_pushing( list_of_logical_processors ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c new file mode 100644 index 0000000000..7add41bd48 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c @@ -0,0 +1,43 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_stack_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_stack_state + if( offsetof(struct lfds700_stack_state,top) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_stack_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c new file mode 100644 index 0000000000..461730604c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c @@ -0,0 +1,202 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_stack_state + *ss; +}; + +struct test_element +{ + struct lfds700_stack_element + se; + + enum flag + popped_flag; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_stack_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_stack_state + ss; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a stack + + we then populate the stack with 1,000,000 elements + each void pointer of data points to the containing test element + + we then run one thread per CPU + where each thread loops, popping as quickly as possible + upon popping, a flag is set in the containing test element + + the threads run till the source stack is empty + + we then check the poppged flag, all should be raised + + then tidy up + + no CAS+GC code, as we only pop + */ + + internal_display_test_name( "Popping" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element) ; + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements ; loop++ ) + { + (te_array+loop)->popped_flag = LOWERED; + LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); + lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); + } + + ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->ss = &ss; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, (void *) &dvs ); + + // TRD : now we check each element has popped_flag set to RAISED + for( loop = 0 ; loop < number_elements ; loop++ ) + if( (te_array+loop)->popped_flag == LOWERED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : cleanup + lfds700_stack_cleanup( &ss, NULL ); + util_aligned_free( te_array ); + util_aligned_free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ) +{ + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( lfds700_stack_pop(ts->ss, &se, &ps) ) + { + te = LFDS700_STACK_GET_VALUE_FROM_ELEMENT( *se ); + te->popped_flag = RAISED; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c new file mode 100644 index 0000000000..03c3254c77 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c @@ -0,0 +1,316 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element; + +struct test_state +{ + lfds700_pal_uint_t + number_elements; + + struct lfds700_stack_state + *ss, + ss_thread_local; + + struct test_element + *ss_thread_local_te_array; +}; + +struct test_element +{ + struct lfds700_stack_element + se, + thread_local_se; + + lfds700_pal_uint_t + datum; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_stack_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_state + ss; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we have two threads per CPU + the threads loop for ten seconds + the first thread pushes 10000 elements then pops 10000 elements + the second thread pops 10000 elements then pushes 10000 elements + all pushes and pops go onto the single main stack + + after time is up, all threads push what they have remaining onto + the main stack + + we then validate the main stack + */ + + internal_display_test_name( "Popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors * 2 ); + + lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + // TRD : some initial elements so the pushing threads can start immediately + for( loop = 0 ; loop < number_elements * number_logical_processors ; loop++ ) + { + (te_array+loop)->datum = loop; + LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); + lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); + } + + ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors * 2, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + // TRD : first set of threads + (ts+loop)->ss = &ss; + (ts+loop)->number_elements = number_elements; + lfds700_stack_init_valid_on_current_logical_core( &(ts+loop)->ss_thread_local, NULL ); + + // TRD : second set of threads + (ts+loop+number_logical_processors)->ss = &ss; + (ts+loop+number_logical_processors)->number_elements = number_elements; + lfds700_stack_init_valid_on_current_logical_core( &(ts+loop+number_logical_processors)->ss_thread_local, NULL ); + + // TRD : fill the pushing thread stacks + (ts+loop+number_logical_processors)->ss_thread_local_te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + ((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->datum = loop; + LFDS700_STACK_SET_VALUE_IN_ELEMENT( ((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->thread_local_se, (ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop ); + lfds700_stack_push( &(ts+loop+number_logical_processors)->ss_thread_local, &((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->thread_local_se, &ps ); + } + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); + + util_thread_starter_new( &tts, number_logical_processors * 2 ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping_and_pushing_start_popping, ts+loop ); + util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, thread_popping_and_pushing_start_pushing, ts+loop+number_logical_processors ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors * 2; + + lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + lfds700_stack_cleanup( &ss, NULL ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + lfds700_stack_cleanup( &(ts+loop)->ss_thread_local, NULL ); + lfds700_stack_cleanup( &(ts+loop+number_logical_processors)->ss_thread_local, NULL ); + util_aligned_free( (ts+loop+number_logical_processors)->ss_thread_local_te_array ); + } + + util_aligned_free( ts ); + + util_aligned_free( te_array ); + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + count; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + start_time = time( NULL ); + + while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) + { + count = 0; + + while( count < ts->number_elements ) + if( lfds700_stack_pop(ts->ss, &se, &ps) ) + { + lfds700_stack_push( &ts->ss_thread_local, se, &ps ); + count++; + } + + // TRD : return our local stack to the main stack + while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) + lfds700_stack_push( ts->ss, se, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + count; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + start_time = time( NULL ); + + while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) + { + // TRD : return our local stack to the main stack + while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) + lfds700_stack_push( ts->ss, se, &ps ); + + count = 0; + + while( count < ts->number_elements ) + if( lfds700_stack_pop(ts->ss, &se, &ps) ) + { + lfds700_stack_push( &ts->ss_thread_local, se, &ps ); + count++; + } + } + + // TRD : now push whatever we have in our local stack + while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) + lfds700_stack_push( ts->ss, se, &ps ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c new file mode 100644 index 0000000000..bdf2b9b640 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c @@ -0,0 +1,251 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + number_elements, + thread_number; + + struct lfds700_stack_state + *ss; + + struct test_element + *te_array; +}; + +struct test_element +{ + struct lfds700_stack_element + se; + + lfds700_pal_uint_t + datum, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_stack_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct lfds700_stack_state + ss; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te, + *first_te = NULL; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create an empty stack + + we then create one thread per CPU, where each thread + pushes 100,000 elements each as quickly as possible to the stack + (the threads themselves alloc these elements, to obtain NUMA closeness) + + the data pushed is a counter and a thread ID + + the threads exit when the stack is full + + we then validate the stack; + + checking that the counts increment on a per unique ID basis + and that the number of elements we pop equals 100,000 per thread + (since each element has an incrementing counter which is + unique on a per unique ID basis, we can know we didn't lose + any elements) + + there's no CAS+GC code, as we only push + */ + + internal_display_test_name( "Pushing" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + // TRD : the main stack + lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->ss = &ss; + (ts+loop)->thread_number = loop; + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_pushing, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : the stack is now fully pushed; time to verify + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = number_elements - 1; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_stack_pop(&ss, &se, &ps) ) + { + te = LFDS700_STACK_GET_VALUE_FROM_ELEMENT( *se ); + + if( first_te == NULL ) + first_te = te; + + if( te->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( te->datum > per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->datum < per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( te->datum == per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number]--; + } + + // TRD : clean up + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->te_array ); + + free( per_thread_counters ); + + free( ts ); + + lfds700_stack_cleanup( &ss, NULL ); + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + // TRD : alloc local 100,000 elements + ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + (ts->te_array+loop)->thread_number = ts->thread_number; + (ts->te_array+loop)->datum = loop; + } + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_STACK_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->se, ts->te_array+loop ); + lfds700_stack_push( ts->ss, &(ts->te_array+loop)->se, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c new file mode 100644 index 0000000000..d771457c86 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c @@ -0,0 +1,217 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_stack_state + *ss; +}; + +struct test_element +{ + struct lfds700_stack_element + se; + + lfds700_pal_uint_t + datum; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_stack_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_stack_state + ss; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : st can be any value in its range + + /* TRD : in these tests there is a fundamental antagonism between + how much checking/memory clean up that we do and the + likelyhood of collisions between threads in their lock-free + operations + + the lock-free operations are very quick; if we do anything + much at all between operations, we greatly reduce the chance + of threads colliding + + so we have some tests which do enough checking/clean up that + they can tell the stack is valid and don't leak memory + and here, this test now is one of those which does minimal + checking - in fact, the nature of the test is that you can't + do any real checking - but goes very quickly + + what we do is create a small stack and then run one thread + per CPU, where each thread simply pushes and then immediately + pops + + the test runs for ten seconds + + after the test is done, the only check we do is to traverse + the stack, checking for loops and ensuring the number of + elements is correct + */ + + internal_display_test_name( "Rapid popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->ss = &ss; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + // TRD : we need one element per thread + te_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); + lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); + } + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_popping_and_pushing, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_logical_processors; + + lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + lfds700_stack_cleanup( &ss, NULL ); + + util_aligned_free( te_array ); + + free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_stack_pop( ts->ss, &se, &ps ); + lfds700_stack_push( ts->ss, se, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c new file mode 100644 index 0000000000..eb62c5b4cc --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c @@ -0,0 +1,245 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WIN7 ) + + /* TRD : _WIN32 indicates 64-bit or 32-bit Windows + !_KERNEL_MODE indicates Windows user-mode + NTDDI_VERSION indicates Windows version + - GetLogicalProcessorInformationEx requires Windows 7 + */ + + #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c + #endif + + #define TEST_PAL_GET_LOGICAL_CORE_IDS + + void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) + { + BOOL + rv; + + DWORD + loop, + number_slpie, + slpie_length = 0; + + lfds700_pal_uint_t + bitmask, + logical_processor_number, + windows_logical_processor_group_number; + + struct lfds700_misc_prng_state + ps; + + struct test_pal_logical_processor + *lp; + + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX + *slpie = NULL; + + assert( lasus != NULL ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); + + rv = GetLogicalProcessorInformationEx( RelationGroup, slpie, &slpie_length ); + slpie = malloc( slpie_length ); + rv = GetLogicalProcessorInformationEx( RelationGroup, slpie, &slpie_length ); + number_slpie = slpie_length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + + for( loop = 0 ; loop < number_slpie ; loop++ ) + if( (slpie+loop)->Relationship == RelationGroup ) + for( windows_logical_processor_group_number = 0 ; windows_logical_processor_group_number < (slpie+loop)->Group.ActiveGroupCount ; windows_logical_processor_group_number++ ) + for( logical_processor_number = 0 ; logical_processor_number < sizeof(KAFFINITY) * BITS_PER_BYTE ; logical_processor_number++ ) + { + bitmask = (lfds700_pal_uint_t) 1 << logical_processor_number; + + // TRD : if we've found a processor for this group, add it to the list + if( (slpie+loop)->Group.GroupInfo[windows_logical_processor_group_number].ActiveProcessorMask & bitmask ) + { + lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lp->logical_processor_number = logical_processor_number; + lp->windows_logical_processor_group_number = windows_logical_processor_group_number; + + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); + lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); + } + } + + free( slpie ); + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WINXP && NTDDI_VERSION < NTDDI_WIN7 ) + + /* TRD : _WIN32 indicates 64-bit or 32-bit Windows + !_KERNEL_MODE indicates Windows user-mode + NTDDI_VERSION indicates Windows version + - GetLogicalProcessorInformation requires XP SP3 + */ + + #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c + #endif + + #define TEST_PAL_GET_LOGICAL_CORE_IDS + + void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) + { + DWORD + slpi_length = 0; + + lfds700_pal_uint_t + number_slpi, + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_pal_logical_processor + *lp; + + SYSTEM_LOGICAL_PROCESSOR_INFORMATION + *slpi = NULL; + + ULONG_PTR + mask; + + assert( lasus != NULL ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); + + *number_logical_processors = 0; + + GetLogicalProcessorInformation( slpi, &slpi_length ); + slpi = malloc( slpi_length ); + GetLogicalProcessorInformation( slpi, &slpi_length ); + number_slpi = slpi_length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); + + for( loop = 0 ; loop < number_slpi ; loop++ ) + if( (slpi+loop)->Relationship == RelationProcessorCore ) + for( logical_processor_number = 0 ; logical_processor_number < sizeof(ULONG_PTR) * BITS_PER_BYTE ; logical_processor_number++ ) + { + bitmask = 1 << logical_processor_number; + + if( (slpi+loop)->ProcessorMask & bitmask ) + { + lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lp->logical_processor_number = logical_processor_number; + lp->windows_logical_processor_group_number = 0; + + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); + lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); + } + + free( slpi ); + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( defined __linux__ ) + + /* TRD : __linux__ indicates Linux + __STDC__ indicates Standard Library + __STDC_HOSTED__ indicates Standard Library hosted implementation + - fopen requires a Standard Library hosted environment + - setbuf requires a Standard Library hosted environment + - fgets requires a Standard Library hosted environment + - sscanf requires a Standard Library hosted environment + - fclose requires a Standard Library hosted environment + */ + + #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c + #endif + + #define TEST_PAL_GET_LOGICAL_CORE_IDS + + void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) + { + char + diskbuffer[BUFSIZ], + string[1024]; + + FILE + *diskfile; + + int long long unsigned + logical_processor_number; + + struct lfds700_misc_prng_state + ps; + + struct test_pal_logical_processor + *lp; + + assert( lasus != NULL ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); + + diskfile = fopen( "/proc/cpuinfo", "r" ); + + if( diskfile != NULL ) + { + setbuf( diskfile, diskbuffer ); + + while( NULL != fgets(string, 1024, diskfile) ) + if( 1 == sscanf(string, "processor : %llu", &logical_processor_number) ) + { + lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lp->logical_processor_number = (lfds700_pal_uint_t) logical_processor_number; + lp->windows_logical_processor_group_number = 0; + + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); + lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); + } + + fclose( diskfile ); + } + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( !defined TEST_PAL_GET_LOGICAL_CORE_IDS ) + + #error test_pal_get_logical_core_ids() not implemented for this platform. + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h new file mode 100644 index 0000000000..1c0ab03eee --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h @@ -0,0 +1,82 @@ +/****************************************************************************/ +#if( defined _MSC_VER ) + /* TRD : MSVC compiler + + an unfortunately necessary hack for MSVC + MSVC only defines __STDC__ if /Za is given, where /Za turns off MSVC C extensions - + which prevents Windows header files from compiling. + */ + + #define __STDC__ 1 + #define __STDC_HOSTED__ 1 +#endif + +#if( defined __linux__ ) + #define _GNU_SOURCE + #include <unistd.h> +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1310 && NTDDI_VERSION >= NTDDI_WINXP && defined _WIN32 ) + + #ifdef TEST_PAL_PORTING_ABSTRACTION_LAYER + #error More than one porting abstraction layer matches current platform. + #endif + + #define TEST_PAL_PORTING_ABSTRACTION_LAYER + + #define TEST_PAL_OS_STRING "Windows" + + #include <windows.h> + + typedef HANDLE test_pal_thread_state_t; + typedef DWORD test_pal_thread_return_t; + + #define TEST_PAL_CALLING_CONVENTION WINAPI + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __linux__ && _POSIX_THREADS > 0 ) + + #ifdef TEST_PAL_PORTING_ABSTRACTION_LAYER + #error More than one porting abstraction layer matches current platform. + #endif + + #define TEST_PAL_PORTING_ABSTRACTION_LAYER + + #define TEST_PAL_OS_STRING "Linux" + + #define _GNU_SOURCE + + #include <pthread.h> + #include <sched.h> + #include <sys/syscall.h> + #include <sys/types.h> + + typedef pthread_t test_pal_thread_state_t; + typedef void * test_pal_thread_return_t; + + #define TEST_PAL_CALLING_CONVENTION + +#endif + + + + + +/****************************************************************************/ +#if( !defined TEST_PAL_PORTING_ABSTRACTION_LAYER ) + + #error No matching porting abstraction layer in test_porting_abstraction_layer_operating_system.h + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c new file mode 100644 index 0000000000..83a09814aa --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c @@ -0,0 +1,336 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WIN7 ) + + /* TRD : _WIN32 indicates 32-bit or 64-bit Windows + !_KERNEL_MODE indicates Windows user-mode + NTDDI_VERSION indicates Windows version + - GetCurrentProcess requires XP + - InitializeProcThreadAttributeList requires Windows 7 + - CreateRemoteThreadEx requires Windows 7 + */ + + #ifdef TEST_PAL_THREAD_START + #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c + #endif + + #define TEST_PAL_THREAD_START + + int test_pal_thread_start( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) + { + BOOL + brv; + + DWORD + thread_id; + + GROUP_AFFINITY + ga; + + int + rv = 0; + + LPPROC_THREAD_ATTRIBUTE_LIST + attribute_list; + + SIZE_T + attribute_list_length; + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + /* TRD : here we're using CreateRemoteThreadEx() to start a thread in our own process + we do this because as a function, it allows us to specify processor and processor group affinity in the create call + */ + + brv = InitializeProcThreadAttributeList( NULL, 1, 0, &attribute_list_length ); + attribute_list = malloc( attribute_list_length ); + brv = InitializeProcThreadAttributeList( attribute_list, 1, 0, &attribute_list_length ); + + ga.Mask = ( (KAFFINITY) 1 << lp->logical_processor_number ); + ga.Group = (WORD) lp->windows_logical_processor_group_number; + memset( ga.Reserved, 0, sizeof(WORD) * 3 ); + + brv = UpdateProcThreadAttribute( attribute_list, 0, PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY, &ga, sizeof(GROUP_AFFINITY), NULL, NULL ); + *thread_state = CreateRemoteThreadEx( GetCurrentProcess(), NULL, 0, thread_function, thread_user_state, NO_FLAGS, attribute_list, &thread_id ); + + DeleteProcThreadAttributeList( attribute_list ); + free( attribute_list ); + + if( *thread_state != NULL ) + rv = 1; + + return( rv ); + } + +#endif + + + + + +/****************************************************************************/ +#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WINXP && NTDDI_VERSION < NTDDI_WIN7 ) + + /* TRD : _WIN32 indicates 64-bit or 32-bit Windows + NTDDI_VERSION indicates Windows version + - CreateThread requires XP + - SetThreadAffinityMask requires XP + - ResumeThread requires XP + */ + + #ifdef TEST_PAL_THREAD_START + #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c + #endif + + #define TEST_PAL_THREAD_START + + int test_pal_thread_start( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) + { + int + rv = 0; + + DWORD + thread_id; + + DWORD_PTR + affinity_mask, + result; + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + /* TRD : Vista and earlier do not support processor groups + as such, there is a single implicit processor group + also, there's no support for actually starting a thread in its correct NUMA node / logical processor + so we make the best of it; we start suspended, set the affinity, and then resume + the thread itself internally is expected to be making allocs from the correct NUMA node + */ + + *thread_state = CreateThread( NULL, 0, thread_function, thread_user_state, CREATE_SUSPENDED, &thread_id ); + + affinity_mask = (DWORD_PTR) (1 << lp->logical_processor_number); + + SetThreadAffinityMask( *thread_state, affinity_mask ); + + ResumeThread( *thread_state ); + + if( *thread_state != NULL ) + rv = 1; + + return( rv ); + } + +#endif + + + + + +/****************************************************************************/ +#if( defined __linux__ && _POSIX_THREADS > 0 ) + + /* TRD : __linux__ indicates Linux + - gettid requires Linux + - sched_setaffinity requires Linux + _POSIX_THREADS indicates POSIX threads + - pthread_create requires POSIX + */ + + #ifdef TEST_PAL_THREAD_START + #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c + #endif + + #define TEST_PAL_THREAD_START + + /***** structs *****/ + struct test_pal_internal_thread_state + { + struct test_pal_logical_processor + lp; + + test_pal_thread_return_t + (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ); + + void + *thread_user_state; + }; + + /***** prototypes *****/ + test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION test_pal_internal_thread_function( void *thread_user_state ); + + /****************************************************************************/ + int test_pal_thread_start( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) + { + int + rv; + + struct test_pal_internal_thread_state + *its; + + /* TRD : this implementation works on Linux only as it uses sched_setaffinity(), which is Linux specific + although I cannot currently test, I believe this function also works on Android + + this implementation exists because the pthreads function for setting thread affinity, + pthread_attr_setaffinity_np(), works on Linux, but not Android + */ + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + its = malloc( sizeof(struct test_pal_internal_thread_state) ); + + its->lp = *lp; + its->thread_function = thread_function; + its->thread_user_state = thread_user_state; + + rv = pthread_create( thread_state, NULL, test_pal_internal_thread_function, its ); + + if( rv == 0 ) + rv = 1; + + return( rv ); + } + + /****************************************************************************/ + test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION test_pal_internal_thread_function( void *thread_user_state ) + { + cpu_set_t + cpuset; + + pid_t + tid; + + struct test_pal_internal_thread_state + *its; + + test_pal_thread_return_t + rv; + + assert( thread_user_state != NULL ); + + /* TRD : the APIs under Linux/POSIX for setting thread affinity are in a mess + pthreads offers pthread_attr_setaffinity_np(), which glibc supports, + but which is not supported by Android + Linux offers sched_setaffinity(), but this needs a *thread pid*, + and the only API to get a thread pid is gettid(), which works for + and only for *the calling thread* + + so we come to this - a wrapper thread function, which is the function used + when starting a thread; this calls gettid() and then sched_setaffinity(), + and then calls into the actual thread function + + generally shaking my head in disbelief at this point + */ + + assert( thread_user_state != NULL ); + + its = (struct test_pal_internal_thread_state *) thread_user_state; + + CPU_ZERO( &cpuset ); + CPU_SET( its->lp.logical_processor_number, &cpuset ); + + tid = syscall( SYS_gettid ); + + sched_setaffinity( tid, sizeof(cpu_set_t), &cpuset ); + + rv = its->thread_function( its->thread_user_state ); + + free( its ); + + return( rv ); + } + +#endif + + + + + +/****************************************************************************/ +#if( !defined __linux__ && _POSIX_THREADS > 0 ) + + /* TRD : !__linux__ indicates not Linux + _POSIX_THREADS indicates POSIX threads + - pthread_attr_init requires POSIX + - pthread_attr_setaffinity_np requires POSIX + - pthread_create requires POSIX + - pthread_attr_destroy requires POSIX + */ + + #ifdef TEST_PAL_THREAD_START + #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c + #endif + + #define TEST_PAL_THREAD_START + + int test_pal_thread_start( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) + { + int + rv = 0, + rv_create; + + cpu_set_t + cpuset; + + pthread_attr_t + attr; + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + pthread_attr_init( &attr ); + + CPU_ZERO( &cpuset ); + CPU_SET( lp->logical_processor_number, &cpuset ); + pthread_attr_setaffinity_np( &attr, sizeof(cpuset), &cpuset ); + + rv_create = pthread_create( thread_state, &attr, thread_function, thread_user_state ); + + if( rv_create == 0 ) + rv = 1; + + pthread_attr_destroy( &attr ); + + return( rv ); + } + +#endif + + + + + +/****************************************************************************/ +#if( !defined TEST_PAL_THREAD_START ) + + #error test_pal_thread_start() not implemented for this platform. + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c new file mode 100644 index 0000000000..bd4a8c01f7 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c @@ -0,0 +1,69 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#if( defined _WIN32 && NTDDI_VERSION >= NTDDI_WINXP ) + + /* TRD : _WIN32 indicates 32-bit or 64-bit Windows + NTDDI_VERSION indicates Windows version + - WaitForSingleObject requires XP + */ + + #ifdef TEST_PAL_THREAD_WAIT + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_thread_wait.c + #endif + + #define TEST_PAL_THREAD_WAIT + + void test_pal_thread_wait( test_pal_thread_state_t thread_state ) + { + WaitForSingleObject( thread_state, INFINITE ); + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( _POSIX_THREADS > 0 ) + + /* TRD : POSIX threads + + _POSIX_THREADS indicates POSIX threads + - pthread_join requires POSIX + */ + + #ifdef TEST_PAL_THREAD_WAIT + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_thread_wait.c + #endif + + #define TEST_PAL_THREAD_WAIT + + void test_pal_thread_wait( test_pal_thread_state_t thread_state ) + { + pthread_join( thread_state, NULL ); + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( !defined TEST_PAL_THREAD_WAIT ) + + #error test_pal_thread_wait() not implemented for this platform. + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c new file mode 100644 index 0000000000..9173d607c9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c @@ -0,0 +1,184 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void util_cmdline_init( struct util_cmdline_state *cs ) +{ + lfds700_pal_uint_t + loop; + + assert( cs != NULL ); + + for( loop = 0 ; loop < NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET ; loop++ ) + { + cs->args[loop].arg_type = LIBCOMMON_CMDLINE_ARG_TYPE_UNSET; + cs->args[loop].processed_flag = LOWERED; + } + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +void util_cmdline_cleanup( struct util_cmdline_state *cs ) +{ + assert( cs != NULL ); + + return; +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +void util_cmdline_add_arg( struct util_cmdline_state *cs, char arg_letter, enum util_cmdline_arg_type arg_type ) +{ + lfds700_pal_uint_t + index; + + assert( cs != NULL ); + assert( arg_letter >= 'a' and arg_letter <= 'z' ); + // TRD : arg_type can be any value in its range + + index = arg_letter - 'a'; + + cs->args[index].arg_type = arg_type; + + if( arg_type == LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ) + cs->args[index].arg_data.flag.flag = LOWERED; + + return; +} + + + + + +/****************************************************************************/ +int util_cmdline_process_args( struct util_cmdline_state *cs, int argc, char **argv ) +{ + char + *arg; + + int + arg_letter, + cc, + loop, + rv = 1; + + lfds700_pal_uint_t + index; + + assert( cs != NULL ); + assert( argc >= 1 ); + assert( argv != NULL ); + + for( loop = 1 ; loop < argc ; loop++ ) + { + arg = *(argv+loop); + + switch( *arg ) + { + case '-': + arg_letter = tolower( *(arg+1) ); + + if( arg_letter >= 'a' and arg_letter <= 'z' ) + { + index = arg_letter - 'a'; + + switch( cs->args[index].arg_type ) + { + case LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER_RANGE: + if( loop+1 >= argc ) + rv = 0; + + if( loop+1 < argc ) + { + cc = sscanf( *(argv+loop+1), "%llu-%llu", &cs->args[index].arg_data.integer_range.integer_start, &cs->args[index].arg_data.integer_range.integer_end ); + + if( cc != 2 ) + rv = 0; + + if( cc == 2 ) + { + cs->args[index].processed_flag = RAISED; + loop++; + } + } + break; + + case LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER: + if( loop+1 >= argc ) + rv = 0; + + if( loop+1 < argc ) + { + cc = sscanf( *(argv+loop+1), "%llu", &cs->args[index].arg_data.integer.integer ); + + if( cc != 1 ) + rv = 0; + + if( cc == 1 ) + { + cs->args[index].processed_flag = RAISED; + loop++; + } + } + break; + + case LIBCOMMON_CMDLINE_ARG_TYPE_FLAG: + cs->args[index].arg_data.flag.flag = RAISED; + cs->args[index].processed_flag = RAISED; + break; + + case LIBCOMMON_CMDLINE_ARG_TYPE_UNSET: + break; + } + } + break; + + default: + rv = 0; + break; + } + } + + return( rv ); +} + + + + + +/****************************************************************************/ +void util_cmdline_get_arg_data( struct util_cmdline_state *cs, char arg_letter, union util_cmdline_arg_data **arg_data ) +{ + lfds700_pal_uint_t + index; + + assert( cs != NULL ); + assert( arg_letter >= 'a' and arg_letter <= 'z' ); + assert( arg_data != NULL ); + + index = arg_letter - 'a'; + + if( cs->args[index].processed_flag == RAISED ) + *arg_data = &cs->args[index].arg_data; + else + *arg_data = NULL; + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h new file mode 100644 index 0000000000..a19b073499 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h @@ -0,0 +1,69 @@ +/***** defines *****/ +#define NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET 26 + +/***** enums *****/ +enum util_cmdline_arg_type +{ + LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER_RANGE, + LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER, + LIBCOMMON_CMDLINE_ARG_TYPE_FLAG, + LIBCOMMON_CMDLINE_ARG_TYPE_UNSET +}; + +/***** structs *****/ +struct util_cmdline_arg_integer_range +{ + int long long unsigned + integer_start, + integer_end; +}; + +struct util_cmdline_arg_integer +{ + int long long unsigned + integer; +}; + +struct util_cmdline_arg_flag +{ + enum flag + flag; +}; + +union util_cmdline_arg_data +{ + struct util_cmdline_arg_integer_range + integer_range; + + struct util_cmdline_arg_integer + integer; + + struct util_cmdline_arg_flag + flag; +}; + +struct util_cmdline_arg_letter_and_data +{ + enum util_cmdline_arg_type + arg_type; + + enum flag + processed_flag; + + union util_cmdline_arg_data + arg_data; +}; + +struct util_cmdline_state +{ + struct util_cmdline_arg_letter_and_data + args[NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET]; +}; + +/***** public protoypes *****/ +void util_cmdline_init( struct util_cmdline_state *cs ); +void util_cmdline_cleanup( struct util_cmdline_state *cs ); +void util_cmdline_add_arg( struct util_cmdline_state *cs, char arg_letter, enum util_cmdline_arg_type arg_type ); +int util_cmdline_process_args( struct util_cmdline_state *cs, int argc, char **argv ); +void util_cmdline_get_arg_data( struct util_cmdline_state *cs, char arg_letter, union util_cmdline_arg_data **arg_data ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c new file mode 100644 index 0000000000..3d4c0e79f4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c @@ -0,0 +1,75 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void *util_aligned_malloc( lfds700_pal_uint_t size, lfds700_pal_uint_t align_in_bytes ) +{ + lfds700_pal_uint_t + offset; + + void + *memory, + *original_memory; + + // TRD : size can be any value in its range + // TRD : align_in_bytes can be any value in its range + + /* TRD : helper function to provide aligned allocations + no porting required + */ + + original_memory = memory = util_malloc_wrapper( size + sizeof(void *) + align_in_bytes ); + + if( memory != NULL ) + { + memory = (void **) memory + 1; + offset = align_in_bytes - (lfds700_pal_uint_t) memory % align_in_bytes; + memory = (char unsigned *) memory + offset; + *( (void **) memory - 1 ) = original_memory; + } + + return( memory ); +} + + + + + +/****************************************************************************/ +void util_aligned_free( void *memory ) +{ + assert( memory != NULL ); + + // TRD : the "void *" stored above memory points to the root of the allocation + free( *( (void **) memory - 1 ) ); + + return; +} + + + + + +/****************************************************************************/ +void *util_malloc_wrapper( lfds700_pal_uint_t size ) +{ + void + *memory; + + // TRD : size can be any value in its range + + memory = malloc( size ); + + if( memory == NULL ) + { + puts( "malloc() failed, exiting." ); + exit( EXIT_FAILURE ); + } + + return( memory ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h new file mode 100644 index 0000000000..8341a1f2e3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h @@ -0,0 +1,5 @@ +/***** public prototypes *****/ +void *util_aligned_malloc( lfds700_pal_uint_t size, lfds700_pal_uint_t align_in_bytes ); +void util_aligned_free( void *memory ); +void *util_malloc_wrapper( lfds700_pal_uint_t size ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c new file mode 100644 index 0000000000..c008fa2c5d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c @@ -0,0 +1,151 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void util_thread_starter_new( struct util_thread_starter_state **tts, lfds700_pal_uint_t number_threads ) +{ + lfds700_pal_uint_t + loop; + + assert( tts != NULL ); + // TRD : number_threads cam be any value in its range + + *tts = util_malloc_wrapper( sizeof(struct util_thread_starter_state) ); + + (*tts)->tsts = util_malloc_wrapper( sizeof(struct util_thread_starter_thread_state) * number_threads ); + (*tts)->thread_start_flag = LOWERED; + (*tts)->number_thread_states = number_threads; + + for( loop = 0 ; loop < number_threads ; loop++ ) + { + ((*tts)->tsts+loop)->thread_ready_flag = LOWERED; + ((*tts)->tsts+loop)->thread_start_flag = &(*tts)->thread_start_flag; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + + + + + +/****************************************************************************/ +void util_thread_starter_start( struct util_thread_starter_state *tts, + test_pal_thread_state_t *thread_state, + lfds700_pal_uint_t thread_number, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ), + void *thread_user_state ) +{ + assert( tts != NULL ); + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + (tts->tsts+thread_number)->thread_user_state = thread_user_state; + + util_thread_start_wrapper( thread_state, lp, thread_function, tts->tsts+thread_number ); + + // TRD : wait for the thread to indicate it is ready and waiting + while( (tts->tsts+thread_number)->thread_ready_flag == LOWERED ); + + return; +} + + + + + +/****************************************************************************/ +void util_thread_starter_ready_and_wait( struct util_thread_starter_thread_state *tsts ) +{ + assert( tsts != NULL ); + + tsts->thread_ready_flag = RAISED; + + LFDS700_MISC_BARRIER_FULL; + + // TRD : threads here are all looping, so we don't need to force a store + + while( *tsts->thread_start_flag == LOWERED ) + LFDS700_MISC_BARRIER_LOAD; + + return; +} + + + + + +/****************************************************************************/ +void util_thread_starter_run( struct util_thread_starter_state *tts ) +{ + assert( tts != NULL ); + + /* TRD : all threads at this point are ready to go + as we wait for their ready flag immediately after their spawn + */ + + tts->thread_start_flag = RAISED; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + + + + + +/****************************************************************************/ +void util_thread_starter_delete( struct util_thread_starter_state *tts ) +{ + assert( tts != NULL ); + + free( tts->tsts ); + + free( tts ); + + return; +} + + + + + +/****************************************************************************/ +void util_thread_start_wrapper( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) +{ + int + rv; + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + rv = test_pal_thread_start( thread_state, lp, thread_function, thread_user_state ); + + if( rv == 0 ) + { + puts( "test_pal_thread_start() failed." ); + exit( EXIT_FAILURE ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h new file mode 100644 index 0000000000..5587edf1c0 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h @@ -0,0 +1,41 @@ +/***** structs *****/ +struct util_thread_starter_thread_state +{ + // TRD : must be volatile or the compiler optimizes it away into a single load + enum flag volatile + thread_ready_flag, + *thread_start_flag; + + void + *thread_user_state; +}; + +struct util_thread_starter_state +{ + enum flag volatile + thread_start_flag; + + lfds700_pal_uint_t + number_thread_states; + + struct util_thread_starter_thread_state + *tsts; +}; + +/***** prototypes *****/ +void util_thread_starter_new( struct util_thread_starter_state **tts, lfds700_pal_uint_t number_threads ); +void util_thread_starter_start( struct util_thread_starter_state *tts, + test_pal_thread_state_t *thread_state, + lfds700_pal_uint_t thread_number, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ), + void *thread_user_state ); +void util_thread_starter_ready_and_wait( struct util_thread_starter_thread_state *tsts ); +void util_thread_starter_run( struct util_thread_starter_state *tts ); +void util_thread_starter_delete( struct util_thread_starter_state *tts ); + +void util_thread_start_wrapper( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ); + -- GitLab From 70ad5d587e4dd4651f09fa5279468d7b0481a9a8 Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Mon, 5 Sep 2016 14:28:58 +0300 Subject: [PATCH 004/308] Functionality for a simple protocol agent exchanging echo_request/reply messages --- cmake_targets/CMakeLists.txt | 55 ++- openair2/COMMON/tasks_def.h | 3 + openair2/ENB_APP/enb_app.c | 7 + openair2/ENB_APP/enb_config.c | 44 ++- openair2/ENB_APP/enb_config.h | 7 + openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 44 ++- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 364 +++++------------- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 2 + .../LAYER2/PROTO_AGENT/proto_agent_async.c | 6 +- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 347 ++++++----------- .../LAYER2/PROTO_AGENT/proto_agent_common.h | 7 + .../LAYER2/PROTO_AGENT/proto_agent_defs.h | 2 +- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 65 ++-- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.c | 6 +- openair2/LAYER2/RLC/rlc.c | 3 + openair2/UTIL/ASYNC_IF/link_manager.c | 3 + openair2/UTIL/ASYNC_IF/link_manager.h | 4 +- openair2/UTIL/ASYNC_IF/socket_link.c | 49 ++- openair2/UTIL/LOG/log.c | 14 + openair2/UTIL/LOG/log.h | 1 + openair2/UTIL/LOG/log_extern.h | 4 + targets/COMMON/MESSAGES/V2/flexsplit.proto | 16 +- targets/COMMON/MESSAGES/V2/header.proto | 2 + targets/SIMU/USER/oaisim.c | 79 ++++ 24 files changed, 539 insertions(+), 595 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 9834d19266..7788902778 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -831,9 +831,12 @@ include_directories("${OPENAIR_DIR}/targets/COMMON") include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") +include_directories("${OPENAIR2_DIR}/UTIL/ASYNC_IF") +include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") +include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") +include_directories("${OPENAIR2_DIR}/LAYER2/PROTO_AGENT") include_directories("${OPENAIR2_DIR}/ENB_APP") include_directories("${OPENAIR2_DIR}/UTIL/OSA") -include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") include_directories("${OPENAIR2_DIR}/UTIL/MEM") include_directories("${OPENAIR2_DIR}/UTIL/LISTS") include_directories("${OPENAIR2_DIR}/UTIL/FIFO") @@ -854,7 +857,7 @@ include_directories("${OPENAIR_DIR}") ################ if (PDCP_SPLIT) # set the version of protobuf messages, V3 not supported yet - add_list1_option(FSPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3) + add_list1_option(FSPT_VERSION V2 "FSPT MSG protobuf grammar version" V2 V3) if (${FSPT_VERSION} STREQUAL "V2") set (FSPTDIR V2) @@ -871,7 +874,7 @@ if (PDCP_SPLIT) set(FSPT_C_DIR ${protobuf_generated_dir}/${FSPTDIR}) message("calling protoc_call=${protoc_call} FSPT_C_DIR=${FSPT_C_DIR} FSPT_MSG_FILES=${FSPT_MSG_FILES}") execute_process(COMMAND ${protoc_call} ${FSPT_C_DIR} ${FSPT_MSG_DIR} ${FSPT_MSG_FILES}) - file(GLOB PRPT_source ${FSPT_C_DIR}/*.c) + file(GLOB FSPT_source ${FSPT_C_DIR}/*.c) set(FSPT_OAI_generated ${FSPT_C_DIR}/header.pb-c.c ${FSPT_C_DIR}/flexsplit.pb-c.c @@ -897,6 +900,18 @@ if (PDCP_SPLIT) set(ASYNC_IF_LIB ASYNC_IF) include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + add_library(PROTO_AGENT + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c + ) + set(PROTO_AGENT_LIB PROTO_AGENT) + #include_directories(${OPENAIR2_DIR}/LAYER2/PROTO_AGENT) + + + set(PROTOBUF_LIB "protobuf-c") #set(PROTOBUF_LIB "protobuf") #for Cpp @@ -1525,6 +1540,24 @@ add_library(LFDS ${lfds}/lfds611_abstraction/lfds611_abstraction_malloc.c ) + +set(lfds7 ${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/src/) +file(GLOB lfds7_queue ${lfds7}/lfds700_queue/*.c) +file(GLOB lfds7_ring ${lfds7}/lfds700_ringbuffer/*.c) +file(GLOB lfds7_qbss ${lfds7}/lfds700_queue_bounded_singleconsumer_singleproducer/*.c) +file(GLOB lfds7_stack ${lfds7}/lfds700_stack/*.c) +file(GLOB lfds7_freelist ${lfds7}/lfds700_freelist/*.c) +file(GLOB lfds7_btree ${lfds7}/lfds700_btree_addonly_unbalanced/*.c) +file(GLOB lfds7_hash ${lfds7}/lfds700_hash_addonly/*.c) +file(GLOB lfds7_ordered_list ${lfds7}/lfds700_list_addonly_ordered_singlylinked/*.c) +file(GLOB lfds7_unordered_list ${lfds7}/lfds700_list_addonly_singlylinked_unordered/*.c) +file(GLOB lfds7_misc ${lfds7}/lfds700_misc/*.c) + +include_directories(${lfds7}) +add_library(LFDS7 + ${lfds7_queue} ${lfds7_ring} ${lfds7_qbss} ${lfds7_stack} ${lfds7_freelist} ${lfds7_btree} ${lfds7_hash} ${lfds7_ordered_list} ${lfds7_unordered_list} ${lfds7_misc} +) + # Simulation library ########################## add_library(SIMU @@ -1688,11 +1721,11 @@ add_executable(lte-softmodem target_link_libraries (lte-softmodem -ldl -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FSPT_MSG_LIB} ${ASYNC_IF_LIB} ${PROTO_AGENT_LIB} LFDS7 protobuf-c -Wl,--end-group ) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) +target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt ${PROTOBUF_LIB} crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES} -lboost_system) #Added manually as it is not found for some reason for USRP target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem ${T_LIB}) @@ -1724,11 +1757,11 @@ add_executable(lte-softmodem-nos1 ) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) +target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt ${PROTOBUF_LIB} crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES} -lboost_system) #Added manually as it is not found for some reason for USRP target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${T_LIB}) @@ -1827,11 +1860,11 @@ add_executable(oaisim target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim -Wl,--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 ${FSPT_MSG_LIB} ${ASYNC_IF_LIB} ${PROTO_AGENT_LIB} LFDS7 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} -Wl,--end-group ) target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) -target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} +target_link_libraries (oaisim pthread m ${PROTOBUF_LIB} ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES}) #Force link with forms, regardless XFORMS option target_link_libraries (oaisim forms) @@ -1866,11 +1899,11 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -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} + 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} ${FSPT_MSG_LIB} ${ASYNC_IF_LIB} ${PROTO_AGENT_LIB} LFDS7 protobuf-c -Wl,--end-group ) 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 ${PROTOBUF_LIB} ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES}) #Force link with forms, regardless XFORMS option target_link_libraries (oaisim_nos1 forms) diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index 5e0f8bd211..50823086af 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -80,3 +80,6 @@ TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200) //MESSAGE GENERATOR TASK TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200) +// Task for PROTO_AGENT +TASK_DEF(TASK_PROTO_AGENT, TASK_PRIORITY_MED, 200) + diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 6d95c215db..2098b01ccf 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -57,11 +57,16 @@ # include "gtpv1u_eNB_task.h" # endif + extern unsigned char NB_eNB_INST; #endif #if defined(ENABLE_ITTI) +#include "LAYER2/PROTO_AGENT/proto_agent.h" +//#include "../PROTO_AGENT/proto_agent.h" + + /*------------------------------------------------------------------------------*/ # if defined(ENABLE_USE_MME) # define ENB_REGISTER_RETRY_DELAY 10 @@ -311,6 +316,8 @@ void *eNB_app_task(void *args_p) for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { configure_phy(enb_id, enb_properties_p); configure_rrc(enb_id, enb_properties_p); + //proto_server_start(enb_id, enb_properties_p); + //proto_agent_start(enb_id, enb_properties_p); } # if defined(ENABLE_USE_MME) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 51d5f3805f..a405b95b6e 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -170,6 +170,14 @@ #define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U "ENB_IPV4_ADDRESS_FOR_S1U" #define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U" +#define ENB_CONFIG_STRING_FLEXSPLIT_CONFIG "FLEXSPLIT" +#define ENB_CONFIG_STRING_PROTO_AGENT_INTERFACE_NAME "PROTO_AGENT_INTERFACE_NAME" +#define ENB_CONFIG_STRING_PROTO_AGENT_IPV4_ADDRESS "PROTO_AGENT_IPV4_ADDRESS" +#define ENB_CONFIG_STRING_PROTO_AGENT_PORT "PROTO_AGENT_PORT" +#define ENB_CONFIG_STRING_PROTO_AGENT_CACHE "PROTO_AGENT_CACHE" + + + #define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config" #define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name" #define ENB_CONFIG_STRING_RRH_GW_LOCAL_ADDRESS "local_address" @@ -315,6 +323,7 @@ void enb_config_display(void) } } + for (j=0; j< enb_properties.properties[i]->nb_cc; j++) { printf( "\teutra band for CC %d: \t%"PRId16":\n",j,enb_properties.properties[i]->eutra_band[j]); printf( "\tdownlink freq for CC %d: \t%"PRIu64":\n",j,enb_properties.properties[i]->downlink_frequency[j]); @@ -625,6 +634,12 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) char *address = NULL; char *cidr = NULL; char *astring = NULL; + + char* proto_agent_interface_name = NULL; + char* proto_agent_ipv4_address = NULL; + libconfig_int proto_agent_port = 0; + char* proto_agent_cache = NULL; + libconfig_int otg_ue_id = 0; char* otg_app_type = NULL; char* otg_bg_traffic = NULL; @@ -2327,7 +2342,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) if (address) { IPV4_STR_ADDR_TO_INT_NWBO ( address, enb_properties.properties[enb_properties_index]->enb_ipv4_address_for_S1U, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); } - enb_properties.properties[enb_properties_index]->enb_port_for_S1U = enb_port_for_S1U; enb_properties.properties[enb_properties_index]->enb_interface_name_for_S1_MME = strdup(enb_interface_name_for_S1_MME); @@ -2340,6 +2354,34 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) } } +// PROTO_AGENT configuration + subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_FLEXSPLIT_CONFIG); + + if (subsetting != NULL) { + if ( ( + config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_INTERFACE_NAME, + (const char **)&proto_agent_interface_name) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_IPV4_ADDRESS, + (const char **)&proto_agent_ipv4_address) + && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_PROTO_AGENT_PORT, + &proto_agent_port) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_CACHE, + (const char **)&proto_agent_cache) + ) + ) { + enb_properties.properties[enb_properties_index]->proto_agent_interface_name = strdup(proto_agent_interface_name); + cidr = proto_agent_ipv4_address; + address = strtok(cidr, "/"); + enb_properties.properties[enb_properties_index]->proto_agent_ipv4_address = strdup(address); + + enb_properties.properties[enb_properties_index]->proto_agent_port = proto_agent_port; + enb_properties.properties[enb_properties_index]->proto_agent_cache = strdup(proto_agent_cache); + } + } + + + + // OTG _CONFIG setting_otg = config_setting_get_member (setting_enb, ENB_CONF_STRING_OTG_CONFIG); diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 5f7f2636a3..d8b7e6717b 100755 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -222,6 +222,13 @@ typedef struct Enb_properties_s { in_addr_t enb_ipv4_address_for_S1_MME; + char *proto_agent_interface_name; + in_addr_t proto_agent_ipv4_address; + tcp_udp_port_t proto_agent_port; + char *proto_agent_cache; + + + /* Nb of RRH to connect to */ uint8_t nb_rrh_gw; char *rrh_gw_if_name; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index d8fa42a19c..b72da56317 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -56,6 +56,10 @@ #include "UTIL/LOG/vcd_signal_dumper.h" #include "msc.h" +#include "ENB_APP/enb_config.h" +#include "LAYER2/PROTO_AGENT/proto_agent.h" + + #if defined(ENABLE_SECURITY) # include "UTIL/OSA/osa_defs.h" #endif @@ -73,6 +77,7 @@ extern int otg_enabled; #endif +//#include "LAYER2/PROTO_AGENT/proto_agent.h" //----------------------------------------------------------------------------- /* @@ -111,6 +116,7 @@ boolean_t pdcp_data_req( VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_IN); CHECK_CTXT_ARGS(ctxt_pP); + #if T_TRACER if (ctxt_pP->enb_flag != ENB_FLAG_NO) T(T_ENB_PDCP_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_buffer_sizeP)); @@ -361,6 +367,27 @@ boolean_t pdcp_data_req( #endif rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + + //starting async +// const Enb_properties_array_t *enb_properties_p = NULL; + Enb_properties_array_t *enb_properties_p = NULL; +// enb_properties_p = malloc(sizeof(Enb_properties_array_t)); +// memset(enb_properties_p, 0, sizeof(Enb_properties_array_t)); +// printf("starting the client\n\n"); + + printf("Starting the async client\\n"); +// new_thread(proto_server_start, NULL); + enb_properties_p = enb_config_get(); + + static int agent_started = 1; + + if (agent_started == 1) + { + agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p); + } + + + } switch (rlc_status) { @@ -410,9 +437,24 @@ boolean_t pdcp_data_req( Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size; } }*/ + + //starting async +// const Enb_properties_array_t *enb_properties_p = NULL; +// Enb_properties_array_t *enb_properties_p = NULL; +// enb_properties_p = malloc(sizeof(Enb_properties_array_t)); +// memset(enb_properties_p, 0, sizeof(Enb_properties_array_t)); +// printf("starting the client\n\n"); + +// printf("Starting the async client\\n"); +// new_thread(proto_server_start, NULL); +// enb_properties_p = enb_config_get(); + +// proto_agent_start(ctxt_pP->module_id, enb_properties_p); + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT); return ret; - + } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index c78c9d93d4..6aa0ba6693 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -37,152 +37,25 @@ #include "proto_agent_common.h" #include "log.h" #include "proto_agent.h" -//#include "enb_agent_mac_defs.h" // TODO: Check if they are needed - -//#include "enb_agent_extern.h" // TODO: Check if they are needed for this implementation - #include "assertions.h" - -#include "proto_agent_net_comm.h" // TODO: Check if they are needed +#include "proto_agent_net_comm.h" #include "proto_agent_async.h" -//#define TEST_TIMER - proto_agent_instance_t proto_agent[NUM_MAX_ENB]; proto_agent_instance_t proto_server[NUM_MAX_ENB]; -// Use the same configuration file for the moment - char in_ip[40]; static uint16_t in_port; char local_cache[40]; void *send_thread(void *args); -void *client_receive_thread(void *args); -void *server_receive_thread(void *args); -//void *server_send_thread(void *args); +void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); -//Protocol__ProgranMessage *enb_agent_timeout_prp(void* args); Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); +#define ECHO -/* - * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller - * and can interact with other itti tasks -*/ -void *proto_agent_task(void *args){ - - proto_agent_instance_t *d = (proto_agent_instance_t *) args; - Protocol__FlexsplitMessage *msg; - void *data; - int size; - err_code_t err_code; - int priority; - - MessageDef *msg_p = NULL; - const char *msg_name = NULL; - instance_t instance; - int result; - - - itti_mark_task_ready(TASK_PROTO_AGENT); - - do { - // Wait for a message - itti_receive_msg (TASK_PROTO_AGENT, &msg_p); - DevAssert(msg_p != NULL); - msg_name = ITTI_MSG_NAME (msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); - - switch (ITTI_MSG_ID(msg_p)) { - case TERMINATE_MESSAGE: - itti_exit_task (); - break; - - case MESSAGE_TEST: - LOG_I(PROTO_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); - break; - - case TIMER_HAS_EXPIRED: - msg = proto_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); - if (msg != NULL){ - data=proto_agent_pack_message(msg,&size); - if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(PROTO_AGENT,"sent message with size %d\n", size); - } - break; - - default: - LOG_E(PROTO_AGENT, "Received unexpected message %s\n", msg_name); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - continue; - error: - LOG_E(PROTO_AGENT,"proto_agent_task: error %d occured\n",err_code); - } while (1); - - return NULL; -} - -void *send_thread(void *args) { - - proto_agent_instance_t *d = args; - void *data; - int size; - int priority; - err_code_t err_code; - - Protocol__FlexsplitMessage *msg; - - void **init_msg; - int msg_flag = 0; - msg_flag = proto_agent_hello(d->enb_id, args, init_msg); - - if (msg_flag == -1) - { - LOG_E( PROTO_AGENT, "Server did not create the message\n"); - goto error; - } - if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, init_msg, sizeof(Protocol__FlexsplitMessage), 0)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(PROTO_AGENT,"sent message with size %d\n", size); - - -// msg=proto_agent_handle_message(d->enb_id, data, size); - - free(data); - - free(*init_msg); - // check if there is something to send back to the controller - if (msg != NULL){ - data=proto_agent_pack_message(msg,&size); - - if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(PROTO_AGENT,"sent message with size %d\n", size); - } - - //} - - return NULL; - -error: - LOG_E(PROTO_AGENT,"receive_thread: error %d occured\n",err_code); - return NULL; -} +/* Thread continuously listening for incomming packets */ void *receive_thread(void *args) { @@ -193,32 +66,31 @@ void *receive_thread(void *args) { err_code_t err_code; Protocol__FlexsplitMessage *msg; - + while (1) { if (proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - LOG_D(PROTO_AGENT,"received message with size %d\n", size); - - + LOG_D(PROTO_AGENT,"Received message with size %d and priority %d, calling message handle\n", size, priority); + msg=proto_agent_handle_message(d->enb_id, data, size); + if (msg == NULL) + { + LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + } + free(data); - - // check if there is something to send back to the controller - if (msg != NULL){ - data=proto_agent_pack_message(msg,&size); - if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, data, size, priority)) { + if (msg != NULL){ + if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - LOG_D(PROTO_AGENT,"sent message with size %d\n", size); } - } return NULL; @@ -254,40 +126,41 @@ pthread_t new_thread(void *(*f)(void *), void *b) { return t; } +/* Function to be called as a thread: + it is calling the proto_agent_server with + the appropriate arguments +*/ + +void * proto_server_init(void *args) +{ + LOG_D(PROTO_AGENT, "Initializing server thread for listening connections\n"); + mid_t mod_id = (mid_t) 1; + Enb_properties_array_t* enb_properties = NULL; + enb_properties = enb_config_get(); + proto_server_start(mod_id, (const Enb_properties_array_t*) enb_properties); + return NULL; +} -// This is the only function that we will call for the moment from this file +/* Server side function; upon a new connection + reception, sends the hello packets +*/ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; - printf("INSIDE PROTO_SERVER_START\n"); // Maybe change the RAN_LTE_OAI to protocol?? (e.g. PDCP) set_enb_vars(mod_id, RAN_LTE_OAI); proto_server[mod_id].enb_id = mod_id; /* * check the configuration - Getting all the values from the config file + * TODO: get the configuration optionally from the conf file */ - if (enb_properties->properties[mod_id]->proto_agent_cache != NULL) { - strncpy(local_cache, enb_properties->properties[mod_id]->proto_agent_cache, sizeof(local_cache)); - local_cache[sizeof(local_cache) - 1] = 0; - } else { - strcpy(local_cache, DEFAULT_PROTO_AGENT_CACHE); - } - - if (enb_properties->properties[mod_id]->proto_agent_ipv4_address != NULL) { - strncpy(in_ip, enb_properties->properties[mod_id]->proto_agent_ipv4_address, sizeof(in_ip) ); - in_ip[sizeof(in_ip) - 1] = 0; // terminate string - } else { - strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS ); - } - - if (enb_properties->properties[mod_id]->proto_agent_port != 0 ) { - in_port = enb_properties->properties[mod_id]->proto_agent_port; - } else { - in_port = DEFAULT_PROTO_AGENT_PORT ; - } - LOG_I(ENB_AGENT,"starting PROTO agent SERVER for module id %d on ipv4 %s, port %d\n", + strcpy(local_cache, DEFAULT_PROTO_AGENT_CACHE); + strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS ); + in_port = DEFAULT_PROTO_AGENT_PORT ; + + LOG_I(PROTO_AGENT,"Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d\n", proto_server[mod_id].enb_id, in_ip, in_port); @@ -298,76 +171,77 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie proto_agent_init_channel_container(); /*Create the async channel info*/ - printf("Before creating the async server channe;\n"); proto_agent_instance_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port); - printf("After creating the async server channe;\n"); /*Create a channel using the async channel info*/ - printf("Before creating the receive channel\n"); - - channel_id = proto_agent_create_channel((void *) channel_info, - proto_agent_async_msg_send, + channel_id = proto_agent_create_channel((void *) channel_info, + proto_agent_async_msg_send, proto_agent_async_msg_recv, proto_agent_async_release); - printf("After creating the receive channel\n"); - if (channel_id <= 0) { goto error; } - printf("Before getting ing the receive thread\n"); proto_agent_channel_t *channel = get_channel(channel_id); - printf("After getting ing the receive thread\n"); if (channel == NULL) { goto error; } /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ - printf("Before registering the receive channel \n"); - proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); - printf("After registering the receive channel\n"); - /*Example of registration for a specific agent(MAC): - *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); - */ + // Code for sending the HELLO/ECHO_REQ message once a connection is established + Protocol__FlexsplitMessage *msg = NULL; + Protocol__FlexsplitMessage *init_msg=NULL; + Protocol__FlexsplitMessage *rep_msg=NULL; + int msg_flag = 0; + int priority; + int size; - /*Initialize the continuous MAC stats update mechanism*/ - // For the moment we do not need this - // enb_agent_init_cont_mac_stats_update(mod_id); - printf("Before initializing the receive thread\n"); - //new_thread(send_thread, &proto_server[mod_id]); - new_thread(receive_thread, &proto_server[mod_id]); - printf("After initializing the receive thread\n"); +#ifdef ECHO + LOG_D(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); + msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); +#else + LOG_D(PROTO_AGENT, "Proto agent Server: Calling the hello packet constructor\n"); + msg_flag = proto_agent_hello(mod_id, NULL, &init_msg); +#endif - /* - * initilize a timer - */ - printf("Before initializing the receive timer\n"); - - proto_agent_init_timer(); + int msgsize = 0; + int err_code; + proto_agent_serialize_message(init_msg, &msg, &msgsize); - printf("After initializing the receive thread\n"); + LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); - /* - * start the enb agent task for tx and interaction with the underlying network function - */ + /* After sending the message, wait for any replies; + the server thread blocks until it reads any data + over the channel + */ + + LOG_D(PROTO_AGENT, "Server reading any message over the async channel.\n"); - if (itti_create_task (TASK_PROTO_AGENT, proto_agent_task, (void *) &proto_server[mod_id]) < 0) { - LOG_E(PROTO_AGENT, "Create task for eNB Agent failed\n"); - return -1; + while (1) { + if (proto_agent_msg_recv(mod_id, PROTO_AGENT_DEFAULT, &rep_msg, &size, &priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } } + LOG_D(PROTO_AGENT,"Server received reply message with size %d and priority %d, calling message handler\n", size, priority); + + msg=proto_agent_handle_message(mod_id, rep_msg, size); - new_thread(send_thread, &proto_server[mod_id]); - + if (msg == NULL) + { + LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + } - LOG_I(PROTO_AGENT,"server ends\n"); + LOG_I(PROTO_AGENT,"server ends\n"); return 0; error: - LOG_I(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT,"there was an error\n"); return 1; } @@ -376,34 +250,17 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties int channel_id; - printf("Starting client\n"); - - // Maybe change the RAN_LTE_OAI to protocol?? (e.g. PDCP) set_enb_vars(mod_id, RAN_LTE_OAI); proto_agent[mod_id].enb_id = mod_id; /* * check the configuration - Getting all the values from the config file */ - if (enb_properties->properties[mod_id]->proto_agent_cache != NULL) { - strncpy(local_cache, enb_properties->properties[mod_id]->proto_agent_cache, sizeof(local_cache)); - local_cache[sizeof(local_cache) - 1] = 0; - } else { - strcpy(local_cache, DEFAULT_PROTO_AGENT_CACHE); - } - - if (enb_properties->properties[mod_id]->proto_agent_ipv4_address != NULL) { - strncpy(in_ip, enb_properties->properties[mod_id]->proto_agent_ipv4_address, sizeof(in_ip) ); - in_ip[sizeof(in_ip) - 1] = 0; // terminate string - } else { - strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS ); - } - - if (enb_properties->properties[mod_id]->proto_agent_port != 0 ) { - in_port = enb_properties->properties[mod_id]->proto_agent_port; - } else { - in_port = DEFAULT_PROTO_AGENT_PORT ; - } + + strcpy(local_cache, DEFAULT_PROTO_AGENT_CACHE); + strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS ); + in_port = DEFAULT_PROTO_AGENT_PORT; + LOG_I(PROTO_AGENT,"starting PROTO agent client for module id %d on ipv4 %s, port %d\n", proto_agent[mod_id].enb_id, in_ip, @@ -422,14 +279,12 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties proto_agent_async_msg_send, proto_agent_async_msg_recv, proto_agent_async_release); - - if (channel_id <= 0) { goto error; } - proto_agent_channel_t *channel = get_channel(channel_id); - + proto_agent_channel_t *channel = get_channel(channel_id); + if (channel == NULL) { goto error; } @@ -441,59 +296,14 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); */ - /*Initialize the continuous MAC stats update mechanism*/ - // For the moment we do not need this - // enb_agent_init_cont_mac_stats_update(mod_id); - new_thread(receive_thread, &proto_agent[mod_id]); + LOG_D(PROTO_AGENT, "Client launched the the receive thread for mod_id %d\n", proto_agent[mod_id]); - /*Initialize and register the mac xface. Must be modified later - *for more flexibility in agent management */ - // We do not need this - // AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface)); - // enb_agent_register_mac_xface(mod_id, mac_agent_xface); - - /* - * initilize a timer - */ - - proto_agent_init_timer(); - - /* - * Initialize the mac agent - */ - //enb_agent_init_mac_agent(mod_id); - - /* - * start the enb agent task for tx and interaction with the underlying network function - */ - - if (itti_create_task (TASK_PROTO_AGENT, proto_agent_task, (void *) &proto_agent[mod_id]) < 0) { - LOG_E(PROTO_AGENT, "Create task for eNB Agent failed\n"); - return -1; - } - - LOG_I(PROTO_AGENT,"client ends\n"); return 0; error: - LOG_I(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT,"there was an error\n"); return 1; } - - - -Protocol__FlexsplitMessage *proto_agent_timeout(void* args){ - - // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); - //memcpy (timer_args, args, sizeof(*timer_args)); - proto_agent_timer_args_t *timer_args = (proto_agent_timer_args_t *) args; - - LOG_I(PROTO_AGENT, "proto_agent %d timeout\n", timer_args->mod_id); - //LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); - //LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); - - return NULL; -} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index b0d6020ce6..98030ce5b1 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -41,6 +41,8 @@ #include "ENB_APP/enb_config.h" // for enb properties #include "proto_agent_common.h" +void * proto_server_init(void *args); + int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 6299479bc4..0f730c1aed 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -51,8 +51,8 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char channel->enb_id = mod_id; /*Create a socket*/ printf("Starting async server\n"); - new_thread(new_link_server, (void *) &dst_port); - channel->link = (void *) &dst_port; + channel->link = new_link_server(dst_port); + //channel->link = NULL; printf("Started async server\n"); if (channel->link == NULL) goto error; @@ -79,7 +79,7 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char return channel; error: - LOG_I(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT,"there was an error\n"); return 1; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 0e6ed7d03b..f26634b818 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -49,6 +49,7 @@ void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB]; + /* * message primitives */ @@ -66,18 +67,16 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, i return 0; error: - LOG_E(PROTO_AGENT, "an error occured\n"); // change the com + LOG_E(PROTO_AGENT, "an error occured\n"); return -1; } - - /* We assume that the buffer size is equal to the message size. Should be chekced durint Tx/Rx */ int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg) { *msg = protocol__flexsplit_message__unpack(NULL, size, data); if (*msg == NULL) - goto error; + goto error; return 0; @@ -86,8 +85,6 @@ int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMes return -1; } - - int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header) { *header = malloc(sizeof(Protocol__FspHeader)); @@ -95,9 +92,11 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader ** goto error; protocol__fsp_header__init(*header); + LOG_D(PROTO_AGENT, "Initialized the PROTOBUF message header\n"); (*header)->version = FLEXSPLIT_VERSION; + LOG_D(PROTO_AGENT, "Set the vversion to FLEXSPLIT_VERSION\n"); + (*header)->has_version = 1; - // check if the type is set (*header)->type = type; (*header)->has_type = 1; (*header)->xid = xid; @@ -109,7 +108,6 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader ** return -1; } - int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { Protocol__FspHeader *header; @@ -118,7 +116,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0) goto error; - Protocol__FspHello *hello_msg; + Protocol__FspHello *hello_msg = NULL; hello_msg = malloc(sizeof(Protocol__FspHello)); if(hello_msg == NULL) goto error; @@ -163,270 +161,145 @@ int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) { return -1; } -// call this function to start a nanosecond-resolution timer -struct timespec timer_start(){ - struct timespec start_time; - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time); - return start_time; -} - -// call this function to end a timer, returning nanoseconds elapsed as a long -long timer_end(struct timespec start_time){ - struct timespec end_time; - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time); - long diffInNanos = end_time.tv_nsec - start_time.tv_nsec; - return diffInNanos; -} +int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexsplitMessage **msg) { + Protocol__FspHeader *header; + xid_t xid = 1; + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0) + goto error; + LOG_I(PROTO_AGENT,"Created the fsp message header\n"); -/* - * get generic info from RAN - */ + Protocol__FspEchoRequest *echo_request_msg = NULL; + echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest)); + if(echo_request_msg == NULL) + goto error; -void set_enb_vars(mid_t mod_id, ran_name_t ran){ + protocol__fsp_echo_request__init(echo_request_msg); + echo_request_msg->header = header; - switch (ran){ - case RAN_LTE_OAI : - enb[mod_id] = (void *)&eNB_mac_inst[mod_id]; - enb_ue[mod_id] = (void *)&eNB_mac_inst[mod_id].UE_list; - enb_rrc[mod_id] = (void *)&eNB_rrc_inst[mod_id]; - break; - default : + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); + if(*msg == NULL) goto error; - } + protocol__flexsplit_message__init(*msg); - return; + LOG_I(PROTO_AGENT,"setting the message direction to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG); + (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; + (*msg)->has_msg_dir = 1; + (*msg)->echo_request_msg = echo_request_msg; + return 0; error: - LOG_E(PROTO_AGENT, "unknown RAN name %d\n", ran); + if(header != NULL) + free(header); + if(echo_request_msg != NULL) + free(echo_request_msg); + if(*msg != NULL) + free(*msg); + return -1; } - -//struct proto_agent_map agent_map; -proto_agent_timer_instance_t timer_instance; -err_code_t proto_agent_init_timer(void){ +int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG) + goto error; - LOG_I(PROTO_AGENT, "init RB tree\n"); - - RB_INIT(&timer_instance.proto_agent_head); - - /* - struct proto_agent_timer_element_s e; - memset(&e, 0, sizeof(proto_agent_timer_element_t)); - RB_INSERT(proto_agent_map, &agent_map, &e); - */ - return PROTOCOL__FLEXSPLIT_ERR__NO_ERR; -} - -RB_GENERATE(proto_agent_map,proto_agent_timer_element_s, entry, proto_agent_compare_timer); - -/* The timer_id might not be the best choice for the comparison */ -int proto_agent_compare_timer(struct proto_agent_timer_element_s *a, struct proto_agent_timer_element_s *b){ - - if (a->timer_id < b->timer_id) return -1; - if (a->timer_id > b->timer_id) return 1; - - // equal timers + free(msg->echo_request_msg->header); + free(msg->echo_request_msg); + free(msg); return 0; -} - -err_code_t proto_agent_create_timer(uint32_t interval_sec, - uint32_t interval_usec, - agent_id_t agent_id, - instance_t instance, - uint32_t timer_type, - xid_t xid, - proto_agent_timer_callback_t cb, - void* timer_args, - long *timer_id){ - - struct proto_agent_timer_element_s *e = calloc(1, sizeof(*e)); - DevAssert(e != NULL); - -//uint32_t timer_id; - int ret=-1; - - if ((interval_sec == 0) && (interval_usec == 0 )) - return TIMER_NULL; - - if (timer_type >= PROTO_AGENT_TIMER_TYPE_MAX) - return TIMER_TYPE_INVALIDE; - - if (timer_type == PROTO_AGENT_TIMER_TYPE_ONESHOT){ - ret = timer_setup(interval_sec, - interval_usec, - TASK_PROTO_AGENT, - instance, - TIMER_ONE_SHOT, - timer_args, - timer_id); - - e->type = TIMER_ONE_SHOT; - } - else if (timer_type == PROTO_AGENT_TIMER_TYPE_PERIODIC ){ - ret = timer_setup(interval_sec, - interval_usec, - TASK_PROTO_AGENT, - instance, - TIMER_PERIODIC, - timer_args, - timer_id); - - e->type = TIMER_PERIODIC; - } - - if (ret < 0 ) { - return TIMER_SETUP_FAILED; - } - - e->agent_id = agent_id; - e->instance = instance; - e->state = PROTO_AGENT_TIMER_STATE_ACTIVE; - e->timer_id = *timer_id; - e->xid = xid; - e->timer_args = timer_args; - e->cb = cb; - /*element should be a real pointer*/ - RB_INSERT(proto_agent_map, &timer_instance.proto_agent_head, e); - LOG_I(PROTO_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n", - e->timer_id, e->agent_id, e->instance); - - return 0; + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } -err_code_t proto_agent_destroy_timer(long timer_id){ +int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - struct proto_agent_timer_element_s *e = get_timer_entry(timer_id); + xid_t xid; + Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; + Protocol__FspEchoRequest *echo_req = input->echo_request_msg; + xid = (echo_req->header)->xid; - if (e != NULL ) { - RB_REMOVE(proto_agent_map, &timer_instance.proto_agent_head, e); - proto_agent_destroy_flexsplit_message(e->timer_args->msg); - free(e); - } - - if (timer_remove(timer_id) < 0 ) + Protocol__FspHeader *header; + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0) goto error; - - return 0; - error: - LOG_E(PROTO_AGENT, "timer can't be removed\n"); - return TIMER_REMOVED_FAILED ; -} + Protocol__FspEchoReply *echo_reply_msg; + echo_reply_msg = malloc(sizeof(Protocol__FspEchoReply)); + if(echo_reply_msg == NULL) + goto error; + protocol__fsp_echo_reply__init(echo_reply_msg); + echo_reply_msg->header = header; -err_code_t proto_agent_destroy_timer_by_task_id(xid_t xid) { - struct proto_agent_timer_element_s *e = NULL; - long timer_id; - RB_FOREACH(e, proto_agent_map, &timer_instance.proto_agent_head) { - if (e->xid == xid) { - timer_id = e->timer_id; - RB_REMOVE(proto_agent_map, &timer_instance.proto_agent_head, e); - proto_agent_destroy_flexsplit_message(e->timer_args->msg); - free(e); - if (timer_remove(timer_id) < 0 ) { - goto error; - } - } - } + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); + if(*msg == NULL) + goto error; + protocol__flexsplit_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->has_msg_dir = 1; + (*msg)->echo_reply_msg = echo_reply_msg; return 0; error: - LOG_E(PROTO_AGENT, "timer can't be removed\n"); - return TIMER_REMOVED_FAILED ; + if(header != NULL) + free(header); + if(echo_reply_msg != NULL) + free(echo_reply_msg); + if(*msg != NULL) + free(*msg); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } -err_code_t proto_agent_destroy_timers(void){ - - struct proto_agent_timer_element_s *e = NULL; +int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG) + goto error; - RB_FOREACH(e, proto_agent_map, &timer_instance.proto_agent_head) { - RB_REMOVE(proto_agent_map, &timer_instance.proto_agent_head, e); - timer_remove(e->timer_id); - proto_agent_destroy_flexsplit_message(e->timer_args->msg); - free(e); - } - + free(msg->echo_reply_msg->header); + free(msg->echo_reply_msg); + free(msg); return 0; - -} - -void proto_agent_sleep_until(struct timespec *ts, int delay) { - ts->tv_nsec += delay; - if(ts->tv_nsec >= 1000*1000*1000){ - ts->tv_nsec -= 1000*1000*1000; - ts->tv_sec++; - } - clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL); + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } - /* - int i =0; - RB_FOREACH(e, proto_agent_map, &proto_agent_head) { - printf("%d: %p\n", i, e); i++; - } -*/ - - -err_code_t proto_agent_stop_timer(long timer_id){ - - struct proto_agent_timer_element_s *e=NULL; - struct proto_agent_timer_element_s search; - memset(&search, 0, sizeof(struct proto_agent_timer_element_s)); - search.timer_id = timer_id; - - e = RB_FIND(proto_agent_map, &timer_instance.proto_agent_head, &search); - - if (e != NULL ) { - e->state = PROTO_AGENT_TIMER_STATE_STOPPED; - } - - timer_remove(timer_id); - - return 0; +// call this function to start a nanosecond-resolution timer +struct timespec timer_start(){ + struct timespec start_time; + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time); + return start_time; } -struct proto_agent_timer_element_s * get_timer_entry(long timer_id) { - - struct proto_agent_timer_element_s search; - memset(&search, 0, sizeof(struct proto_agent_timer_element_s)); - search.timer_id = timer_id; - - return RB_FIND(proto_agent_map, &timer_instance.proto_agent_head, &search); +// call this function to end a timer, returning nanoseconds elapsed as a long +long timer_end(struct timespec start_time){ + struct timespec end_time; + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time); + long diffInNanos = end_time.tv_nsec - start_time.tv_nsec; + return diffInNanos; } +*/ /* -// this will change the timer_id -err_code_t enb_agent_restart_timer(uint32_t *timer_id){ - - struct enb_agent_timer_element_s *e=NULL; - - RB_FOREACH(e, enb_agent_map, &enb_agent_head) { - if (e->timer_id == timer_id) - break; - } + * get generic info from RAN + */ - if (e != NULL ) { - e->state = ENB_AGENT_TIMER_STATE_ACTIVE; - } - - ret = timer_setup(e->interval_sec, - e->interval_usec, - e->agent_id, - e->instance, - e->type, - e->timer_args, - &timer_id); - - } +void set_enb_vars(mid_t mod_id, ran_name_t ran){ - if (ret < 0 ) { - return PROTOCOL__PROGRAN_ERR__TIMER_SETUP_FAILED; + switch (ran){ + case RAN_LTE_OAI : + enb[mod_id] = (void *)&eNB_mac_inst[mod_id]; + enb_ue[mod_id] = (void *)&eNB_mac_inst[mod_id].UE_list; + enb_rrc[mod_id] = (void *)&eNB_rrc_inst[mod_id]; + break; + default : + goto error; } - - return 0; -} - -*/ + return; + error: + LOG_E(PROTO_AGENT, "unknown RAN name %d\n", ran); +} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index df8e320719..eb3623777f 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -87,6 +87,12 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **h int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg); +int proto_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg); +int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg); + + Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, uint8_t *data, @@ -97,6 +103,7 @@ Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args); + /**************************** * get generic info from RAN ****************************/ diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h index 85559e864b..466b165b26 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h @@ -43,7 +43,7 @@ #include "UTIL/ASYNC_IF/link_manager.h" -#define NUM_MAX_ENB 2 +#define NUM_MAX_ENB 10 #define NUM_MAX_UE 2048 #define DEFAULT_PROTO_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_PROTO_AGENT_PORT 2210 diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index b3e39bbd65..cbf3da8e24 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -36,19 +36,26 @@ #include "proto_agent_common.h" - -//#include "enb_agent_mac.h" // Do we need this? - #include "log.h" - #include "assertions.h" proto_agent_message_decoded_callback agent_messages_callback[][3] = { - {proto_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ + {proto_agent_hello, proto_agent_hello, 0}, + {proto_agent_echo_reply, 0, 0}, +// {proto_agent_rlc_data_req, proto_agent_rlc_data_req_ack, proto_agent_rlc_data_req_nack}, +// {proto_agent_pdcp_data_ind, proto_agent_pdcp_data_ind_ack, proto_agent_rlc_data_ind_nack}, }; proto_agent_message_destruction_callback message_destruction_callback[] = { proto_agent_destroy_hello, + proto_agent_destroy_echo_request, + proto_agent_destroy_echo_reply, +// proto_agent_destroy_rlc_data_req, +// proto_agent_destroy_rlc_data_req_ack, +// proto_agent_destroy_rlc_data_req_nack, +// proto_agent_destroy_pdcp_data_ind, +// proto_agent_destroy_pdcp_data_ind_ack, +// proto_agent_destroy_rlc_data_ind_nack, }; static const char *proto_agent_direction2String[] = { @@ -67,43 +74,45 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, err_code_t err_code; DevAssert(data != NULL); - if (proto_agent_deserialize_message(data, size, &decoded_message) < 0) { + LOG_D(PROTO_AGENT, "Deserializing message \n"); + if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) { err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; goto error; } - - // Undestand why these calculations take place + Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message; + if (header->has_type) + { + LOG_D(PROTO_AGENT, "Deserialized MSG type is %d\n", header->type); + } + if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) || (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; + LOG_D(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); goto error; } - - if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { - err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_SUPPORTED; - goto error; - - } err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); - if ( err_code < 0 ){ + if ( err_code < 0 ) + { goto error; - } else if (err_code == 1) { //If err_code > 1, we do not want to dispose the message yet + } + else if (err_code == 1) + { protocol__flexsplit_message__free_unpacked(decoded_message, NULL); } + LOG_D(PROTO_AGENT,"Returning REPLY message after the callback\n"); return reply_message; error: LOG_E(PROTO_AGENT,"errno %d occured\n",err_code); return NULL; - } void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, uint32_t * size){ - void * buffer; err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR; @@ -118,8 +127,7 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, DevAssert(buffer !=NULL); - LOG_D(PROTO_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); - + LOG_D(PROTO_AGENT,"Serialized the enb mac stats reply (size %d)\n", *size); return buffer; error : @@ -128,23 +136,6 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, return NULL; } -Protocol__FlexsplitMessage* proto_agent_process_timeout(long timer_id, void* timer_args){ - - struct proto_agent_timer_element_s *found = get_timer_entry(timer_id); - - if (found == NULL ) goto error; -// LOG_I(PROTO_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); - - if (timer_args == NULL) - LOG_W(PROTO_AGENT,"null timer args\n"); - -// return found->cb(timer_args); - return 1; - error: - LOG_E(PROTO_AGENT, "can't get the timer element\n"); - return TIMER_ELEMENT_NOT_FOUND; -} - err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg) { return ((*message_destruction_callback[msg->msg_case-1])(msg)); } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index 51a909261f..d6706e42ab 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -126,7 +126,7 @@ int proto_agent_create_channel(void *channel_info, /*element should be a real pointer*/ RB_INSERT(proto_agent_channel_map, &channel_instance.proto_agent_head, channel); - LOG_I(PROTO_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); + LOG_D(PROTO_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); return channel_id; } @@ -166,10 +166,10 @@ int proto_agent_destroy_channel(int channel_id) { err_code_t proto_agent_init_channel_container(void) { int i, j; - LOG_I(PROTO_AGENT, "init RB tree for channel container\n"); + LOG_D(PROTO_AGENT, "init RB tree for channel container\n"); RB_INIT(&channel_instance.proto_agent_head); - + for (i = 0; i < NUM_MAX_ENB; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { agent_channel[i][j] == NULL; diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index af0fe46875..92c8919423 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -43,6 +43,9 @@ #include "assertions.h" +#include "ENB_APP/enb_config.h" +#include "LAYER2/PROTO_AGENT/proto_agent.h" + extern boolean_t pdcp_data_ind( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 0ab2ecc2b2..4eb8b701f0 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -34,6 +34,9 @@ * \email: cedric.roux@eurecom.fr * @ingroup _mac */ +//#ifndef SERVER_TEST +//#define SERVER_TEST +//#endif #include "link_manager.h" #include "log.h" diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index 4f0628c0ee..1f3049d0b2 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -38,8 +38,8 @@ #ifndef LINK_MANAGER_H #define LINK_MANAGER_H -//#include "message_queue.h" -#include "ringbuffer_queue.h" +#include "message_queue.h" +//#include "ringbuffer_queue.h" #include "socket_link.h" #include <pthread.h> diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index f4bd248f78..9ddfb842e2 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -58,31 +58,31 @@ socket_link_t *new_link_server(int port) socklen_t addrlen; int socket_server = -1; int no_delay; - + ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { - LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); goto error; } ret->socket_fd = -1; - LOG_D(MAC, "create a new link server socket at port %d\n", port); + LOG_D(PROTO_AGENT, "create a new link server socket at port %d\n", port); socket_server = socket(AF_INET, SOCK_STREAM, 0); if (socket_server == -1) { - LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } reuse = 1; if (setsockopt(socket_server, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) { - LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } no_delay = 1; if (setsockopt(socket_server, IPPROTO_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { - LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } @@ -90,32 +90,33 @@ socket_link_t *new_link_server(int port) addr.sin_port = htons(port); addr.sin_addr.s_addr = INADDR_ANY; if (bind(socket_server, (struct sockaddr *)&addr, sizeof(addr)) == -1) { - LOG_E(MAC, "%s:%d: bind: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: bind: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } if (listen(socket_server, 5)) { - LOG_E(MAC, "%s:%d: listen: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: listen: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } addrlen = sizeof(addr); ret->socket_fd = accept(socket_server, (struct sockaddr *)&addr, &addrlen); if (ret->socket_fd == -1) { - LOG_E(MAC, "%s:%d: accept: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: accept: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } - + printf("Accepted new connection from client\n"); close(socket_server); - LOG_D(MAC, "connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + LOG_D(PROTO_AGENT, "connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + return ret; error: close(socket_server); if (ret != NULL) close(ret->socket_fd); free(ret); - LOG_E(MAC, "ERROR in new_link_server (see above), returning NULL\n"); + LOG_E(PROTO_AGENT, "ERROR in new_link_server (see above), returning NULL\n"); return NULL; } @@ -132,32 +133,31 @@ socket_link_t *new_link_client(char *server, int port) } ret->socket_fd = -1; - LOG_D(MAC, "create a new link client socket connecting to %s:%d\n", server, port); + LOG_I(PROTO_AGENT, "Creating a new link client socket connecting to %s:%d\n", server, port); ret->socket_fd = socket(AF_INET, SOCK_STREAM, 0); if (ret->socket_fd == -1) { - LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } no_delay = 1; if (setsockopt(ret->socket_fd, SOL_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { - LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } addr.sin_family = AF_INET; addr.sin_port = htons(port); if (inet_aton(server, &addr.sin_addr) == 0) { - LOG_E(MAC, "invalid IP address '%s', use a.b.c.d notation\n", server); + LOG_E(PROTO_AGENT, "invalid IP address '%s', use a.b.c.d notation\n", server); goto error; } if (connect(ret->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { - LOG_E(MAC, "%s:%d: connect: %s\n", __FILE__, __LINE__, strerror(errno)); + LOG_E(PROTO_AGENT, "%s:%d: connect: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } - - LOG_D(MAC, "connection to %s:%d established\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + LOG_D(PROTO_AGENT, "connection to %s:%d established\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); return ret; error: @@ -178,7 +178,7 @@ static int socket_send(int socket_fd, void *buf, int size) while (size) { l = send(socket_fd, s, size, MSG_NOSIGNAL); if (l == -1) goto error; - if (l == 0) { LOG_E(MAC, "%s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } + if (l == 0) { LOG_E(PROTO_AGENT, "%s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } size -= l; s += l; } @@ -186,7 +186,7 @@ static int socket_send(int socket_fd, void *buf, int size) return 0; error: - LOG_E(MAC, "socket_send: ERROR: %s\n", strerror(errno)); + LOG_E(PROTO_AGENT, "socket_send: ERROR: %s\n", strerror(errno)); return -1; } @@ -268,6 +268,11 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) link->bytes_received += 4; + + + LOG_I(PROTO_AGENT, "ASYNC BYTES Received are :%d \n", link->bytes_received); + LOG_I(PROTO_AGENT, "Size is :%d \n", size); + data = malloc(size); if (data == NULL) { LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); @@ -280,6 +285,8 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) link->bytes_received += size; link->packets_received++; + LOG_I(PROTO_AGENT, "received %d bytes\n", link->bytes_received); + *ret_data = data; *ret_size = size; return 0; diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index 0ef8f99d71..6ee74a4b43 100755 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -94,6 +94,10 @@ int log_list_nb_elements = 0; pthread_mutex_t log_lock; pthread_cond_t log_notify; +pthread_mutex_t async_server_lock; +pthread_cond_t async_server_notify; +int async_server_shutdown; + #if !defined(LOG_NO_THREAD) int log_list_head = 0; int log_shutdown; @@ -285,6 +289,16 @@ int logInit (void) g_log->log_component[MSC].filelog = 0; g_log->log_component[MSC].filelog_name = "/tmp/msc.log"; + g_log->log_component[PROTO_AGENT].name = "PROTO_AGENT"; + g_log->log_component[PROTO_AGENT].level = LOG_EMERG; + g_log->log_component[PROTO_AGENT].flag = LOG_MED; + g_log->log_component[PROTO_AGENT].interval = 1; + g_log->log_component[PROTO_AGENT].fd = 0; + g_log->log_component[PROTO_AGENT].filelog = 0; + g_log->log_component[PROTO_AGENT].filelog_name = "/tmp/proto_agent.log"; + + + g_log->log_component[OCM].name = "OCM"; g_log->log_component[OCM].level = LOG_EMERG; g_log->log_component[OCM].flag = LOG_MED; diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index dce5a190e4..e543052eed 100755 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -282,6 +282,7 @@ typedef enum { USIM, LOCALIZE, RRH, + PROTO_AGENT, X2AP, MAX_LOG_COMPONENTS, } diff --git a/openair2/UTIL/LOG/log_extern.h b/openair2/UTIL/LOG/log_extern.h index fbae536524..8e6e16a68f 100644 --- a/openair2/UTIL/LOG/log_extern.h +++ b/openair2/UTIL/LOG/log_extern.h @@ -31,6 +31,10 @@ extern log_t *g_log; +extern pthread_mutex_t async_server_lock; +extern pthread_cond_t async_server_notify; +extern int async_server_shutdown; + #if !defined(LOG_NO_THREAD) extern LOG_params log_list[2000]; extern pthread_mutex_t log_lock; diff --git a/targets/COMMON/MESSAGES/V2/flexsplit.proto b/targets/COMMON/MESSAGES/V2/flexsplit.proto index 270750e406..a7987b407c 100644 --- a/targets/COMMON/MESSAGES/V2/flexsplit.proto +++ b/targets/COMMON/MESSAGES/V2/flexsplit.proto @@ -6,6 +6,8 @@ message flexsplit_message { optional flexsplit_direction msg_dir = 100; oneof msg { fsp_hello hello_msg = 1; + fsp_echo_request echo_request_msg = 2; + fsp_echo_reply echo_reply_msg = 3; } } @@ -41,4 +43,16 @@ enum flexsplit_err { message fsp_hello { optional fsp_header header = 1; -} \ No newline at end of file +} + +message fsp_echo_request { + optional fsp_header header = 1; +// extensions 100 to 199; +} + + +message fsp_echo_reply { + optional fsp_header header = 1; +// extensions 100 to 199; +} + diff --git a/targets/COMMON/MESSAGES/V2/header.proto b/targets/COMMON/MESSAGES/V2/header.proto index 937e601884..043134b40e 100644 --- a/targets/COMMON/MESSAGES/V2/header.proto +++ b/targets/COMMON/MESSAGES/V2/header.proto @@ -9,5 +9,7 @@ message fsp_header { enum fsp_type { // Discovery and maintenance messages FSPT_HELLO = 0; + FSPT_ECHO_REQUEST = 1; + FSPT_ECHO_REPLY = 2; } diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 744952b5d0..02ad877456 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -78,6 +78,8 @@ #include "PHY/TOOLS/lte_phy_scope.h" //#endif +//#include "LAYER2/PROTO_AGENT/proto_agent.h" + #ifdef SMBV // Rohde&Schwarz SMBV100A vector signal generator #include "PHY/TOOLS/smbv.h" @@ -115,6 +117,8 @@ char smbv_ip[16]; #include "T.h" +#include "LAYER2/PROTO_AGENT/proto_agent.h" + /* DCI0_5MHz_TDD0_t UL_alloc_pdu; DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu; @@ -255,6 +259,73 @@ help (void) } pthread_t log_thread; +pthread_t async_server_thread; +int async_server_thread_finalize (void); + +void +async_server_thread_init (void) +{ + //create log_list + //log_list_init(&log_list); + + async_server_shutdown = 0; + + if ((pthread_mutex_init (&async_server_lock, NULL) != 0) + || (pthread_cond_init (&async_server_notify, NULL) != 0)) { + return; + } + + if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL) + != 0) { + async_server_thread_finalize(); + return; + } + + +} + +//Call it after the last LOG call +int +async_server_thread_finalize (void) +{ + int err = 0; + + + if (pthread_mutex_lock (&async_server_lock) != 0) { + return -1; + } + + async_server_shutdown = 1; + + /* Wake up LOG thread */ + if ((pthread_cond_broadcast (&async_server_notify) != 0) + || (pthread_mutex_unlock (&async_server_lock) != 0)) { + err = -1; + } + + if (pthread_join (async_server_thread, NULL) != 0) { + err = -1; + } + + if (pthread_mutex_unlock (&async_server_lock) != 0) { + err = -1; + } + + if (!err) { + //log_list_free(&log_list); + pthread_mutex_lock (&async_server_lock); + pthread_mutex_destroy (&async_server_lock); + pthread_cond_destroy (&async_server_notify); + } + + + return err; +} + + + + + void log_thread_init (void) @@ -1279,6 +1350,7 @@ main (int argc, char **argv) int port,Process_Flag=0,wgt,Channel_Flag=0,temp; #endif + //default parameters oai_emulation.info.n_frames = MAX_FRAME_NUMBER; //1024; //10; oai_emulation.info.n_frames_flag = 0; //fixme @@ -1339,6 +1411,9 @@ main (int argc, char **argv) init_omv (); #endif //Before this call, NB_UE_INST and NB_eNB_INST are not set correctly + + + check_and_adjust_params (); set_seed = oai_emulation.emulation_config.seed.value; @@ -1353,12 +1428,14 @@ main (int argc, char **argv) init_ocm (); + #ifdef SMBV // Rohde&Schwarz SMBV100A vector signal generator smbv_init_config(smbv_fname, smbv_nframes); smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->lte_frame_parms); #endif + // add events to future event list: Currently not used //oai_emulation.info.oeh_enabled = 1; if (oai_emulation.info.oeh_enabled == 1) @@ -1374,6 +1451,8 @@ main (int argc, char **argv) t = clock (); + async_server_thread_init(); + LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n"); -- GitLab From 96e46e77e26195b02361edc7c75c3a6efd6077de Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Thu, 8 Sep 2016 20:44:33 +0300 Subject: [PATCH 005/308] RLC_DATA_REQ Message is created and sent over the async channel, initial functionality preserved --- cmake_targets/CMakeLists.txt | 12 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 26 +- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 162 +++++++++++- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 5 +- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 246 +++++++++++++++++- .../LAYER2/PROTO_AGENT/proto_agent_common.h | 23 +- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 6 +- openair2/LAYER2/RLC/rlc.c | 79 +++++- openair2/LAYER2/RLC/rlc.h | 11 + openair2/UTIL/ASYNC_IF/socket_link.c | 2 + openair2/UTIL/LOG/log.c | 3 - openair2/UTIL/LOG/log.h | 5 + .../MESSAGES/V2/flexsplit-messages.proto | 36 +++ targets/COMMON/MESSAGES/V2/flexsplit.proto | 21 ++ targets/COMMON/MESSAGES/V2/header.proto | 3 + targets/SIMU/USER/oaisim.c | 126 ++++----- 16 files changed, 672 insertions(+), 94 deletions(-) create mode 100644 targets/COMMON/MESSAGES/V2/flexsplit-messages.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 7788902778..8a01b4c512 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -830,6 +830,9 @@ include_directories("${OPENAIR3_DIR}/GTPV1-U") include_directories("${OPENAIR_DIR}/targets/COMMON") include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/") +include_directories("${OPENAIR2_DIR}/UTIL/MEM") +include_directories("${OPENAIR2_DIR}/UTIL/LISTS") +include_directories("${OPENAIR2_DIR}/UTIL/FIFO") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") include_directories("${OPENAIR2_DIR}/UTIL/ASYNC_IF") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") @@ -837,9 +840,6 @@ include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") include_directories("${OPENAIR2_DIR}/LAYER2/PROTO_AGENT") include_directories("${OPENAIR2_DIR}/ENB_APP") include_directories("${OPENAIR2_DIR}/UTIL/OSA") -include_directories("${OPENAIR2_DIR}/UTIL/MEM") -include_directories("${OPENAIR2_DIR}/UTIL/LISTS") -include_directories("${OPENAIR2_DIR}/UTIL/FIFO") include_directories("${OPENAIR2_DIR}/UTIL/OCG") include_directories("${OPENAIR2_DIR}/UTIL/MATH") include_directories("${OPENAIR2_DIR}/UTIL/TIMER") @@ -858,17 +858,18 @@ include_directories("${OPENAIR_DIR}") if (PDCP_SPLIT) # set the version of protobuf messages, V3 not supported yet add_list1_option(FSPT_VERSION V2 "FSPT MSG protobuf grammar version" V2 V3) - + if (${FSPT_VERSION} STREQUAL "V2") set (FSPTDIR V2) elseif (${FSPT_VERSION} STREQUAL "V3") set (FSPTDIR V3) endif(${FSPT_VERSION} STREQUAL "V2") - + set(FSPT_MSG_DIR ${OPENAIR_DIR}/targets/COMMON/MESSAGES/${FSPTDIR} ) set(FSPT_MSG_FILES ${FSPT_MSG_DIR}/header.proto ${FSPT_MSG_DIR}/flexsplit.proto + ${FSPT_MSG_DIR}/flexsplit-messages.proto ) set(FSPT_C_DIR ${protobuf_generated_dir}/${FSPTDIR}) @@ -878,6 +879,7 @@ if (PDCP_SPLIT) set(FSPT_OAI_generated ${FSPT_C_DIR}/header.pb-c.c ${FSPT_C_DIR}/flexsplit.pb-c.c + ${FSPT_C_DIR}/flexsplit-messages.pb-c.c ) file(GLOB fspt_h ${FSPT_C_DIR}/*.h) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index b72da56317..3b790e3e5f 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -56,8 +56,7 @@ #include "UTIL/LOG/vcd_signal_dumper.h" #include "msc.h" -#include "ENB_APP/enb_config.h" -#include "LAYER2/PROTO_AGENT/proto_agent.h" + #if defined(ENABLE_SECURITY) @@ -73,12 +72,14 @@ # include "gtpv1u.h" #endif +#include "ENB_APP/enb_config.h" +#include "LAYER2/PROTO_AGENT/proto_agent.h" + + #ifndef OAI_EMU extern int otg_enabled; #endif -//#include "LAYER2/PROTO_AGENT/proto_agent.h" - //----------------------------------------------------------------------------- /* * If PDCP_UNIT_TEST is set here then data flow between PDCP and RLC is broken @@ -365,7 +366,6 @@ boolean_t pdcp_data_req( LOG_F(PDCP,"\n"); #endif - rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); //starting async @@ -375,7 +375,7 @@ boolean_t pdcp_data_req( // memset(enb_properties_p, 0, sizeof(Enb_properties_array_t)); // printf("starting the client\n\n"); - printf("Starting the async client\\n"); +// printf("Starting the async client\n"); // new_thread(proto_server_start, NULL); enb_properties_p = enb_config_get(); @@ -385,9 +385,17 @@ boolean_t pdcp_data_req( { agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p); } - - - + + // Send a Hello Message Everytime that we have a packet + //proto_agent_send_hello(); + //printf("PROTOPDCP is sending a message request\n"); + //printf("PROTOPDCP: vals are %u, %u, %u, %u, %u, %u, %u \n", ctxt_pP, srb_flagP, rb_idP, muiP, confirmP, pdcp_pdu_size); + if (pdcp_pdu_p!=NULL) + { + proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + } + rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + } switch (rlc_status) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 6aa0ba6693..ec31133752 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -41,6 +41,7 @@ #include "proto_agent_net_comm.h" #include "proto_agent_async.h" + proto_agent_instance_t proto_agent[NUM_MAX_ENB]; proto_agent_instance_t proto_server[NUM_MAX_ENB]; @@ -53,6 +54,9 @@ void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); +mid_t client_mod, server_mod; +proto_agent_instance_t *client_channel, *server_channel; + #define ECHO /* Thread continuously listening for incomming packets */ @@ -152,6 +156,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie set_enb_vars(mod_id, RAN_LTE_OAI); proto_server[mod_id].enb_id = mod_id; + server_mod = mod_id; /* * check the configuration - Getting all the values from the config file * TODO: get the configuration optionally from the conf file @@ -172,6 +177,8 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie /*Create the async channel info*/ proto_agent_instance_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port); + + server_channel = channel_info; /*Create a channel using the async channel info*/ channel_id = proto_agent_create_channel((void *) channel_info, @@ -252,6 +259,7 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties set_enb_vars(mod_id, RAN_LTE_OAI); proto_agent[mod_id].enb_id = mod_id; + client_mod = mod_id; /* * check the configuration - Getting all the values from the config file @@ -273,7 +281,7 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties /*Create the async channel info*/ proto_agent_instance_t *channel_info = proto_agent_async_channel_info(mod_id, in_ip, in_port); - + client_channel = channel_info; /*Create a channel using the async channel info*/ channel_id = proto_agent_create_channel((void *) channel_info, proto_agent_async_msg_send, @@ -307,3 +315,155 @@ error: } + +void +proto_agent_send_hello(void) +{ + Protocol__FlexsplitMessage *msg = NULL; + Protocol__FlexsplitMessage *init_msg=NULL; + //Protocol__FlexsplitMessage *rep_msg=NULL; + int msg_flag = 0; + //int priority; + //int size; + + LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n"); + msg_flag = proto_agent_hello(proto_agent[client_mod].enb_id, NULL, &init_msg); + + int msgsize = 0; + //int err_code; + if (msg_flag > 0) + { + proto_agent_serialize_message(init_msg, &msg, &msgsize); + } + + LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); +} + + +void +proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, + confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) +{ + + printf("PROTOPDCP: sendig the data req over the async channel\n"); + + Protocol__FlexsplitMessage *msg = NULL; + Protocol__FlexsplitMessage *init_msg=NULL; + //Protocol__FlexsplitMessage *rep_msg=NULL; + int msg_flag = 0; + void *data=NULL; + int priority; + int size; + int ret; + int err_code; + + LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n"); + + //EDW + printf("instance is %u, %u\n", ctxt_pP->instance, ctxt_pP->frame); + data_req_args *args = malloc(sizeof(data_req_args)); + + args->ctxt = malloc(sizeof(protocol_ctxt_t)); + memcpy(args->ctxt, ctxt_pP, sizeof(protocol_ctxt_t)); + args->srb_flag = srb_flagP; + args->MBMS_flag = MBMS_flagP; + args->rb_id = rb_idP; + args->mui = muiP; + args->confirm = confirmP; + args->sdu_size = sdu_sizeP; + args->sdu_p = malloc(sdu_sizeP); + memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); + + msg_flag = proto_agent_pdcp_data_req(proto_agent[client_mod].enb_id, (void *) args, &init_msg); + + printf("PROTO_AGENT msg flag is %d", msg_flag); + int msgsize = 0; + //int err_code; + proto_agent_serialize_message(init_msg, &msg, &msgsize); + + LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); + + + // Block until you receive the ACK with the op code + while (1) { + if (proto_agent_msg_recv(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(PROTO_AGENT,"Received message with size %d and priority %d, calling message handle\n", size, priority); + + msg=proto_agent_handle_message(proto_agent[client_mod].enb_id, data, size); + + if (msg == NULL) + { + LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + } + + free(data); + + if (msg != NULL){ + if (proto_agent_msg_send(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + LOG_D(PROTO_AGENT,"sent message with size %d\n", size); + } + } + +error: + LOG_E(PROTO_AGENT,"there was an error\n"); + return; + +} + + + + + +void * +proto_server_receive(void) +{ + proto_agent_instance_t *d = &proto_server[server_mod]; + void *data; + int size; + int priority; + err_code_t err_code; + + Protocol__FlexsplitMessage *msg; + + //while (1) { + if (proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_I(PROTO_AGENT,"Server Received message with size %d and priority %d, calling message handle\n", size, priority); + + msg=proto_agent_handle_message(d->enb_id, data, size); + + if (msg == NULL) + { + LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + } + + free(data); + + if (msg != NULL){ + if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + LOG_D(PROTO_AGENT,"sent message with size %d\n", size); + } + //} + + return NULL; + +error: + LOG_E(PROTO_AGENT,"receive_thread: error %d occured\n",err_code); + return NULL; + +} \ No newline at end of file diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 98030ce5b1..1815ee5374 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -37,11 +37,12 @@ #ifndef PROTO_AGENT_H_ #define PROTO_AGENT_H_ - -#include "ENB_APP/enb_config.h" // for enb properties #include "proto_agent_common.h" +//#include "ENB_APP/enb_config.h" // for enb properties + void * proto_server_init(void *args); +void * proto_server_receive(void); int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index f26634b818..a2a5de6edc 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -39,6 +39,7 @@ #include <time.h> #include "proto_agent_common.h" +//#include "proto_agent.h" #include "PHY/extern.h" #include "log.h" @@ -46,6 +47,9 @@ #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rrc_eNB_UE_context.h" + +//#include <protobuf-c/protobuf-c.h> + void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB]; @@ -108,6 +112,246 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader ** return -1; } +int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ + + // Initialize the PDCP params + data_req_args *args = (data_req_args *)params; + + // Create the protobuf header + Protocol__FspHeader *header; + xid_t xid = 1; + + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0) + goto error; + + /* Begin constructing the messages. They are defined as follows: + * 1) fspRlcPdu is storing the bytes of the packet + * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) + * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData + */ + Protocol__FspRlcPdu *pdu = NULL; + Protocol__FspCtxt *ctxt = NULL; + Protocol__FspRlcData *rlc_data = NULL; + Protocol__FspRlcDataReq *data_req = NULL; + + pdu = malloc(sizeof(Protocol__FspRlcPdu)); + ctxt = malloc(sizeof(Protocol__FspCtxt)); + rlc_data = malloc(sizeof(Protocol__FspRlcData)); + data_req = malloc(sizeof(Protocol__FspRlcDataReq)); + + protocol__fsp_rlc_pdu__init(pdu); + protocol__fsp_ctxt__init(ctxt); + protocol__fsp_rlc_data__init(rlc_data); + protocol__fsp_rlc_data_req__init(data_req); + + // Copy data to the RlcPdu structure + pdu->fsp_pdu_data.data = malloc(args->sdu_size); + pdu->fsp_pdu_data.len = args->sdu_size; + memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); + + pdu->has_fsp_pdu_data = 1; + + // Copy data to the ctxt structure + ctxt->fsp_mod_id = args->ctxt->module_id; + ctxt->fsp_enb_flag = args->ctxt->enb_flag; + ctxt->fsp_instance = args->ctxt->instance; + ctxt->fsp_rnti = args->ctxt->rnti; + ctxt->fsp_frame = args->ctxt->frame; + ctxt->fsp_subframe = args->ctxt->subframe; + ctxt->fsp_enb_index = args->ctxt->eNB_index; + + ctxt->has_fsp_mod_id = 1; + ctxt->has_fsp_enb_flag = 1; + ctxt->has_fsp_instance = 1; + ctxt->has_fsp_rnti = 1; + ctxt->has_fsp_frame = 1; + ctxt->has_fsp_subframe = 1; + ctxt->has_fsp_enb_index = 1; + + + rlc_data->fsp_ctxt = ctxt; + rlc_data->fsp_srb_flag = args->srb_flag; + rlc_data->fsp_mbms_flag = args->MBMS_flag; + rlc_data->fsp_rb_id = args->rb_id; + rlc_data->fsp_muip = args->mui; + rlc_data->fsp_confirm = args->confirm; + rlc_data->fsp_sdu_buffer_size = args->sdu_size; + rlc_data->fsp_pdu = pdu; + + rlc_data->has_fsp_srb_flag = 1; + rlc_data->has_fsp_mbms_flag = 1; + rlc_data->has_fsp_rb_id = 1; + rlc_data->has_fsp_muip = 1; + rlc_data->has_fsp_confirm = 1; + rlc_data->has_fsp_sdu_buffer_size = 1; + + // Up to here, everything is a signle message that is packed inside another. The final data_req + // will be created later, after the setting of all variables + + data_req->header = header; + data_req->enb_id = mod_id; + data_req->has_enb_id = 1; + data_req->pdcp_data = rlc_data; + + + + printf("PROTOPDCP:initialized the data_req\n"); + printf("PROTOPDCP2: instance is %u, fame is %u", args->ctxt->instance, args->ctxt->frame); + + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); + + if(*msg == NULL) + goto error; + + protocol__flexsplit_message__init(*msg); + + (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK + (*msg)->has_msg_dir = 1; + (*msg)->data_req_msg = data_req; //data_req; + + return 0; + + error: + if(header != NULL) + free(header); + if(pdu!=NULL) + free(pdu); + if(rlc_data!=NULL) + free(rlc_data); + if(data_req!= NULL) + free(data_req); + if(*msg != NULL) + free(*msg); + LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + return -1; + +} + +int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG) + goto error; + + free(msg->data_req_msg->header); + free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data); + free(msg->data_req_msg->pdcp_data->fsp_pdu); + free(msg->data_req_msg->pdcp_data->fsp_ctxt); + free(msg->data_req_msg->pdcp_data); + free(msg->data_req_msg); + free(msg); + return 0; + + error: + LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ + Protocol__FspHeader *header; + xid_t xid; + int result = 0; + + Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; + Protocol__FspRlcDataReq *data_req = input->data_req_msg; + xid = data_req->header->xid; + + Protocol__FspRlcPdu *pdu = NULL; + Protocol__FspCtxt *ctxt = NULL; + Protocol__FspRlcData *rlc_data = NULL; + + rlc_data = data_req->pdcp_data; + pdu = rlc_data->fsp_pdu; + ctxt = rlc_data->fsp_ctxt; + + protocol_ctxt_t* ctxt_pP = NULL; + srb_flag_t srb_flagP = 0; + rb_id_t rb_idP = 0; + mui_t muiP = 0; + confirm_t confirmP = 0; + uint16_t pdcp_pdu_size = 0; + boolean_t flag_MBMS = 0; + mem_block_t *pdcp_pdu_p = NULL; + + + // Create a new protocol context for handling the packet + + ctxt_pP = malloc(sizeof(protocol_ctxt_t)); + + ctxt_pP->module_id = ctxt->fsp_mod_id; + ctxt_pP->enb_flag = ctxt->fsp_enb_flag; + ctxt_pP->instance = ctxt->fsp_instance; + ctxt_pP->rnti = ctxt->fsp_rnti; + ctxt_pP->frame = ctxt->fsp_frame; + ctxt_pP->subframe = ctxt->fsp_subframe; + ctxt_pP->eNB_index = ctxt->fsp_enb_index; + + + srb_flagP = rlc_data->fsp_srb_flag; + flag_MBMS = rlc_data->fsp_mbms_flag; + rb_idP = rlc_data->fsp_rb_id; + muiP = rlc_data->fsp_muip; + confirmP = rlc_data->fsp_confirm; + pdcp_pdu_size = rlc_data->fsp_sdu_buffer_size; // Same as rlc_data->fsp_pdu_data.len + + pdcp_pdu_p = malloc(pdcp_pdu_size); + + memcpy(pdcp_pdu_p, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); + + // Ready to call the rlc_data_req + + result = rlc_data_req(ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ_ACK, &header) != 0) + goto error; + + Protocol__FspRlcDataReqAck *ack = NULL; + ack = malloc(sizeof(Protocol__FspRlcDataReqAck)); + protocol__fsp_rlc_data_req_ack__init(ack); + + ack->header = header; + ack->result = result; + ack->has_result = 1; + + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); + if(*msg == NULL) + goto error; + + protocol__flexsplit_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK; + (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->has_msg_dir = 1; + (*msg)->data_req_ack = ack; + return 0; + + error: + if(header != NULL) + free(header); + if(ack!=NULL) + free(ack); + if(*msg != NULL) + free(*msg); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; + +} + +int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK) + goto error; + + free(msg->data_req_ack->header); + free(msg->data_req_ack); + free(msg); + return 0; + + error: + LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + return -1; +} + int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { Protocol__FspHeader *header; @@ -137,7 +381,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa error: if(header != NULL) free(header); - if(hello_msg != NULL) + if(hello_msg!=NULL) free(hello_msg); if(*msg != NULL) free(*msg); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index eb3623777f..57cbf6a7d0 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -50,9 +50,10 @@ #include "proto_agent_defs.h" #include "enb_config.h" +#include "UTIL/MEM/mem_block.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/RLC/rlc.h" +//#include "LAYER2/MAC/extern.h" +//#include "LAYER2/RLC/rlc.h" # include "tree.h" # include "intertask_interface.h" @@ -92,6 +93,10 @@ int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg); int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg); +int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg); +int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg); Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, @@ -100,8 +105,18 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args); - - +typedef struct _data_req_args data_req_args; + +struct _data_req_args{ + protocol_ctxt_t* ctxt; + srb_flag_t srb_flag; + MBMS_flag_t MBMS_flag; + rb_id_t rb_id; + mui_t mui; + confirm_t confirm; + sdu_size_t sdu_size; + mem_block_t *sdu_p; +}; /**************************** diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index cbf3da8e24..b32094be32 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -42,7 +42,7 @@ proto_agent_message_decoded_callback agent_messages_callback[][3] = { {proto_agent_hello, proto_agent_hello, 0}, {proto_agent_echo_reply, 0, 0}, -// {proto_agent_rlc_data_req, proto_agent_rlc_data_req_ack, proto_agent_rlc_data_req_nack}, + {proto_agent_pdcp_data_req_ack, 0, 0}, // {proto_agent_pdcp_data_ind, proto_agent_pdcp_data_ind_ack, proto_agent_rlc_data_ind_nack}, }; @@ -50,8 +50,8 @@ proto_agent_message_destruction_callback message_destruction_callback[] = { proto_agent_destroy_hello, proto_agent_destroy_echo_request, proto_agent_destroy_echo_reply, -// proto_agent_destroy_rlc_data_req, -// proto_agent_destroy_rlc_data_req_ack, + proto_agent_destroy_pdcp_data_req, + proto_agent_destroy_pdcp_data_req_ack, // proto_agent_destroy_rlc_data_req_nack, // proto_agent_destroy_pdcp_data_ind, // proto_agent_destroy_pdcp_data_ind_ack, diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 92c8919423..940f1f11dc 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -43,8 +43,72 @@ #include "assertions.h" -#include "ENB_APP/enb_config.h" -#include "LAYER2/PROTO_AGENT/proto_agent.h" + + +// PROTO AGENT +void +async_server_thread_init (void) +{ + //create log_list + //log_list_init(&log_list); + + async_server_shutdown = 0; + + if ((pthread_mutex_init (&async_server_lock, NULL) != 0) + || (pthread_cond_init (&async_server_notify, NULL) != 0)) { + return; + } + + if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL) + != 0) { + async_server_thread_finalize(); + return; + } + + +} + + + +int +async_server_thread_finalize (void) +{ + int err = 0; + + + if (pthread_mutex_lock (&async_server_lock) != 0) { + return -1; + } + + async_server_shutdown = 1; + + /* Wake up LOG thread */ + if ((pthread_cond_broadcast (&async_server_notify) != 0) + || (pthread_mutex_unlock (&async_server_lock) != 0)) { + err = -1; + } + + if (pthread_join (async_server_thread, NULL) != 0) { + err = -1; + } + + if (pthread_mutex_unlock (&async_server_lock) != 0) { + err = -1; + } + + if (!err) { + //log_list_free(&log_list); + pthread_mutex_lock (&async_server_lock); + pthread_mutex_destroy (&async_server_lock); + pthread_cond_destroy (&async_server_notify); + } + + return err; +} + + + + extern boolean_t pdcp_data_ind( const protocol_ctxt_t* const ctxt_pP, @@ -420,7 +484,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, #ifdef DEBUG_RLC_DATA_REQ LOG_D(RLC,"RLC_TYPE : %d\n", rlc_mode); #endif - + switch (rlc_mode) { case RLC_MODE_NONE: free_mem_block(sdu_pP); @@ -457,6 +521,9 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, break; case RLC_MODE_UM: + + //proto_server_receive(); + new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc)); if (new_sdu_p != NULL) { @@ -658,6 +725,12 @@ rlc_module_init (void) pool_buffer_init(); + /* Launch the RLC listening server + * as a separate thread + */ + async_server_thread_init(); + + return(0); } //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 72fde0b746..79bdac92f2 100755 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -62,6 +62,12 @@ # include "SRB-ToAddModList.h" # include "DRB-ToReleaseList.h" +// for proto_agent operation +#include "UTIL/LOG/log.h" +#include "ENB_APP/enb_config.h" +#include "LAYER2/PROTO_AGENT/proto_agent.h" + + #ifdef Rel10 #include "PMCH-InfoList-r9.h" #endif @@ -670,4 +676,9 @@ public_rlc(int rlc_module_init(void);) #define RLC_REVERSE_VIDEO "\e[7m" #define RLC_NORMAL_VIDEO "\e[27m" +// PROTO AGENT +pthread_t async_server_thread; +int async_server_thread_finalize (void); +void async_server_thread_init (void); + #endif diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 9ddfb842e2..7b4758b21d 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -47,6 +47,7 @@ #include <sys/socket.h> #include <netinet/ip.h> #include <netinet/tcp.h> +#include <netinet/udp.h> #include <arpa/inet.h> #include <stdint.h> @@ -120,6 +121,7 @@ error: return NULL; } + socket_link_t *new_link_client(char *server, int port) { socket_link_t *ret = NULL; diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index 6ee74a4b43..6b3b3e0f54 100755 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -94,9 +94,6 @@ int log_list_nb_elements = 0; pthread_mutex_t log_lock; pthread_cond_t log_notify; -pthread_mutex_t async_server_lock; -pthread_cond_t async_server_notify; -int async_server_shutdown; #if !defined(LOG_NO_THREAD) int log_list_head = 0; diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index e543052eed..2052314b2d 100755 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -361,6 +361,11 @@ int logInit (void); } #endif + +pthread_mutex_t async_server_lock; +pthread_cond_t async_server_notify; +int async_server_shutdown; + #endif diff --git a/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto b/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto new file mode 100644 index 0000000000..e368e45007 --- /dev/null +++ b/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto @@ -0,0 +1,36 @@ +package protocol; + +message fsp_ctxt { + optional uint32 fsp_mod_id = 1; + optional bool fsp_enb_flag = 2; + optional uint32 fsp_instance = 3; + optional uint32 fsp_rnti = 4; + optional uint32 fsp_frame = 5; + optional uint32 fsp_subframe = 6; + optional uint32 fsp_eNB_index = 7; + +} + +message fspRlcPdu { + optional bytes fsp_pdu_data = 1; // Maximum PDU to be transfered +} + +message fspRlcData { + optional fsp_ctxt fsp_ctxt = 1; + optional bool fsp_srb_flag = 2; + optional bool fsp_mbms_flag = 3; + optional uint32 fsp_rb_id = 4; + optional uint32 fsp_muip = 5; + optional uint32 fsp_confirm = 6; + optional int32 fsp_sdu_buffer_size = 7; + optional fspRlcPdu fsp_pdu = 8; +} + +message fsp_pdcp_split_ind_data { + optional fsp_ctxt fsp_ctxt = 1; + optional bool fsp_srb_flag = 2; + optional bool fsp_mbms_flag = 3; + optional uint32 fsp_rb_id = 4; + optional int32 fsp_sdu_buffer_size = 5; + optional fspRlcPdu fsp_pdu = 6; +} diff --git a/targets/COMMON/MESSAGES/V2/flexsplit.proto b/targets/COMMON/MESSAGES/V2/flexsplit.proto index a7987b407c..22aa80789c 100644 --- a/targets/COMMON/MESSAGES/V2/flexsplit.proto +++ b/targets/COMMON/MESSAGES/V2/flexsplit.proto @@ -1,6 +1,7 @@ package protocol; import "header.proto"; +import "flexsplit-messages.proto"; message flexsplit_message { optional flexsplit_direction msg_dir = 100; @@ -8,6 +9,9 @@ message flexsplit_message { fsp_hello hello_msg = 1; fsp_echo_request echo_request_msg = 2; fsp_echo_reply echo_reply_msg = 3; + fspRlcDataReq data_req_msg = 4; + fspRlcDataReqAck data_req_ack = 5; +// fsp_pdcp_data_ind data_ind_msg = 6; } } @@ -56,3 +60,20 @@ message fsp_echo_reply { // extensions 100 to 199; } + +message fspRlcDataReq { + optional fsp_header header = 1; + optional uint32 eNB_id = 2; + optional fspRlcData pdcp_data = 3; +} + +message fspRlcDataReqAck { + optional fsp_header header = 1; + optional uint32 result = 2; +} + +message fsp_pdcp_data_ind { + optional fsp_header header = 1; + optional uint32 eNB_id = 2; + optional fsp_pdcp_split_ind_data rlc_data = 3; +} diff --git a/targets/COMMON/MESSAGES/V2/header.proto b/targets/COMMON/MESSAGES/V2/header.proto index 043134b40e..01257cf187 100644 --- a/targets/COMMON/MESSAGES/V2/header.proto +++ b/targets/COMMON/MESSAGES/V2/header.proto @@ -11,5 +11,8 @@ enum fsp_type { FSPT_HELLO = 0; FSPT_ECHO_REQUEST = 1; FSPT_ECHO_REPLY = 2; + FSPT_RLC_DATA_REQ = 3; + FSPT_RLC_DATA_REQ_ACK = 4; + FSPT_PDCP_DATA_IND = 5; } diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 02ad877456..e388356b7c 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -259,68 +259,68 @@ help (void) } pthread_t log_thread; -pthread_t async_server_thread; -int async_server_thread_finalize (void); - -void -async_server_thread_init (void) -{ - //create log_list - //log_list_init(&log_list); - - async_server_shutdown = 0; - - if ((pthread_mutex_init (&async_server_lock, NULL) != 0) - || (pthread_cond_init (&async_server_notify, NULL) != 0)) { - return; - } - - if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL) - != 0) { - async_server_thread_finalize(); - return; - } - - -} - -//Call it after the last LOG call -int -async_server_thread_finalize (void) -{ - int err = 0; - - - if (pthread_mutex_lock (&async_server_lock) != 0) { - return -1; - } - - async_server_shutdown = 1; - - /* Wake up LOG thread */ - if ((pthread_cond_broadcast (&async_server_notify) != 0) - || (pthread_mutex_unlock (&async_server_lock) != 0)) { - err = -1; - } - - if (pthread_join (async_server_thread, NULL) != 0) { - err = -1; - } - - if (pthread_mutex_unlock (&async_server_lock) != 0) { - err = -1; - } - - if (!err) { - //log_list_free(&log_list); - pthread_mutex_lock (&async_server_lock); - pthread_mutex_destroy (&async_server_lock); - pthread_cond_destroy (&async_server_notify); - } - - - return err; -} +// pthread_t async_server_thread; +// int async_server_thread_finalize (void); +// +// void +// async_server_thread_init (void) +// { +// //create log_list +// //log_list_init(&log_list); +// +// async_server_shutdown = 0; +// +// if ((pthread_mutex_init (&async_server_lock, NULL) != 0) +// || (pthread_cond_init (&async_server_notify, NULL) != 0)) { +// return; +// } +// +// if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL) +// != 0) { +// async_server_thread_finalize(); +// return; +// } +// +// +// } +// +// //Call it after the last LOG call +// int +// async_server_thread_finalize (void) +// { +// int err = 0; +// +// +// if (pthread_mutex_lock (&async_server_lock) != 0) { +// return -1; +// } +// +// async_server_shutdown = 1; +// +// /* Wake up LOG thread */ +// if ((pthread_cond_broadcast (&async_server_notify) != 0) +// || (pthread_mutex_unlock (&async_server_lock) != 0)) { +// err = -1; +// } +// +// if (pthread_join (async_server_thread, NULL) != 0) { +// err = -1; +// } +// +// if (pthread_mutex_unlock (&async_server_lock) != 0) { +// err = -1; +// } +// +// if (!err) { +// //log_list_free(&log_list); +// pthread_mutex_lock (&async_server_lock); +// pthread_mutex_destroy (&async_server_lock); +// pthread_cond_destroy (&async_server_notify); +// } +// +// +// return err; +// } @@ -1451,7 +1451,7 @@ main (int argc, char **argv) t = clock (); - async_server_thread_init(); +// async_server_thread_init(); LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n"); -- GitLab From 2eb2b5e7bafd70a3ef47ccafedb4d34425cd8c60 Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Tue, 13 Sep 2016 21:02:20 +0300 Subject: [PATCH 006/308] First working version of the DL split. TODO list: 1) check the message handler as if the function is not present it does not return msg not handled 2) use and check return arguments from the functions calling the data req 3) parse the config file for the configuration arguments 4) clean up the messy code 5) define and use other protocols than TCP for the communication between RLC and PDCP --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 17 ++- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 131 ++++++++++++++---- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 118 +++++++++++----- .../LAYER2/PROTO_AGENT/proto_agent_common.h | 10 ++ .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 22 ++- openair2/LAYER2/RLC/rlc.c | 4 +- .../MESSAGES/V2/flexsplit-messages.proto | 8 -- targets/COMMON/MESSAGES/V2/flexsplit.proto | 6 +- 8 files changed, 234 insertions(+), 82 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 3b790e3e5f..86bbeffa29 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -392,10 +392,23 @@ boolean_t pdcp_data_req( //printf("PROTOPDCP: vals are %u, %u, %u, %u, %u, %u, %u \n", ctxt_pP, srb_flagP, rb_idP, muiP, confirmP, pdcp_pdu_size); if (pdcp_pdu_p!=NULL) { + printf("subframe is %u\n", ctxt_pP->subframe); + printf("srb is %u\n", srb_flagP); + printf("MBMS is %u\n", MBMS_FLAG_NO); + printf("rb_id is %u\n", rb_idP); + printf("muiP is %u\n", muiP); + printf("confirm is %u\n", confirmP); + printf("Size is %u\n", pdcp_pdu_size); + proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + //rlc_status = ack_result; + printf("Response is %u\n", ack_result_nikos); + rlc_status = ack_result_nikos; + } + else + { + rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); } - rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - } switch (rlc_status) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index ec31133752..0a1549afcd 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -203,12 +203,13 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; Protocol__FlexsplitMessage *rep_msg=NULL; + Protocol__FlexsplitMessage *ser_msg=NULL; int msg_flag = 0; int priority; int size; #ifdef ECHO - LOG_D(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); + LOG_I(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); #else LOG_D(PROTO_AGENT, "Proto agent Server: Calling the hello packet constructor\n"); @@ -217,9 +218,10 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie int msgsize = 0; int err_code; - proto_agent_serialize_message(init_msg, &msg, &msgsize); + msg = proto_agent_pack_message(init_msg, &msgsize); + //proto_agent_serialize_message(init_msg, &msg, &msgsize); - LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); + LOG_I(PROTO_AGENT,"Server sending the message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); /* After sending the message, wait for any replies; @@ -227,28 +229,43 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie over the channel */ - LOG_D(PROTO_AGENT, "Server reading any message over the async channel.\n"); + LOG_I(PROTO_AGENT, "Server reading any message over the async channel.\n"); while (1) { - if (proto_agent_msg_recv(mod_id, PROTO_AGENT_DEFAULT, &rep_msg, &size, &priority)) { + LOG_I(PROTO_AGENT, "Server reading any message over the async channel.\n"); + if (proto_agent_async_msg_recv(&rep_msg, &size, &priority, channel_info)){ + //(mod_id, PROTO_AGENT_DEFAULT, &rep_msg, &size, &priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - } - LOG_D(PROTO_AGENT,"Server received reply message with size %d and priority %d, calling message handler\n", size, priority); + + LOG_I(PROTO_AGENT,"Server received reply message with size %d and priority %d, calling message handler\n", size, priority); msg=proto_agent_handle_message(mod_id, rep_msg, size); - + if (msg == NULL) { - LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + LOG_I(PROTO_AGENT,"Server msg to send back is NULL\n"); } + else + { //(msg != NULL){ + ser_msg = proto_agent_pack_message(msg, &size); + //proto_agent_serialize_message(msg, &ser_msg, &size); +// if (proto_agent_msg_send(mod_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) channel_info)) { + + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + LOG_I(PROTO_AGENT,"sent message with size %d\n", size); + } + } LOG_I(PROTO_AGENT,"server ends\n"); return 0; error: - LOG_E(PROTO_AGENT,"there was an error\n"); + LOG_I(PROTO_AGENT,"there was an error\n"); return 1; } @@ -304,13 +321,49 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); */ - new_thread(receive_thread, &proto_agent[mod_id]); - LOG_D(PROTO_AGENT, "Client launched the the receive thread for mod_id %d\n", proto_agent[mod_id]); + // Do not call a new thread, but do the msg exchange without threads + //new_thread(receive_thread, &proto_agent[mod_id]); + + void *data; + int size; + int priority; + err_code_t err_code; + Protocol__FlexsplitMessage *msg; + Protocol__FlexsplitMessage *ser_msg; + + if (proto_agent_async_msg_recv(&data, &size, &priority, channel_info)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_I(PROTO_AGENT,"Received message with size %d and priority %d, calling message handle\n", size, priority); + + msg=proto_agent_handle_message(proto_agent[mod_id].enb_id, data, size); + + if (msg == NULL) + { + LOG_I(PROTO_AGENT," CLIENT msg to send back is NULL\n"); + } + + //free(data); + + if (msg != NULL){ + ser_msg = proto_agent_pack_message(msg, &size); + //proto_agent_serialize_message(msg, &ser_msg, &size); + if( proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) channel_info)){ + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + LOG_I(PROTO_AGENT,"CLIENT sent message with size %d\n", size); + } + + + //LOG_D(PROTO_AGENT, "Client launched the the receive thread for mod_id %d\n", proto_agent[mod_id]); return 0; error: - LOG_E(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT,"there was an error %u\n", err_code); return 1; } @@ -346,10 +399,13 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { - printf("PROTOPDCP: sendig the data req over the async channel\n"); + printf("PROTOPDCP: sending the data req over the async channel\n"); Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; + Protocol__FlexsplitMessage *rep = NULL; + Protocol__FlexsplitMessage *srep = NULL; + //Protocol__FlexsplitMessage *rep_msg=NULL; int msg_flag = 0; void *data=NULL; @@ -380,38 +436,55 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl printf("PROTO_AGENT msg flag is %d", msg_flag); int msgsize = 0; //int err_code; - proto_agent_serialize_message(init_msg, &msg, &msgsize); - - LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); + msg = proto_agent_pack_message(init_msg, &msgsize); + + free(init_msg); + LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); + + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); // Block until you receive the ACK with the op code - while (1) { - if (proto_agent_msg_recv(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; + // while (1) { + /* + msg = NULL; + rep = NULL;*/ + //data = NULL; + msgsize = 0; + priority = 0; + msg = NULL; + + while (rep == NULL) + { + if (proto_agent_async_msg_recv(&rep, &msgsize, &priority, client_channel)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } } - LOG_D(PROTO_AGENT,"Received message with size %d and priority %d, calling message handle\n", size, priority); - msg=proto_agent_handle_message(proto_agent[client_mod].enb_id, data, size); + msg = proto_agent_handle_message(proto_agent[client_mod].enb_id, rep, msgsize); if (msg == NULL) { LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); } + else + { + srep = proto_agent_pack_message(rep, &size); - free(data); + //free(data); - if (msg != NULL){ - if (proto_agent_msg_send(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { + + if (proto_agent_async_msg_send((void *)msg, (int) size, 1, (void *) client_channel)){ + //if (proto_agent_msg_send(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } LOG_D(PROTO_AGENT,"sent message with size %d\n", size); } - } + + //} error: LOG_E(PROTO_AGENT,"there was an error\n"); @@ -449,7 +522,7 @@ proto_server_receive(void) LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); } - free(data); + //free(data); if (msg != NULL){ if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index a2a5de6edc..98d77fb36f 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -112,6 +112,12 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader ** return -1; } +int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ + printf("Called the callback function, returing 1\n"); + return 1; +} + int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { @@ -121,6 +127,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp // Create the protobuf header Protocol__FspHeader *header; xid_t xid = 1; + LOG_I(PROTO_AGENT, "creating the data_req message\n"); if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0) goto error; @@ -130,26 +137,29 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData */ - Protocol__FspRlcPdu *pdu = NULL; Protocol__FspCtxt *ctxt = NULL; + Protocol__FspRlcPdu *pdu = NULL; Protocol__FspRlcData *rlc_data = NULL; Protocol__FspRlcDataReq *data_req = NULL; - pdu = malloc(sizeof(Protocol__FspRlcPdu)); + ctxt = malloc(sizeof(Protocol__FspCtxt)); + pdu = malloc(sizeof(Protocol__FspRlcPdu)); rlc_data = malloc(sizeof(Protocol__FspRlcData)); data_req = malloc(sizeof(Protocol__FspRlcDataReq)); - protocol__fsp_rlc_pdu__init(pdu); protocol__fsp_ctxt__init(ctxt); + protocol__fsp_rlc_pdu__init(pdu); protocol__fsp_rlc_data__init(rlc_data); protocol__fsp_rlc_data_req__init(data_req); // Copy data to the RlcPdu structure pdu->fsp_pdu_data.data = malloc(args->sdu_size); pdu->fsp_pdu_data.len = args->sdu_size; - memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); + printf("MSG payload is %u", args->sdu_size); + + memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); pdu->has_fsp_pdu_data = 1; // Copy data to the ctxt structure @@ -169,8 +179,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp ctxt->has_fsp_subframe = 1; ctxt->has_fsp_enb_index = 1; - - rlc_data->fsp_ctxt = ctxt; + rlc_data->fsp_ctxt = ctxt; rlc_data->fsp_srb_flag = args->srb_flag; rlc_data->fsp_mbms_flag = args->MBMS_flag; rlc_data->fsp_rb_id = args->rb_id; @@ -195,9 +204,9 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp data_req->pdcp_data = rlc_data; - +/* printf("PROTOPDCP:initialized the data_req\n"); - printf("PROTOPDCP2: instance is %u, fame is %u", args->ctxt->instance, args->ctxt->frame); + printf("PROTOPDCP2: instance is %u, fame is %u", args->ctxt->instance, args->ctxt->frame);*/ *msg = malloc(sizeof(Protocol__FlexsplitMessage)); @@ -233,13 +242,13 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG) goto error; - free(msg->data_req_msg->header); - free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data); - free(msg->data_req_msg->pdcp_data->fsp_pdu); - free(msg->data_req_msg->pdcp_data->fsp_ctxt); - free(msg->data_req_msg->pdcp_data); - free(msg->data_req_msg); - free(msg); + //free(msg->data_req_msg->header); + //free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data); + //free(msg->data_req_msg->pdcp_data->fsp_pdu); + //free(msg->data_req_msg->pdcp_data->fsp_ctxt); + //free(msg->data_req_msg->pdcp_data); + //free(msg->data_req_msg); + //free(msg); return 0; error: @@ -247,39 +256,61 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { return -1; } +int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ + // printf("Inside data handler for ACK"); + Protocol__FspHeader *header; + xid_t xid; + rlc_op_status_t result = 0; + + LOG_I(PROTO_AGENT, "handling the data_req_ack message\n"); + + Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; + Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; + + result = data_ack->result; + printf("Received result is %u\n", result); + ack_result_nikos = result; + +} + int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { Protocol__FspHeader *header; xid_t xid; - int result = 0; + rlc_op_status_t result = 0; + + LOG_I(PROTO_AGENT, "creating the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReq *data_req = input->data_req_msg; - xid = data_req->header->xid; + xid = data_req->header->xid; Protocol__FspRlcPdu *pdu = NULL; Protocol__FspCtxt *ctxt = NULL; Protocol__FspRlcData *rlc_data = NULL; + rlc_data = data_req->pdcp_data; + pdu = rlc_data->fsp_pdu; + ctxt = rlc_data->fsp_ctxt; - protocol_ctxt_t* ctxt_pP = NULL; + protocol_ctxt_t *ctxt_pP; srb_flag_t srb_flagP = 0; rb_id_t rb_idP = 0; mui_t muiP = 0; confirm_t confirmP = 0; - uint16_t pdcp_pdu_size = 0; - boolean_t flag_MBMS = 0; + sdu_size_t pdcp_pdu_size = 0; + MBMS_flag_t flag_MBMS = 0; mem_block_t *pdcp_pdu_p = NULL; // Create a new protocol context for handling the packet ctxt_pP = malloc(sizeof(protocol_ctxt_t)); - ctxt_pP->module_id = ctxt->fsp_mod_id; ctxt_pP->enb_flag = ctxt->fsp_enb_flag; ctxt_pP->instance = ctxt->fsp_instance; @@ -288,22 +319,34 @@ int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__Fl ctxt_pP->subframe = ctxt->fsp_subframe; ctxt_pP->eNB_index = ctxt->fsp_enb_index; - srb_flagP = rlc_data->fsp_srb_flag; flag_MBMS = rlc_data->fsp_mbms_flag; rb_idP = rlc_data->fsp_rb_id; muiP = rlc_data->fsp_muip; confirmP = rlc_data->fsp_confirm; - pdcp_pdu_size = rlc_data->fsp_sdu_buffer_size; // Same as rlc_data->fsp_pdu_data.len + pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; + //fsp_sdu_buffer_size; // Same as rlc_data->fsp_pdu_data.len - pdcp_pdu_p = malloc(pdcp_pdu_size); - - memcpy(pdcp_pdu_p, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); + pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size); + //malloc(pdcp_pdu_size); + memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); + + //memset(pdcp_pdu_p, 0, pdcp_pdu_size); // Ready to call the rlc_data_req - result = rlc_data_req(ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - + result = rlc_data_req((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, (const mui_t) muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); +// printf("subframe is %u\n", ctxt_pP->subframe); +// printf("srb is %u\n", srb_flagP); +// printf("MBMS is %u\n", flag_MBMS); +// printf("rb_id is %u\n", rb_idP); +// printf("muiP is %u\n", muiP); +// printf("confirm is %u\n", confirmP); +// printf("Size is %u\n", pdcp_pdu_size); + //result = rlc_data_req(ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + + printf("result is %u\n", result); + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ_ACK, &header) != 0) goto error; @@ -342,9 +385,9 @@ int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK) goto error; - free(msg->data_req_ack->header); - free(msg->data_req_ack); - free(msg); + //free(msg->data_req_ack->header); + //free(msg->data_req_ack); + //free(msg); return 0; error: @@ -360,6 +403,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0) goto error; + LOG_I(PROTO_AGENT, "creating the HELLO message\n"); Protocol__FspHello *hello_msg = NULL; hello_msg = malloc(sizeof(Protocol__FspHello)); if(hello_msg == NULL) @@ -412,7 +456,8 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0) goto error; LOG_I(PROTO_AGENT,"Created the fsp message header\n"); - + LOG_I(PROTO_AGENT, "creating the echo request message\n"); + Protocol__FspEchoRequest *echo_request_msg = NULL; echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest)); if(echo_request_msg == NULL) @@ -464,6 +509,9 @@ int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__Flexsplit Protocol__FspEchoRequest *echo_req = input->echo_request_msg; xid = (echo_req->header)->xid; + + + LOG_I(PROTO_AGENT, "creating the echo reply message\n"); Protocol__FspHeader *header; if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0) goto error; @@ -500,9 +548,9 @@ int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG) goto error; - free(msg->echo_reply_msg->header); - free(msg->echo_reply_msg); - free(msg); + //free(msg->echo_reply_msg->header); + //free(msg->echo_reply_msg); + //free(msg); return 0; error: diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index 57cbf6a7d0..4622b0718b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -71,6 +71,9 @@ typedef int (*proto_agent_message_destruction_callback)( Protocol__FlexsplitMessage *msg ); + +uint32_t ack_result_nikos; + /********************************** * progRAN protocol messages helper * functions and generic handlers @@ -97,6 +100,13 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg); int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg); +int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg); + +int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); + + +int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index b32094be32..fd307dfb9c 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -42,7 +42,10 @@ proto_agent_message_decoded_callback agent_messages_callback[][3] = { {proto_agent_hello, proto_agent_hello, 0}, {proto_agent_echo_reply, 0, 0}, + {0, just_print, 0}, {proto_agent_pdcp_data_req_ack, 0, 0}, + {0, proto_agent_get_ack_result, 0}, + {0, 0, 0}, // {proto_agent_pdcp_data_ind, proto_agent_pdcp_data_ind_ack, proto_agent_rlc_data_ind_nack}, }; @@ -70,11 +73,12 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size){ - Protocol__FlexsplitMessage *decoded_message, *reply_message; + Protocol__FlexsplitMessage *decoded_message = NULL; + Protocol__FlexsplitMessage *reply_message = NULL; err_code_t err_code; DevAssert(data != NULL); - LOG_D(PROTO_AGENT, "Deserializing message \n"); + LOG_I(PROTO_AGENT, "Deserializing message with size %u \n", size); if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) { err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; goto error; @@ -82,17 +86,27 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message; if (header->has_type) { - LOG_D(PROTO_AGENT, "Deserialized MSG type is %d\n", header->type); + LOG_I(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir); } + //printf("HANDLER: msg_case %u msg_dir %u\n\n", decoded_message->msg_case, decoded_message->msg_dir); if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) || (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; - LOG_D(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); + LOG_I(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); goto error; } + + +// if ((decoded_message->msg_case != 5)&&(decoded_message->msg_dir!=2)){ err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); + printf("Err code is %u\n", err_code); +// } +// else{ +// err_code = 0; +// } + if ( err_code < 0 ) { goto error; diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 940f1f11dc..dc5cf82ce8 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -396,6 +396,8 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, mem_block_t *sdu_pP) { //----------------------------------------------------------------------------- + + mem_block_t *new_sdu_p = NULL; rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_union_t *rlc_union_p = NULL; @@ -484,7 +486,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, #ifdef DEBUG_RLC_DATA_REQ LOG_D(RLC,"RLC_TYPE : %d\n", rlc_mode); #endif - + switch (rlc_mode) { case RLC_MODE_NONE: free_mem_block(sdu_pP); diff --git a/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto b/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto index e368e45007..cbb3b2dbf1 100644 --- a/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto +++ b/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto @@ -26,11 +26,3 @@ message fspRlcData { optional fspRlcPdu fsp_pdu = 8; } -message fsp_pdcp_split_ind_data { - optional fsp_ctxt fsp_ctxt = 1; - optional bool fsp_srb_flag = 2; - optional bool fsp_mbms_flag = 3; - optional uint32 fsp_rb_id = 4; - optional int32 fsp_sdu_buffer_size = 5; - optional fspRlcPdu fsp_pdu = 6; -} diff --git a/targets/COMMON/MESSAGES/V2/flexsplit.proto b/targets/COMMON/MESSAGES/V2/flexsplit.proto index 22aa80789c..b743ebe2c0 100644 --- a/targets/COMMON/MESSAGES/V2/flexsplit.proto +++ b/targets/COMMON/MESSAGES/V2/flexsplit.proto @@ -11,7 +11,7 @@ message flexsplit_message { fsp_echo_reply echo_reply_msg = 3; fspRlcDataReq data_req_msg = 4; fspRlcDataReqAck data_req_ack = 5; -// fsp_pdcp_data_ind data_ind_msg = 6; + fspPdcpDataInd data_ind_msg = 6; } } @@ -72,8 +72,8 @@ message fspRlcDataReqAck { optional uint32 result = 2; } -message fsp_pdcp_data_ind { +message fspPdcpDataInd { optional fsp_header header = 1; optional uint32 eNB_id = 2; - optional fsp_pdcp_split_ind_data rlc_data = 3; + optional fspRlcData rlc_data = 3; } -- GitLab From 9f3b8cb9f8b3b32b70807287608fc7bce25f9c8b Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Thu, 15 Sep 2016 18:38:31 +0300 Subject: [PATCH 007/308] Added support for the UL split: TODO: 1) connection to UEs is broken (tested for oaisim) 2) Memory management problems, oaisim is exiting for large rates of traffic --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 279 ++++++++++-------- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 1 + .../LAYER2/PROTO_AGENT/proto_agent_common.c | 267 ++++++++++++++--- .../LAYER2/PROTO_AGENT/proto_agent_common.h | 250 +--------------- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 29 +- openair2/LAYER2/RLC/rlc.c | 15 +- targets/COMMON/MESSAGES/V2/flexsplit.proto | 6 + targets/COMMON/MESSAGES/V2/header.proto | 1 + 8 files changed, 426 insertions(+), 422 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 0a1549afcd..069dab1c95 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -216,10 +216,12 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie msg_flag = proto_agent_hello(mod_id, NULL, &init_msg); #endif + if (msg_flag != 0) + goto error; + int msgsize = 0; int err_code; msg = proto_agent_pack_message(init_msg, &msgsize); - //proto_agent_serialize_message(init_msg, &msg, &msgsize); LOG_I(PROTO_AGENT,"Server sending the message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); @@ -231,36 +233,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie LOG_I(PROTO_AGENT, "Server reading any message over the async channel.\n"); - while (1) { - LOG_I(PROTO_AGENT, "Server reading any message over the async channel.\n"); - if (proto_agent_async_msg_recv(&rep_msg, &size, &priority, channel_info)){ - //(mod_id, PROTO_AGENT_DEFAULT, &rep_msg, &size, &priority)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_I(PROTO_AGENT,"Server received reply message with size %d and priority %d, calling message handler\n", size, priority); - - msg=proto_agent_handle_message(mod_id, rep_msg, size); - - if (msg == NULL) - { - LOG_I(PROTO_AGENT,"Server msg to send back is NULL\n"); - } - else - { //(msg != NULL){ - ser_msg = proto_agent_pack_message(msg, &size); - //proto_agent_serialize_message(msg, &ser_msg, &size); - -// if (proto_agent_msg_send(mod_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { - if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) channel_info)) { - - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - LOG_I(PROTO_AGENT,"sent message with size %d\n", size); - } - } + new_thread(proto_server_receive, &proto_server[mod_id]); LOG_I(PROTO_AGENT,"server ends\n"); return 0; @@ -316,13 +289,6 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); - - /*Example of registration for a specific agent(MAC): - *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); - */ - - // Do not call a new thread, but do the msg exchange without threads - //new_thread(receive_thread, &proto_agent[mod_id]); void *data; int size; @@ -331,34 +297,8 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties Protocol__FlexsplitMessage *msg; Protocol__FlexsplitMessage *ser_msg; - if (proto_agent_async_msg_recv(&data, &size, &priority, channel_info)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_I(PROTO_AGENT,"Received message with size %d and priority %d, calling message handle\n", size, priority); - - msg=proto_agent_handle_message(proto_agent[mod_id].enb_id, data, size); - - if (msg == NULL) - { - LOG_I(PROTO_AGENT," CLIENT msg to send back is NULL\n"); - } - //free(data); - - if (msg != NULL){ - ser_msg = proto_agent_pack_message(msg, &size); - //proto_agent_serialize_message(msg, &ser_msg, &size); - if( proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) channel_info)){ - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - LOG_I(PROTO_AGENT,"CLIENT sent message with size %d\n", size); - } - - - //LOG_D(PROTO_AGENT, "Client launched the the receive thread for mod_id %d\n", proto_agent[mod_id]); + new_thread(proto_client_receive, &proto_agent[mod_id]); return 0; @@ -368,23 +308,20 @@ error: } - void proto_agent_send_hello(void) { Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; - //Protocol__FlexsplitMessage *rep_msg=NULL; int msg_flag = 0; - //int priority; - //int size; + LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n"); msg_flag = proto_agent_hello(proto_agent[client_mod].enb_id, NULL, &init_msg); int msgsize = 0; //int err_code; - if (msg_flag > 0) + if (msg_flag == 0) { proto_agent_serialize_message(init_msg, &msg, &msgsize); } @@ -416,8 +353,6 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n"); - //EDW - printf("instance is %u, %u\n", ctxt_pP->instance, ctxt_pP->frame); data_req_args *args = malloc(sizeof(data_req_args)); args->ctxt = malloc(sizeof(protocol_ctxt_t)); @@ -432,38 +367,128 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); msg_flag = proto_agent_pdcp_data_req(proto_agent[client_mod].enb_id, (void *) args, &init_msg); + if (msg_flag != 0) + goto error; - printf("PROTO_AGENT msg flag is %d", msg_flag); int msgsize = 0; - //int err_code; - msg = proto_agent_pack_message(init_msg, &msgsize); + if (init_msg != NULL) + { + printf("Will pack the message\n"); + msg = proto_agent_pack_message(init_msg, &msgsize); - free(init_msg); + printf("Will free the message\n"); + free(init_msg); - LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); + LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); + if (msg!=NULL) + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); - // Block until you receive the ACK with the op code - // while (1) { - /* - msg = NULL; - rep = NULL;*/ - //data = NULL; - msgsize = 0; - priority = 0; + } + else + { + goto error; + } + + return; +error: + LOG_E(PROTO_AGENT,"there was an error\n"); + return; + +} + + +void +proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) +{ + printf("PROTOPDCP: Sending Data Indication over the async channel\n"); + + Protocol__FlexsplitMessage *msg = NULL; + Protocol__FlexsplitMessage *init_msg = NULL; + Protocol__FlexsplitMessage *rep = NULL; + Protocol__FlexsplitMessage *srep = NULL; + + //Protocol__FlexsplitMessage *rep_msg=NULL; + int msg_flag = 0; + void *data=NULL; + int priority; + int size; + int ret; + int err_code; + + LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n"); + + data_req_args *args = malloc(sizeof(data_req_args)); + + args->ctxt = malloc(sizeof(protocol_ctxt_t)); + memcpy(args->ctxt, ctxt_pP, sizeof(protocol_ctxt_t)); + args->srb_flag = srb_flagP; + args->MBMS_flag = MBMS_flagP; + args->rb_id = rb_idP; + args->sdu_size = sdu_sizeP; + args->sdu_p = malloc(sdu_sizeP); + memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); + + msg_flag = proto_agent_pdcp_data_ind(proto_server[server_mod].enb_id, (void *) args, &init_msg); + if (msg_flag != 0) + goto error; + + int msgsize = 0; + + if (init_msg != NULL) + { + printf("Will pack the message \n"); + msg = proto_agent_pack_message(init_msg, &msgsize); + printf("packed the message \n"); + free(init_msg); + + if (msg!=NULL) + { + LOG_I(PROTO_AGENT,"Server sending the pdcp data_ind message over the async channel\n"); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) server_channel); + } + } + else + { + goto error; + } + return; + +error: + LOG_E(PROTO_AGENT,"there was an error\n"); + return; + +} + + + + +void * +proto_server_receive(void) +{ + proto_agent_instance_t *d = &proto_server[server_mod]; + void *data = NULL; + int size; + int priority; + err_code_t err_code; + + Protocol__FlexsplitMessage *msg; + Protocol__FlexsplitMessage *ser_msg; + + while (1) { + msg = NULL; + ser_msg = NULL; - while (rep == NULL) - { - if (proto_agent_async_msg_recv(&rep, &msgsize, &priority, client_channel)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } + if (proto_agent_async_msg_recv(&data, &size, &priority, server_channel)){ + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; } - LOG_D(PROTO_AGENT,"Received message with size %d and priority %d, calling message handle\n", size, priority); - msg = proto_agent_handle_message(proto_agent[client_mod].enb_id, rep, msgsize); + LOG_I(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); + + msg=proto_agent_handle_message(d->enb_id, data, size); if (msg == NULL) { @@ -471,49 +496,55 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl } else { - srep = proto_agent_pack_message(rep, &size); - - //free(data); + free(data); - - if (proto_agent_async_msg_send((void *)msg, (int) size, 1, (void *) client_channel)){ - //if (proto_agent_msg_send(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { + ser_msg = proto_agent_pack_message(msg, &size); + } + + LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); + if (ser_msg != NULL){ + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } LOG_D(PROTO_AGENT,"sent message with size %d\n", size); } - - //} -error: - LOG_E(PROTO_AGENT,"there was an error\n"); - return; + } -} + return NULL; +error: + LOG_E(PROTO_AGENT,"server_receive_thread: error %d occured\n",err_code); + return NULL; - - +} void * -proto_server_receive(void) +proto_client_receive(void) { - proto_agent_instance_t *d = &proto_server[server_mod]; - void *data; + proto_agent_instance_t *d = &proto_agent[client_mod]; + void *data = NULL; int size; int priority; err_code_t err_code; Protocol__FlexsplitMessage *msg; + Protocol__FlexsplitMessage *ser_msg; - //while (1) { - if (proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { + + while (1) { + + msg = NULL; + ser_msg = NULL; + + if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel)){ + //proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - LOG_I(PROTO_AGENT,"Server Received message with size %d and priority %d, calling message handle\n", size, priority); + LOG_I(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); msg=proto_agent_handle_message(d->enb_id, data, size); @@ -521,22 +552,28 @@ proto_server_receive(void) { LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); } + else + { + free(data); - //free(data); + ser_msg = proto_agent_pack_message(msg, &size); + } - if (msg != NULL){ - if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { + if (ser_msg != NULL){ + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel)){ + //proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } LOG_D(PROTO_AGENT,"sent message with size %d\n", size); } - //} - + + } + return NULL; error: - LOG_E(PROTO_AGENT,"receive_thread: error %d occured\n",err_code); + LOG_E(PROTO_AGENT,"client_receive_thread: error %d occured\n",err_code); return NULL; -} \ No newline at end of file +} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 1815ee5374..1ce8cbef45 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -43,6 +43,7 @@ void * proto_server_init(void *args); void * proto_server_receive(void); +void * proto_client_receive(void); int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 98d77fb36f..d16b9ef9ad 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -324,29 +324,14 @@ int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__Fl rb_idP = rlc_data->fsp_rb_id; muiP = rlc_data->fsp_muip; confirmP = rlc_data->fsp_confirm; - pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; - //fsp_sdu_buffer_size; // Same as rlc_data->fsp_pdu_data.len - + pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size); - //malloc(pdcp_pdu_size); memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); - //memset(pdcp_pdu_p, 0, pdcp_pdu_size); - // Ready to call the rlc_data_req result = rlc_data_req((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, (const mui_t) muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); -// printf("subframe is %u\n", ctxt_pP->subframe); -// printf("srb is %u\n", srb_flagP); -// printf("MBMS is %u\n", flag_MBMS); -// printf("rb_id is %u\n", rb_idP); -// printf("muiP is %u\n", muiP); -// printf("confirm is %u\n", confirmP); -// printf("Size is %u\n", pdcp_pdu_size); - //result = rlc_data_req(ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - - printf("result is %u\n", result); - + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ_ACK, &header) != 0) goto error; @@ -395,6 +380,237 @@ int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) { return -1; } + +int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG) + goto error; + + //free(msg->data_req_ack->header); + //free(msg->data_req_ack); + //free(msg); + return 0; + + error: + LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ + + // Initialize the PDCP params + data_req_args *args = (data_req_args *)params; + + // Create the protobuf header + Protocol__FspHeader *header; + xid_t xid = 1; + LOG_I(PROTO_AGENT, "creating the data_ind message\n"); + + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND, &header) != 0) + goto error; + + /* Begin constructing the messages. They are defined as follows: + * 1) fspRlcPdu is storing the bytes of the packet + * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) + * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData + */ + + Protocol__FspCtxt *ctxt = NULL; + Protocol__FspRlcPdu *pdu = NULL; + Protocol__FspRlcData *rlc_data = NULL; + Protocol__FspPdcpDataInd *data_ind = NULL; + + + ctxt = malloc(sizeof(Protocol__FspCtxt)); + pdu = malloc(sizeof(Protocol__FspRlcPdu)); + rlc_data = malloc(sizeof(Protocol__FspRlcData)); + data_ind = malloc(sizeof(Protocol__FspPdcpDataInd)); + + protocol__fsp_ctxt__init(ctxt); + protocol__fsp_rlc_pdu__init(pdu); + protocol__fsp_rlc_data__init(rlc_data); + protocol__fsp_pdcp_data_ind__init(data_ind); + + // Copy data to the RlcPdu structure + pdu->fsp_pdu_data.data = malloc(args->sdu_size); + pdu->fsp_pdu_data.len = args->sdu_size; + + printf("MSG payload is %u", args->sdu_size); + + //memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); + pdu->has_fsp_pdu_data = 1; + + // Copy data to the ctxt structure + ctxt->fsp_mod_id = args->ctxt->module_id; + ctxt->fsp_enb_flag = args->ctxt->enb_flag; + ctxt->fsp_instance = args->ctxt->instance; + ctxt->fsp_rnti = args->ctxt->rnti; + ctxt->fsp_frame = args->ctxt->frame; + ctxt->fsp_subframe = args->ctxt->subframe; + ctxt->fsp_enb_index = args->ctxt->eNB_index; + + ctxt->has_fsp_mod_id = 1; + ctxt->has_fsp_enb_flag = 1; + ctxt->has_fsp_instance = 1; + ctxt->has_fsp_rnti = 1; + ctxt->has_fsp_frame = 1; + ctxt->has_fsp_subframe = 1; + ctxt->has_fsp_enb_index = 1; + + rlc_data->fsp_ctxt = ctxt; + rlc_data->fsp_srb_flag = args->srb_flag; + rlc_data->fsp_mbms_flag = args->MBMS_flag; + rlc_data->fsp_rb_id = args->rb_id; + + rlc_data->fsp_sdu_buffer_size = args->sdu_size; + rlc_data->fsp_pdu = pdu; + rlc_data->has_fsp_srb_flag = 1; + rlc_data->has_fsp_mbms_flag = 1; + rlc_data->has_fsp_rb_id = 1; + rlc_data->has_fsp_sdu_buffer_size = 1; + + // Up to here, everything is a signle message that is packed inside another. The final data_req + // will be created later, after the setting of all variables + + data_ind->header = header; + data_ind->enb_id = mod_id; + data_ind->has_enb_id = 1; + data_ind->rlc_data = rlc_data; + + + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); + + if(*msg == NULL) + goto error; + + protocol__flexsplit_message__init(*msg); + LOG_I(PROTO_AGENT,"setting the message case to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG); + + (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK + (*msg)->has_msg_dir = 1; + (*msg)->data_ind_msg = data_ind; //data_req; + + return 0; + + error: + if(header != NULL) + free(header); + if(pdu!=NULL) + free(pdu); + if(rlc_data!=NULL) + free(rlc_data); + if(data_ind!= NULL) + free(data_ind); + if(*msg != NULL) + free(*msg); + LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + return -1; + +} + + +int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ + Protocol__FspHeader *header; + xid_t xid; + rlc_op_status_t result = 0; + + LOG_I(PROTO_AGENT, "creating the data_ind_ack message\n"); + + Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; + Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg; + + xid = data_ind->header->xid; + Protocol__FspRlcPdu *pdu = NULL; + Protocol__FspCtxt *ctxt = NULL; + Protocol__FspRlcData *rlc_data = NULL; + + + rlc_data = data_ind->rlc_data; + + pdu = rlc_data->fsp_pdu; + + ctxt = rlc_data->fsp_ctxt; + + protocol_ctxt_t *ctxt_pP; + srb_flag_t srb_flagP = 0; + rb_id_t rb_idP = 0; + sdu_size_t pdcp_pdu_size = 0; + MBMS_flag_t flag_MBMS = 0; + mem_block_t *pdcp_pdu_p = NULL; + + + // Create a new protocol context for handling the packet + + ctxt_pP = malloc(sizeof(protocol_ctxt_t)); + ctxt_pP->module_id = ctxt->fsp_mod_id; + ctxt_pP->enb_flag = ctxt->fsp_enb_flag; + ctxt_pP->instance = ctxt->fsp_instance; + ctxt_pP->rnti = ctxt->fsp_rnti; + ctxt_pP->frame = ctxt->fsp_frame; + ctxt_pP->subframe = ctxt->fsp_subframe; + ctxt_pP->eNB_index = ctxt->fsp_enb_index; + + srb_flagP = rlc_data->fsp_srb_flag; + flag_MBMS = rlc_data->fsp_mbms_flag; + rb_idP = rlc_data->fsp_rb_id; + pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; + pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size); + + memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); + + pdcp_data_ind((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); + + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND_ACK, &header) != 0) + goto error; + + Protocol__FspPdcpDataIndAck *ack = NULL; + ack = malloc(sizeof(Protocol__FspPdcpDataIndAck)); + protocol__fsp_pdcp_data_ind_ack__init(ack); + + ack->header = header; + ack->result = result; + ack->has_result = 1; + + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); + if(*msg == NULL) + goto error; + + protocol__flexsplit_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_ACK; + (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->has_msg_dir = 1; + (*msg)->data_req_ack = ack; + return 0; + + error: + if(header != NULL) + free(header); + if(ack!=NULL) + free(ack); + if(*msg != NULL) + free(*msg); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; + +} + + +int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_ACK) + goto error; + + //free(msg->data_req_ack->header); + //free(msg->data_req_ack); + //free(msg); + return 0; + + error: + LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + return -1; +} + int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { Protocol__FspHeader *header; @@ -557,23 +773,6 @@ int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) { LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } -/* -// call this function to start a nanosecond-resolution timer -struct timespec timer_start(){ - struct timespec start_time; - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time); - return start_time; -} - -// call this function to end a timer, returning nanoseconds elapsed as a long -long timer_end(struct timespec start_time){ - struct timespec end_time; - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time); - long diffInNanos = end_time.tv_nsec - start_time.tv_nsec; - return diffInNanos; -} -*/ - /* * get generic info from RAN */ diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index 4622b0718b..159ed036e0 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -102,6 +102,8 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg); int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg); int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg); +int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg); int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); @@ -135,254 +137,6 @@ struct _data_req_args{ void set_enb_vars(mid_t mod_id, ran_name_t ran); -// int get_current_time_ms (mid_t mod_id, int subframe_flag); - -/*Return the current frame number - *Could be using implementation specific numbering of frames - */ -// unsigned int get_current_frame(mid_t mod_id); - -/* Do not need these */ - -///*Return the current SFN (0-1023)*/ -//unsigned int get_current_system_frame_num(mid_t mod_id); -// -//unsigned int get_current_subframe(mid_t mod_id); - -///*Return the frame and subframe number in compact 16-bit format. -// Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/ -// uint16_t get_sfn_sf (mid_t mod_id); -// -// int get_num_ues(mid_t mod_id); -// -// int get_ue_crnti (mid_t mod_id, mid_t ue_id); -// -// int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); -// -// int get_ue_phr (mid_t mod_id, mid_t ue_id); -// -// int get_ue_wcqi (mid_t mod_id, mid_t ue_id); -// -// int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); -// -// int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id); -// -// int get_active_CC(mid_t mod_id, mid_t ue_id); -// -// int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); -// -// int get_n1pucch_an(mid_t mod_id, int CC_id); -// -// int get_nRB_CQI(mid_t mod_id, int CC_id); -// -// int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); -// -// int get_prach_ConfigIndex(mid_t mod_id, int CC_id); -// -// int get_prach_FreqOffset(mid_t mod_id, int CC_id); -// -// int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); -// -// int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); -// -// int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); -// -// int get_cell_id(mid_t mod_id, int CC_id); -// -// int get_srs_BandwidthConfig(mid_t mod_id, int CC_id); -// -// int get_srs_SubframeConfig(mid_t mod_id, int CC_id); -// -// int get_srs_MaxUpPts(mid_t mod_id, int CC_id); -// -// int get_N_RB_DL(mid_t mod_id, int CC_id); -// -// int get_N_RB_UL(mid_t mod_id, int CC_id); -// -// int get_subframe_assignment(mid_t mod_id, int CC_id); -// -// int get_special_subframe_assignment(mid_t mod_id, int CC_id); -// -// int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); -// -// int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); -// -// int get_duplex_mode(mid_t mod_id, int CC_id); -// -// long get_si_window_length(mid_t mod_id, int CC_id); -// -// int get_num_pdcch_symb(mid_t mod_id, int CC_id); -// -// int get_tpc(mid_t mod_id, mid_t ue_id); -// -// int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, -// const int frame, const uint8_t subframe, int *id, int *status); - -/* - * ************************************ - * Get Messages for UE Configuration Reply - * ************************************ - */ - -// int get_time_alignment_timer(mid_t mod_id, mid_t ue_id); -// -// int get_meas_gap_config(mid_t mod_id, mid_t ue_id); -// -// int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); -// -// int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); -// -// int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); -// -// int get_half_duplex(mid_t ue_id); -// -// int get_intra_sf_hopping(mid_t ue_id); -// -// int get_type2_sb_1(mid_t ue_id); -// -// int get_ue_category(mid_t ue_id); -// -// int get_res_alloc_type1(mid_t ue_id); -// -// int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); -// -// int get_tti_bundling(mid_t mod_id, mid_t ue_id); -// -// int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); -// -// int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); -// -// int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); -// -// int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); -// -// int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); -// -// int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); -// -// int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); -// -// int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); -// -// int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); -// -// int get_extended_bsr_size(mid_t mod_id, mid_t ue_id); -// -// int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); -// -// int get_lcg(mid_t ue_id, mid_t lc_id); -// -// int get_direction(mid_t ue_id, mid_t lc_id); - - - -/******************* - * timer primitves - *******************/ - -#define TIMER_NULL -1 -#define TIMER_TYPE_INVALIDE -2 -#define TIMER_SETUP_FAILED -3 -#define TIMER_REMOVED_FAILED -4 -#define TIMER_ELEMENT_NOT_FOUND -5 - - -/* Type of the callback executed when the timer expired */ -typedef Protocol__FlexsplitMessage *(*proto_agent_timer_callback_t)(void*); - -typedef enum { - /* oneshot timer: */ - PROTO_AGENT_TIMER_TYPE_ONESHOT = 0x0, - - /* periodic timer */ - PROTO_AGENT_TIMER_TYPE_PERIODIC = 0x1, - - /* Inactive state: initial state for any timer. */ - PROTO_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2, - - /* Max number of states available */ - PROTO_AGENT_TIMER_TYPE_MAX, -} proto_agent_timer_type_t; - -typedef enum { - /* Inactive state: initial state for any timer. */ - PROTO_AGENT_TIMER_STATE_INACTIVE = 0x0, - - /* Inactive state: initial state for any timer. */ - PROTO_AGENT_TIMER_STATE_ACTIVE = 0x1, - - /* Inactive state: initial state for any timer. */ - PROTO_AGENT_TIMER_STATE_STOPPED = 0x2, - - /* Max number of states available */ - PROTO_AGENT_TIMER_STATE_MAX, -} proto_agent_timer_state_t; - -typedef struct proto_agent_timer_args_s{ - mid_t mod_id; - Protocol__FlexsplitMessage *msg; -} proto_agent_timer_args_t; - - -// Do we need this?? Probably not.. -typedef struct proto_agent_timer_element_s{ - RB_ENTRY(proto_agent_timer_element_s) entry; - - agent_id_t agent_id; - instance_t instance; - - proto_agent_timer_type_t type; - proto_agent_timer_state_t state; - - uint32_t interval_sec; - uint32_t interval_usec; - - long timer_id; /* Timer id returned by the timer API*/ - xid_t xid; /*The id of the task as received by the controller - message*/ - - proto_agent_timer_callback_t cb; - proto_agent_timer_args_t *timer_args; - -} proto_agent_timer_element_t; - -typedef struct proto_agent_timer_instance_s{ - RB_HEAD(proto_agent_map, proto_agent_timer_element_s) proto_agent_head; -}proto_agent_timer_instance_t; - -err_code_t proto_agent_init_timer(void); - -err_code_t proto_agent_create_timer(uint32_t interval_sec, - uint32_t interval_usec, - agent_id_t agent_id, - instance_t instance, - uint32_t timer_type, - xid_t xid, - proto_agent_timer_callback_t cb, - void* timer_args, - long *timer_id); - -err_code_t proto_agent_destroy_timers(void); -err_code_t proto_agent_destroy_timer(long timer_id); -err_code_t proto_agent_destroy_timer_by_task_id(xid_t xid); - -err_code_t proto_agent_stop_timer(long timer_id); - -err_code_t proto_agent_restart_timer(long *timer_id); - -struct proto_agent_timer_element_s * get_timer_entry(long timer_id); - -Protocol__FlexsplitMessage * proto_agent_process_timeout(long timer_id, void* timer_args); - -int proto_agent_compare_timer(struct proto_agent_timer_element_s *a, struct proto_agent_timer_element_s *b); - -/*Specify a delay in nanoseconds to timespec and sleep until then*/ -void proto_agent_sleep_until(struct timespec *ts, int delay); - -/* RB_PROTOTYPE is for .h files */ -RB_PROTOTYPE(proto_agent_map, proto_agent_timer_element_s, entry, proto_agent_compare_timer); - - #endif diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index fd307dfb9c..b2b085c999 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -45,8 +45,8 @@ proto_agent_message_decoded_callback agent_messages_callback[][3] = { {0, just_print, 0}, {proto_agent_pdcp_data_req_ack, 0, 0}, {0, proto_agent_get_ack_result, 0}, - {0, 0, 0}, -// {proto_agent_pdcp_data_ind, proto_agent_pdcp_data_ind_ack, proto_agent_rlc_data_ind_nack}, + {proto_agent_pdcp_data_ind_ack, 0, 0}, + {0, just_print, 0}, }; proto_agent_message_destruction_callback message_destruction_callback[] = { @@ -55,10 +55,9 @@ proto_agent_message_destruction_callback message_destruction_callback[] = { proto_agent_destroy_echo_reply, proto_agent_destroy_pdcp_data_req, proto_agent_destroy_pdcp_data_req_ack, -// proto_agent_destroy_rlc_data_req_nack, -// proto_agent_destroy_pdcp_data_ind, -// proto_agent_destroy_pdcp_data_ind_ack, -// proto_agent_destroy_rlc_data_ind_nack, + proto_agent_destroy_pdcp_data_ind, + proto_agent_destroy_pdcp_data_ind_ack, + }; static const char *proto_agent_direction2String[] = { @@ -91,21 +90,14 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, //printf("HANDLER: msg_case %u msg_dir %u\n\n", decoded_message->msg_case, decoded_message->msg_dir); if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) || - (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)){ - err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; + (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)) + { + err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; LOG_I(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); goto error; } - -// if ((decoded_message->msg_case != 5)&&(decoded_message->msg_dir!=2)){ - err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); - printf("Err code is %u\n", err_code); -// } -// else{ -// err_code = 0; -// } if ( err_code < 0 ) { @@ -118,7 +110,7 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, LOG_D(PROTO_AGENT,"Returning REPLY message after the callback\n"); return reply_message; -error: + error: LOG_E(PROTO_AGENT,"errno %d occured\n",err_code); return NULL; } @@ -130,6 +122,7 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, void * buffer; err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR; + printf("serializing message\n"); if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING; goto error; @@ -137,8 +130,10 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, // free the msg --> later keep this in the data struct and just update the values //TODO call proper destroy function + printf("destruction callback\n"); err_code = ((*message_destruction_callback[msg->msg_case-1])(msg)); + printf("asserion"); DevAssert(buffer !=NULL); LOG_D(PROTO_AGENT,"Serialized the enb mac stats reply (size %d)\n", *size); diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index dc5cf82ce8..775f83654e 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -653,14 +653,25 @@ void rlc_data_ind ( T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); #endif - - pdcp_data_ind ( + if (!srb_flagP) + { + proto_agent_send_pdcp_data_ind(ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, + sdu_sizeP, + sdu_pP); + } + else + { + pdcp_data_ind ( ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP); + } } //----------------------------------------------------------------------------- void rlc_data_conf (const protocol_ctxt_t* const ctxt_pP, diff --git a/targets/COMMON/MESSAGES/V2/flexsplit.proto b/targets/COMMON/MESSAGES/V2/flexsplit.proto index b743ebe2c0..c4a8b70a4e 100644 --- a/targets/COMMON/MESSAGES/V2/flexsplit.proto +++ b/targets/COMMON/MESSAGES/V2/flexsplit.proto @@ -12,6 +12,7 @@ message flexsplit_message { fspRlcDataReq data_req_msg = 4; fspRlcDataReqAck data_req_ack = 5; fspPdcpDataInd data_ind_msg = 6; + fspPdcpDataIndAck data_ind_ack = 7; } } @@ -77,3 +78,8 @@ message fspPdcpDataInd { optional uint32 eNB_id = 2; optional fspRlcData rlc_data = 3; } + +message fspPdcpDataIndAck { + optional fsp_header header = 1; + optional uint32 result = 2; +} diff --git a/targets/COMMON/MESSAGES/V2/header.proto b/targets/COMMON/MESSAGES/V2/header.proto index 01257cf187..44d52f777c 100644 --- a/targets/COMMON/MESSAGES/V2/header.proto +++ b/targets/COMMON/MESSAGES/V2/header.proto @@ -14,5 +14,6 @@ enum fsp_type { FSPT_RLC_DATA_REQ = 3; FSPT_RLC_DATA_REQ_ACK = 4; FSPT_PDCP_DATA_IND = 5; + FSPT_PDCP_DATA_IND_ACK = 6; } -- GitLab From 2a4fa1da41e183d258a501ab888352bbdea9041e Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Tue, 4 Oct 2016 18:59:01 +0300 Subject: [PATCH 008/308] Fixed broken UL for data plane split --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 13 +++------- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 2 +- openair2/LAYER2/RLC/rlc.c | 26 +++++++++---------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 86bbeffa29..24c3ccdc42 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -368,16 +368,10 @@ boolean_t pdcp_data_req( #endif - //starting async -// const Enb_properties_array_t *enb_properties_p = NULL; - Enb_properties_array_t *enb_properties_p = NULL; -// enb_properties_p = malloc(sizeof(Enb_properties_array_t)); -// memset(enb_properties_p, 0, sizeof(Enb_properties_array_t)); -// printf("starting the client\n\n"); -// printf("Starting the async client\n"); -// new_thread(proto_server_start, NULL); - enb_properties_p = enb_config_get(); + Enb_properties_array_t *enb_properties_p = NULL; + + enb_properties_p = enb_config_get(); static int agent_started = 1; @@ -407,6 +401,7 @@ boolean_t pdcp_data_req( } else { + // It should never get here rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); } } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index d16b9ef9ad..8bb8d8de66 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -437,7 +437,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp printf("MSG payload is %u", args->sdu_size); - //memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); + memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); pdu->has_fsp_pdu_data = 1; // Copy data to the ctxt structure diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 775f83654e..66a4b07652 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -653,25 +653,25 @@ void rlc_data_ind ( T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); #endif - if (!srb_flagP) - { +// if (!srb_flagP) +// { proto_agent_send_pdcp_data_ind(ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP); - } - else - { - pdcp_data_ind ( - ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_idP, - sdu_sizeP, - sdu_pP); - } +// } +// else +// { +// pdcp_data_ind ( +// ctxt_pP, +// srb_flagP, +// MBMS_flagP, +// rb_idP, +// sdu_sizeP, +// sdu_pP); +// } } //----------------------------------------------------------------------------- void rlc_data_conf (const protocol_ctxt_t* const ctxt_pP, -- GitLab From 71cc8fa33765542b9684b5d77982bf458468769e Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Tue, 4 Oct 2016 20:18:15 +0300 Subject: [PATCH 009/308] Changed the mem alloc of queue 12 for data; can now work for TCP split with traffic more than 2Mbps --- openair2/UTIL/MEM/mem_block.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h index edcb147cee..2fa354f25b 100755 --- a/openair2/UTIL/MEM/mem_block.h +++ b/openair2/UTIL/MEM/mem_block.h @@ -151,7 +151,9 @@ private_mem_block(void check_free_mem_block (mem_block_t * leP);) # define MEM_MNGT_MB12_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*4096 // 262144 -# define MEM_MNGT_MB12_NB_BLOCKS 32 * MEM_SCALE +# define MEM_MNGT_MB12_NB_BLOCKS 1024 * MEM_SCALE +//# define MEM_MNGT_MB12_NB_BLOCKS 4096 * MEM_SCALE + # define MEM_MNGT_POOL_ID12 12 -- GitLab From e0c3356dbb2a72c91d40d2ad378affb73ab50918 Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Mon, 10 Oct 2016 19:43:26 +0300 Subject: [PATCH 010/308] Fixed memory management issues --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 15 ++----- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 14 +++--- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 43 +++++++++++-------- 3 files changed, 33 insertions(+), 39 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 24c3ccdc42..19b1666426 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -396,6 +396,9 @@ boolean_t pdcp_data_req( proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); //rlc_status = ack_result; + // free the memory for this block + free_mem_block(pdcp_pdu_p); + printf("Response is %u\n", ack_result_nikos); rlc_status = ack_result_nikos; } @@ -454,18 +457,6 @@ boolean_t pdcp_data_req( } }*/ - //starting async -// const Enb_properties_array_t *enb_properties_p = NULL; -// Enb_properties_array_t *enb_properties_p = NULL; -// enb_properties_p = malloc(sizeof(Enb_properties_array_t)); -// memset(enb_properties_p, 0, sizeof(Enb_properties_array_t)); -// printf("starting the client\n\n"); - -// printf("Starting the async client\\n"); -// new_thread(proto_server_start, NULL); -// enb_properties_p = enb_config_get(); - -// proto_agent_start(ctxt_pP->module_id, enb_properties_p); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 069dab1c95..89c2b6c596 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -86,7 +86,7 @@ void *receive_thread(void *args) { LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); } - free(data); + //free(data); if (msg != NULL){ if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { @@ -373,12 +373,10 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl int msgsize = 0; if (init_msg != NULL) { - printf("Will pack the message\n"); + msg = proto_agent_pack_message(init_msg, &msgsize); - printf("Will free the message\n"); - free(init_msg); - + LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); if (msg!=NULL) @@ -441,7 +439,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f printf("Will pack the message \n"); msg = proto_agent_pack_message(init_msg, &msgsize); printf("packed the message \n"); - free(init_msg); + //free(init_msg); if (msg!=NULL) { @@ -496,7 +494,7 @@ proto_server_receive(void) } else { - free(data); + //free(data); ser_msg = proto_agent_pack_message(msg, &size); } @@ -554,7 +552,7 @@ proto_client_receive(void) } else { - free(data); + //free(data); ser_msg = proto_agent_pack_message(msg, &size); } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 8bb8d8de66..216d5ad0b4 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -242,13 +242,13 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG) goto error; - //free(msg->data_req_msg->header); - //free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data); - //free(msg->data_req_msg->pdcp_data->fsp_pdu); - //free(msg->data_req_msg->pdcp_data->fsp_ctxt); - //free(msg->data_req_msg->pdcp_data); - //free(msg->data_req_msg); - //free(msg); + free(msg->data_req_msg->header); + free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data); + free(msg->data_req_msg->pdcp_data->fsp_pdu); + free(msg->data_req_msg->pdcp_data->fsp_ctxt); + free(msg->data_req_msg->pdcp_data); + free(msg->data_req_msg); + free(msg); return 0; error: @@ -355,6 +355,8 @@ int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__Fl return 0; error: + if (pdcp_pdu_p != NULL) + free_mem_block(pdcp_pdu_p); if(header != NULL) free(header); if(ack!=NULL) @@ -370,9 +372,9 @@ int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK) goto error; - //free(msg->data_req_ack->header); - //free(msg->data_req_ack); - //free(msg); + free(msg->data_req_ack->header); + free(msg->data_req_ack); + free(msg); return 0; error: @@ -385,9 +387,9 @@ int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG) goto error; - //free(msg->data_req_ack->header); - //free(msg->data_req_ack); - //free(msg); + free(msg->data_req_ack->header); + free(msg->data_req_ack); + free(msg); return 0; error: @@ -591,6 +593,9 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl free(ack); if(*msg != NULL) free(*msg); + if (pdcp_pdu_p != NULL) + free_mem_block(pdcp_pdu_p); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; @@ -601,9 +606,9 @@ int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_ACK) goto error; - //free(msg->data_req_ack->header); - //free(msg->data_req_ack); - //free(msg); + free(msg->data_req_ack->header); + free(msg->data_req_ack); + free(msg); return 0; error: @@ -764,9 +769,9 @@ int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG) goto error; - //free(msg->echo_reply_msg->header); - //free(msg->echo_reply_msg); - //free(msg); + free(msg->echo_reply_msg->header); + free(msg->echo_reply_msg); + free(msg); return 0; error: -- GitLab From af6af8a90db51ee61ac13b511df7e175f19b8c04 Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Mon, 10 Oct 2016 20:12:46 +0300 Subject: [PATCH 011/308] Cleanup of the messages; sometimes an error is logged --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 19 +------ openair2/LAYER2/PROTO_AGENT/proto_agent.c | 51 +++++++------------ .../LAYER2/PROTO_AGENT/proto_agent_common.c | 46 +++++------------ .../LAYER2/PROTO_AGENT/proto_agent_common.h | 2 +- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 12 ++--- openair2/UTIL/ASYNC_IF/socket_link.c | 10 +--- 6 files changed, 41 insertions(+), 99 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 19b1666426..d00aebb130 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -380,27 +380,12 @@ boolean_t pdcp_data_req( agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p); } - // Send a Hello Message Everytime that we have a packet - //proto_agent_send_hello(); - //printf("PROTOPDCP is sending a message request\n"); - //printf("PROTOPDCP: vals are %u, %u, %u, %u, %u, %u, %u \n", ctxt_pP, srb_flagP, rb_idP, muiP, confirmP, pdcp_pdu_size); + if (pdcp_pdu_p!=NULL) { - printf("subframe is %u\n", ctxt_pP->subframe); - printf("srb is %u\n", srb_flagP); - printf("MBMS is %u\n", MBMS_FLAG_NO); - printf("rb_id is %u\n", rb_idP); - printf("muiP is %u\n", muiP); - printf("confirm is %u\n", confirmP); - printf("Size is %u\n", pdcp_pdu_size); - proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - //rlc_status = ack_result; - // free the memory for this block free_mem_block(pdcp_pdu_p); - - printf("Response is %u\n", ack_result_nikos); - rlc_status = ack_result_nikos; + rlc_status = ack_result; } else { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 89c2b6c596..a2090f0203 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -83,11 +83,9 @@ void *receive_thread(void *args) { if (msg == NULL) { - LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + LOG_D(PROTO_AGENT,"msg to send back is NULL\n"); } - - //free(data); - + if (msg != NULL){ if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; @@ -209,7 +207,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie int size; #ifdef ECHO - LOG_I(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); + LOG_D(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); #else LOG_D(PROTO_AGENT, "Proto agent Server: Calling the hello packet constructor\n"); @@ -223,7 +221,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie int err_code; msg = proto_agent_pack_message(init_msg, &msgsize); - LOG_I(PROTO_AGENT,"Server sending the message over the async channel\n"); + LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); /* After sending the message, wait for any replies; @@ -231,14 +229,14 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie over the channel */ - LOG_I(PROTO_AGENT, "Server reading any message over the async channel.\n"); + LOG_D(PROTO_AGENT, "Server reading any message over the async channel.\n"); new_thread(proto_server_receive, &proto_server[mod_id]); - LOG_I(PROTO_AGENT,"server ends\n"); + LOG_D(PROTO_AGENT,"server ends\n"); return 0; error: - LOG_I(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT,"there was an error\n"); return 1; } @@ -320,7 +318,6 @@ proto_agent_send_hello(void) msg_flag = proto_agent_hello(proto_agent[client_mod].enb_id, NULL, &init_msg); int msgsize = 0; - //int err_code; if (msg_flag == 0) { proto_agent_serialize_message(init_msg, &msg, &msgsize); @@ -336,14 +333,13 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { - printf("PROTOPDCP: sending the data req over the async channel\n"); + //printf("PROTOPDCP: sending the data req over the async channel\n"); Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; Protocol__FlexsplitMessage *rep = NULL; Protocol__FlexsplitMessage *srep = NULL; - //Protocol__FlexsplitMessage *rep_msg=NULL; int msg_flag = 0; void *data=NULL; int priority; @@ -377,7 +373,7 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl msg = proto_agent_pack_message(init_msg, &msgsize); - LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); + LOG_D(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); if (msg!=NULL) proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); @@ -400,14 +396,14 @@ void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { - printf("PROTOPDCP: Sending Data Indication over the async channel\n"); + //printf("PROTOPDCP: Sending Data Indication over the async channel\n"); Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg = NULL; Protocol__FlexsplitMessage *rep = NULL; Protocol__FlexsplitMessage *srep = NULL; - //Protocol__FlexsplitMessage *rep_msg=NULL; + int msg_flag = 0; void *data=NULL; int priority; @@ -436,14 +432,11 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f if (init_msg != NULL) { - printf("Will pack the message \n"); msg = proto_agent_pack_message(init_msg, &msgsize); - printf("packed the message \n"); - //free(init_msg); - + if (msg!=NULL) { - LOG_I(PROTO_AGENT,"Server sending the pdcp data_ind message over the async channel\n"); + LOG_D(PROTO_AGENT,"Server sending the pdcp data_ind message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) server_channel); } } @@ -484,22 +477,20 @@ proto_server_receive(void) goto error; } - LOG_I(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); + LOG_D(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); msg=proto_agent_handle_message(d->enb_id, data, size); if (msg == NULL) { - LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + LOG_D(PROTO_AGENT,"msg to send back is NULL\n"); } else { - //free(data); - - ser_msg = proto_agent_pack_message(msg, &size); + ser_msg = proto_agent_pack_message(msg, &size); } - LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); + LOG_D(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); if (ser_msg != NULL){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; @@ -537,29 +528,25 @@ proto_client_receive(void) ser_msg = NULL; if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel)){ - //proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - LOG_I(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); + LOG_D(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); msg=proto_agent_handle_message(d->enb_id, data, size); if (msg == NULL) { - LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + LOG_D(PROTO_AGENT,"msg to send back is NULL\n"); } else { - //free(data); - ser_msg = proto_agent_pack_message(msg, &size); } if (ser_msg != NULL){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel)){ - //proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 216d5ad0b4..1f3c7152d5 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -39,7 +39,6 @@ #include <time.h> #include "proto_agent_common.h" -//#include "proto_agent.h" #include "PHY/extern.h" #include "log.h" @@ -47,9 +46,6 @@ #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rrc_eNB_UE_context.h" - -//#include <protobuf-c/protobuf-c.h> - void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB]; @@ -114,7 +110,6 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader ** int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - printf("Called the callback function, returing 1\n"); return 1; } @@ -127,7 +122,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp // Create the protobuf header Protocol__FspHeader *header; xid_t xid = 1; - LOG_I(PROTO_AGENT, "creating the data_req message\n"); + LOG_D(PROTO_AGENT, "creating the data_req message\n"); if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0) goto error; @@ -156,9 +151,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp // Copy data to the RlcPdu structure pdu->fsp_pdu_data.data = malloc(args->sdu_size); pdu->fsp_pdu_data.len = args->sdu_size; - - printf("MSG payload is %u", args->sdu_size); - + memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); pdu->has_fsp_pdu_data = 1; @@ -203,11 +196,6 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp data_req->has_enb_id = 1; data_req->pdcp_data = rlc_data; - -/* - printf("PROTOPDCP:initialized the data_req\n"); - printf("PROTOPDCP2: instance is %u, fame is %u", args->ctxt->instance, args->ctxt->frame);*/ - *msg = malloc(sizeof(Protocol__FlexsplitMessage)); if(*msg == NULL) @@ -218,7 +206,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG; (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK (*msg)->has_msg_dir = 1; - (*msg)->data_req_msg = data_req; //data_req; + (*msg)->data_req_msg = data_req; return 0; @@ -258,19 +246,14 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - // printf("Inside data handler for ACK"); Protocol__FspHeader *header; xid_t xid; rlc_op_status_t result = 0; - - LOG_I(PROTO_AGENT, "handling the data_req_ack message\n"); - + LOG_D(PROTO_AGENT, "handling the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; - result = data_ack->result; - printf("Received result is %u\n", result); - ack_result_nikos = result; + ack_result = result; } @@ -281,7 +264,7 @@ int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__Fl xid_t xid; rlc_op_status_t result = 0; - LOG_I(PROTO_AGENT, "creating the data_req_ack message\n"); + LOG_D(PROTO_AGENT, "creating the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReq *data_req = input->data_req_msg; @@ -406,7 +389,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp // Create the protobuf header Protocol__FspHeader *header; xid_t xid = 1; - LOG_I(PROTO_AGENT, "creating the data_ind message\n"); + LOG_D(PROTO_AGENT, "creating the data_ind message\n"); if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND, &header) != 0) goto error; @@ -437,8 +420,6 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp pdu->fsp_pdu_data.data = malloc(args->sdu_size); pdu->fsp_pdu_data.len = args->sdu_size; - printf("MSG payload is %u", args->sdu_size); - memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); pdu->has_fsp_pdu_data = 1; @@ -486,7 +467,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp goto error; protocol__flexsplit_message__init(*msg); - LOG_I(PROTO_AGENT,"setting the message case to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG); + LOG_D(PROTO_AGENT,"setting the message case to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG); (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG; (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK @@ -518,7 +499,7 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl xid_t xid; rlc_op_status_t result = 0; - LOG_I(PROTO_AGENT, "creating the data_ind_ack message\n"); + LOG_D(PROTO_AGENT, "creating the data_ind_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg; @@ -624,7 +605,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0) goto error; - LOG_I(PROTO_AGENT, "creating the HELLO message\n"); + LOG_D(PROTO_AGENT, "creating the HELLO message\n"); Protocol__FspHello *hello_msg = NULL; hello_msg = malloc(sizeof(Protocol__FspHello)); if(hello_msg == NULL) @@ -676,8 +657,7 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl xid_t xid = 1; if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0) goto error; - LOG_I(PROTO_AGENT,"Created the fsp message header\n"); - LOG_I(PROTO_AGENT, "creating the echo request message\n"); + LOG_D(PROTO_AGENT, "creating the echo request message\n"); Protocol__FspEchoRequest *echo_request_msg = NULL; echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest)); @@ -692,7 +672,7 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl goto error; protocol__flexsplit_message__init(*msg); - LOG_I(PROTO_AGENT,"setting the message direction to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG); + LOG_D(PROTO_AGENT,"setting the message direction to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG); (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG; (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; (*msg)->has_msg_dir = 1; @@ -732,7 +712,7 @@ int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__Flexsplit - LOG_I(PROTO_AGENT, "creating the echo reply message\n"); + LOG_D(PROTO_AGENT, "creating the echo reply message\n"); Protocol__FspHeader *header; if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0) goto error; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index 159ed036e0..67209fc55d 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -72,7 +72,7 @@ typedef int (*proto_agent_message_destruction_callback)( ); -uint32_t ack_result_nikos; +uint32_t ack_result; /********************************** * progRAN protocol messages helper diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index b2b085c999..60cbd5d4ca 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -77,7 +77,7 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, err_code_t err_code; DevAssert(data != NULL); - LOG_I(PROTO_AGENT, "Deserializing message with size %u \n", size); + LOG_D(PROTO_AGENT, "Deserializing message with size %u \n", size); if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) { err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; goto error; @@ -85,15 +85,14 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message; if (header->has_type) { - LOG_I(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir); + LOG_D(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir); } - //printf("HANDLER: msg_case %u msg_dir %u\n\n", decoded_message->msg_case, decoded_message->msg_dir); if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) || (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)) { err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; - LOG_I(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); + LOG_D(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); goto error; } @@ -122,18 +121,15 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, void * buffer; err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR; - printf("serializing message\n"); if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING; goto error; } - // free the msg --> later keep this in the data struct and just update the values //TODO call proper destroy function - printf("destruction callback\n"); + err_code = ((*message_destruction_callback[msg->msg_case-1])(msg)); - printf("asserion"); DevAssert(buffer !=NULL); LOG_D(PROTO_AGENT,"Serialized the enb mac stats reply (size %d)\n", *size); diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 7b4758b21d..4abc499354 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -135,7 +135,7 @@ socket_link_t *new_link_client(char *server, int port) } ret->socket_fd = -1; - LOG_I(PROTO_AGENT, "Creating a new link client socket connecting to %s:%d\n", server, port); + LOG_D(PROTO_AGENT, "Creating a new link client socket connecting to %s:%d\n", server, port); ret->socket_fd = socket(AF_INET, SOCK_STREAM, 0); if (ret->socket_fd == -1) { @@ -270,11 +270,8 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) link->bytes_received += 4; + LOG_D(PROTO_AGENT, "ASYNC BYTES Received are :%d \n", link->bytes_received); - - LOG_I(PROTO_AGENT, "ASYNC BYTES Received are :%d \n", link->bytes_received); - LOG_I(PROTO_AGENT, "Size is :%d \n", size); - data = malloc(size); if (data == NULL) { LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); @@ -286,9 +283,6 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) link->bytes_received += size; link->packets_received++; - - LOG_I(PROTO_AGENT, "received %d bytes\n", link->bytes_received); - *ret_data = data; *ret_size = size; return 0; -- GitLab From 9db40696f79731a96ee6eb10b68bf203e9cb8f99 Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Fri, 21 Jul 2017 14:02:09 +0300 Subject: [PATCH 012/308] Added functionality for UDP/TCP/SCTP transferring of data over the ASYNC channel interface. Added selection of interfaces through the configuration file with a new block of statements as follows: FLEXSPLIT_INTERFACES : { DU_INTERFACE_NAME_FOR_F1U = "lo"; DU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1/24"; DU_PORT_FOR_F1U = 2210; CU_INTERFACE_NAME_FOR_F1U = "lo"; CU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1"; //Address to search the DU CU_PORT_FOR_F1U = 2210; // One of TCP/UDP/SCTP F1_U_TRANSPORT_TYPE = "UDP"; }; --- openair2/ENB_APP/enb_config.c | 103 ++++-- openair2/ENB_APP/enb_config.h | 22 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 30 +- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 245 ++++++++++--- .../LAYER2/PROTO_AGENT/proto_agent_async.c | 82 +++-- .../LAYER2/PROTO_AGENT/proto_agent_async.h | 7 +- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 1 + .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 3 +- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.h | 1 + openair2/UTIL/ASYNC_IF/link_manager.c | 12 +- openair2/UTIL/ASYNC_IF/link_manager.h | 10 +- openair2/UTIL/ASYNC_IF/message_queue.h | 2 + openair2/UTIL/ASYNC_IF/socket_link.c | 345 +++++++++++++++++- openair2/UTIL/ASYNC_IF/socket_link.h | 10 +- ...enb.band7.generic.oaisim.local_no_mme.conf | 14 + 15 files changed, 753 insertions(+), 134 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index a405b95b6e..95b2f25de7 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -170,13 +170,14 @@ #define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U "ENB_IPV4_ADDRESS_FOR_S1U" #define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U" -#define ENB_CONFIG_STRING_FLEXSPLIT_CONFIG "FLEXSPLIT" -#define ENB_CONFIG_STRING_PROTO_AGENT_INTERFACE_NAME "PROTO_AGENT_INTERFACE_NAME" -#define ENB_CONFIG_STRING_PROTO_AGENT_IPV4_ADDRESS "PROTO_AGENT_IPV4_ADDRESS" -#define ENB_CONFIG_STRING_PROTO_AGENT_PORT "PROTO_AGENT_PORT" -#define ENB_CONFIG_STRING_PROTO_AGENT_CACHE "PROTO_AGENT_CACHE" - - +#define ENB_CONFIG_STRING_FLEXSPLIT_INTERFACES_CONFIG "FLEXSPLIT_INTERFACES" +#define ENB_CONFIG_STRING_DU_INTERFACE_NAME_FOR_F1U "DU_INTERFACE_NAME_FOR_F1U" +#define ENB_CONFIG_STRING_DU_IPV4_ADDRESS_FOR_F1U "DU_IPV4_ADDRESS_FOR_F1U" +#define ENB_CONFIG_STRING_DU_PORT_FOR_F1U "DU_PORT_FOR_F1U" +#define ENB_CONFIG_STRING_CU_INTERFACE_NAME_FOR_F1U "CU_INTERFACE_NAME_FOR_F1U" +#define ENB_CONFIG_STRING_CU_IPV4_ADDRESS_FOR_F1U "CU_IPV4_ADDRESS_FOR_F1U" +#define ENB_CONFIG_STRING_CU_PORT_FOR_F1U "CU_PORT_FOR_F1U" +#define ENB_CONFIG_STRING_F1_U_TRANSPORT_TYPE "F1_U_TRANSPORT_TYPE" #define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config" #define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name" @@ -635,11 +636,21 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) char *cidr = NULL; char *astring = NULL; - char* proto_agent_interface_name = NULL; - char* proto_agent_ipv4_address = NULL; - libconfig_int proto_agent_port = 0; - char* proto_agent_cache = NULL; - +// char* proto_agent_interface_name = NULL; +// char* proto_agent_ipv4_address = NULL; +// libconfig_int proto_agent_port = 0; +// char* proto_agent_cache = NULL; + + char* du_interface_name_for_F1U = NULL; + char* du_ipv4_address_for_F1U = NULL; + libconfig_int du_port_for_F1U = 0; + + char* cu_interface_name_for_F1U = NULL; + char* cu_ipv4_address_for_F1U = NULL; + libconfig_int cu_port_for_F1U = 0; + + char* transport_type_F1U = NULL; + libconfig_int otg_ue_id = 0; char* otg_app_type = NULL; char* otg_bg_traffic = NULL; @@ -2355,27 +2366,65 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) } // PROTO_AGENT configuration - subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_FLEXSPLIT_CONFIG); - + subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_FLEXSPLIT_INTERFACES_CONFIG); + //LOG_I(PROTO_AGENT, "HERE\n"); if (subsetting != NULL) { if ( ( - config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_INTERFACE_NAME, - (const char **)&proto_agent_interface_name) - && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_IPV4_ADDRESS, - (const char **)&proto_agent_ipv4_address) - && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_PROTO_AGENT_PORT, - &proto_agent_port) - && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_CACHE, - (const char **)&proto_agent_cache) + config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_DU_INTERFACE_NAME_FOR_F1U, + (const char **)&du_interface_name_for_F1U) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_DU_IPV4_ADDRESS_FOR_F1U, + (const char **)&du_ipv4_address_for_F1U) + && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_DU_PORT_FOR_F1U, + &du_port_for_F1U) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_CU_INTERFACE_NAME_FOR_F1U, + (const char **)&cu_interface_name_for_F1U) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_CU_IPV4_ADDRESS_FOR_F1U, + (const char **)&cu_ipv4_address_for_F1U) + && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_CU_PORT_FOR_F1U, + &cu_port_for_F1U) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_F1_U_TRANSPORT_TYPE, + (const char **)&transport_type_F1U) ) ) { - enb_properties.properties[enb_properties_index]->proto_agent_interface_name = strdup(proto_agent_interface_name); - cidr = proto_agent_ipv4_address; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.du_interface = strdup(du_interface_name_for_F1U); + cidr = du_ipv4_address_for_F1U; address = strtok(cidr, "/"); - enb_properties.properties[enb_properties_index]->proto_agent_ipv4_address = strdup(address); + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.du_ipv4_address = strdup(address); + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.du_port = du_port_for_F1U; - enb_properties.properties[enb_properties_index]->proto_agent_port = proto_agent_port; - enb_properties.properties[enb_properties_index]->proto_agent_cache = strdup(proto_agent_cache); + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.cu_interface = strdup(cu_interface_name_for_F1U); + cidr = cu_ipv4_address_for_F1U; + address = strtok(cidr, "/"); + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.cu_ipv4_address = strdup(address); + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.cu_port = cu_port_for_F1U; + + if (strcmp(transport_type_F1U, "UDP") == 0) + { + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.udp = 1; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.tcp = 0; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.sctp = 0; + } + else if (strcmp(transport_type_F1U, "TCP") == 0) + { + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.udp = 0; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.tcp = 1; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.sctp = 0; + } + + else if (strcmp(transport_type_F1U, "SCTP") == 0) + { + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.udp = 0; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.tcp = 0; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.sctp = 1; + } + else + { + // Will be handled by the proto agent functionality + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.udp = 0; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.tcp = 0; + enb_properties.properties[enb_properties_index]->flexsplit_interfaces.sctp = 0; + } + } } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index d8b7e6717b..7e8eef71c2 100755 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -78,6 +78,22 @@ typedef struct mme_ip_address_s { char *ipv6_address; } mme_ip_address_t; + +typedef struct flexplit_interfaces { + char *du_interface; + char *du_ipv4_address; + uint16_t du_port; + + char *cu_interface; + char *cu_ipv4_address; + uint16_t cu_port; + + unsigned tcp:1; + unsigned udp:1; + unsigned sctp:1; + +}flexsplit_interfaces_t; + typedef struct rrh_gw_config_s { unsigned udp:1; unsigned raw:1; @@ -221,11 +237,7 @@ typedef struct Enb_properties_s { char *enb_interface_name_for_S1_MME; in_addr_t enb_ipv4_address_for_S1_MME; - - char *proto_agent_interface_name; - in_addr_t proto_agent_ipv4_address; - tcp_udp_port_t proto_agent_port; - char *proto_agent_cache; + flexsplit_interfaces_t flexsplit_interfaces; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index d00aebb130..b058951c87 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -374,22 +374,23 @@ boolean_t pdcp_data_req( enb_properties_p = enb_config_get(); static int agent_started = 1; - +/* if (agent_started == 1) { + LOG_I(PROTO_AGENT,"PDCP: starting client side with mod_id %d \n",ctxt_pP->module_id); agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p); - } + }*/ if (pdcp_pdu_p!=NULL) { - proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - free_mem_block(pdcp_pdu_p); - rlc_status = ack_result; + proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + free_mem_block(pdcp_pdu_p); + rlc_status = ack_result; } else { - // It should never get here + //It should never get here rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); } } @@ -921,6 +922,23 @@ pdcp_run ( int result; protocol_ctxt_t ctxt; #endif + + static int agent_started = 1; + + + Enb_properties_array_t *enb_properties_p = NULL; + + enb_properties_p = enb_config_get(); + + if (agent_started == 1) + { + LOG_I(PROTO_AGENT,"Starting the PDCP instance\n"); + //LOG_I(PROTO_AGENT,"PDCP: starting client side with mod_id %d \n",ctxt_pP->module_id); + + agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p); + } + + if (ctxt_pP->enb_flag) { start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].pdcp_run); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index a2090f0203..38c76d7dd9 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -57,6 +57,13 @@ Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); mid_t client_mod, server_mod; proto_agent_instance_t *client_channel, *server_channel; + +uint8_t tcp = 0; +uint8_t udp = 0; +uint8_t sctp = 0; +char *link_type = NULL; + + #define ECHO /* Thread continuously listening for incomming packets */ @@ -135,8 +142,8 @@ pthread_t new_thread(void *(*f)(void *), void *b) { void * proto_server_init(void *args) { - LOG_D(PROTO_AGENT, "Initializing server thread for listening connections\n"); - mid_t mod_id = (mid_t) 1; + LOG_I(PROTO_AGENT, "Initializing server thread for listening connections\n"); + mid_t mod_id = (mid_t) 0; Enb_properties_array_t* enb_properties = NULL; enb_properties = enb_config_get(); proto_server_start(mod_id, (const Enb_properties_array_t*) enb_properties); @@ -149,32 +156,83 @@ void * proto_server_init(void *args) int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; - + char *peer_address; + // Maybe change the RAN_LTE_OAI to protocol?? (e.g. PDCP) set_enb_vars(mod_id, RAN_LTE_OAI); proto_server[mod_id].enb_id = mod_id; server_mod = mod_id; - /* - * check the configuration - Getting all the values from the config file - * TODO: get the configuration optionally from the conf file - */ - strcpy(local_cache, DEFAULT_PROTO_AGENT_CACHE); - strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS ); - in_port = DEFAULT_PROTO_AGENT_PORT ; + + if (enb_properties->properties[mod_id]->flexsplit_interfaces.cu_ipv4_address != NULL) + { + LOG_D(PROTO_AGENT,"CU ADDRESS IS %s\n",enb_properties->properties[mod_id]->flexsplit_interfaces.cu_ipv4_address); + } + if (enb_properties->properties[mod_id]->flexsplit_interfaces.du_ipv4_address != NULL) + { + LOG_D(PROTO_AGENT,"DU ADDRESS IS %s\n",enb_properties->properties[mod_id]->flexsplit_interfaces.du_ipv4_address); + peer_address = strdup(enb_properties->properties[mod_id]->flexsplit_interfaces.cu_ipv4_address); + } + if (enb_properties->properties[mod_id]->flexsplit_interfaces.du_ipv4_address != NULL) + strcpy(in_ip, enb_properties->properties[mod_id]->flexsplit_interfaces.du_ipv4_address); + else + { + strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS); + LOG_D(PROTO_AGENT,"Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); + } + if (enb_properties->properties[mod_id]->flexsplit_interfaces.du_port != 0) + in_port = enb_properties->properties[mod_id]->flexsplit_interfaces.du_port; + else + { + in_port = DEFAULT_PROTO_AGENT_PORT; + LOG_D(PROTO_AGENT,"Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); + } - LOG_I(PROTO_AGENT,"Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d\n", + if(enb_properties->properties[mod_id]->flexsplit_interfaces.tcp == 1) + { + tcp = 1; + link_type = strdup("TCP"); + LOG_I(PROTO_AGENT,"Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", proto_server[mod_id].enb_id, in_ip, in_port); - + } + else if(enb_properties->properties[mod_id]->flexsplit_interfaces.udp == 1) + { + udp = 1; + link_type = strdup("UDP"); + LOG_I(PROTO_AGENT,"Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over UDP\n", + proto_server[mod_id].enb_id, + in_ip, + in_port); + } + else if(enb_properties->properties[mod_id]->flexsplit_interfaces.sctp == 1) + { + sctp = 1; + link_type = strdup("SCTP"); + LOG_I(PROTO_AGENT,"Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over SCTP\n", + proto_server[mod_id].enb_id, + in_ip, + in_port); + } + else + { + tcp = 1; + link_type = strdup("TCP"); + LOG_I(PROTO_AGENT,"Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", + proto_server[mod_id].enb_id, + in_ip, + in_port); + + } + /* * Initialize the channel container */ proto_agent_init_channel_container(); /*Create the async channel info*/ - proto_agent_instance_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port); + proto_agent_instance_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port, link_type, peer_address); server_channel = channel_info; @@ -190,6 +248,12 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie proto_agent_channel_t *channel = get_channel(channel_id); + + if (tcp == 1) channel->type = 0; + else if (udp == 1) channel->type = 1; + else if (sctp == 1) channel->type = 2; + else channel->type = 0; + if (channel == NULL) { goto error; } @@ -207,28 +271,36 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie int size; #ifdef ECHO - LOG_D(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); - msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); + if (udp == 0) + { + // If the comm is not UDP, allow the server to send the first packet over the channel + LOG_D(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); + msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); + if (msg_flag != 0) + goto error; + + int msgsize = 0; + int err_code; + if (init_msg != NULL) + msg = proto_agent_pack_message(init_msg, &msgsize); + + if (msg!= NULL) + { + LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); + } + /* After sending the message, wait for any replies; + the server thread blocks until it reads any data + over the channel + */ + + } #else LOG_D(PROTO_AGENT, "Proto agent Server: Calling the hello packet constructor\n"); msg_flag = proto_agent_hello(mod_id, NULL, &init_msg); #endif - if (msg_flag != 0) - goto error; - int msgsize = 0; - int err_code; - msg = proto_agent_pack_message(init_msg, &msgsize); - - LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); - - /* After sending the message, wait for any replies; - the server thread blocks until it reads any data - over the channel - */ - LOG_D(PROTO_AGENT, "Server reading any message over the async channel.\n"); new_thread(proto_server_receive, &proto_server[mod_id]); @@ -244,6 +316,7 @@ error: int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; + char *peer_address = NULL; set_enb_vars(mod_id, RAN_LTE_OAI); proto_agent[mod_id].enb_id = mod_id; @@ -253,14 +326,61 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties * check the configuration - Getting all the values from the config file */ - strcpy(local_cache, DEFAULT_PROTO_AGENT_CACHE); - strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS ); - in_port = DEFAULT_PROTO_AGENT_PORT; + if (enb_properties->properties[mod_id]->flexsplit_interfaces.cu_ipv4_address != NULL) + { + strcpy(in_ip, enb_properties->properties[mod_id]->flexsplit_interfaces.cu_ipv4_address); + peer_address = strdup(enb_properties->properties[mod_id]->flexsplit_interfaces.du_ipv4_address); + } + else + { + strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS); + LOG_D(PROTO_AGENT,"Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); + } + if (enb_properties->properties[mod_id]->flexsplit_interfaces.cu_port != 0) + in_port = enb_properties->properties[mod_id]->flexsplit_interfaces.cu_port; + else + { + in_port = DEFAULT_PROTO_AGENT_PORT; + LOG_D(PROTO_AGENT,"Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); + } - LOG_I(PROTO_AGENT,"starting PROTO agent client for module id %d on ipv4 %s, port %d\n", - proto_agent[mod_id].enb_id, + if(enb_properties->properties[mod_id]->flexsplit_interfaces.tcp == 1) + { + tcp = 1; + link_type = strdup("TCP"); + LOG_I(PROTO_AGENT,"Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", + proto_server[mod_id].enb_id, + in_ip, + in_port); + } + else if(enb_properties->properties[mod_id]->flexsplit_interfaces.udp == 1) + { + udp = 1; + link_type = strdup("UDP"); + LOG_I(PROTO_AGENT,"Starting PROTO agent client for module id %d on ipv4 %s, port %d over UDP\n", + proto_server[mod_id].enb_id, + in_ip, + in_port); + } + else if(enb_properties->properties[mod_id]->flexsplit_interfaces.sctp == 1) + { + sctp = 1; + link_type = strdup("SCTP"); + LOG_I(PROTO_AGENT,"Starting PROTO agent client for module id %d on ipv4 %s, port %d over SCTP\n", + proto_server[mod_id].enb_id, in_ip, in_port); + } + else + { + tcp = 1; + link_type = strdup("TCP"); + LOG_I(PROTO_AGENT,"Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", + proto_server[mod_id].enb_id, + in_ip, + in_port); + + } /* * Initialize the channel container @@ -268,7 +388,7 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties proto_agent_init_channel_container(); /*Create the async channel info*/ - proto_agent_instance_t *channel_info = proto_agent_async_channel_info(mod_id, in_ip, in_port); + proto_agent_instance_t *channel_info = proto_agent_async_channel_info(mod_id, in_ip, in_port, link_type, peer_address); client_channel = channel_info; /*Create a channel using the async channel info*/ channel_id = proto_agent_create_channel((void *) channel_info, @@ -284,6 +404,11 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties if (channel == NULL) { goto error; } + + if (tcp == 1) channel->type = 0; + else if (udp == 1) channel->type = 1; + else if (sctp == 1) channel->type = 2; + else channel->type = 0; /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); @@ -292,10 +417,39 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties int size; int priority; err_code_t err_code; - Protocol__FlexsplitMessage *msg; - Protocol__FlexsplitMessage *ser_msg; + Protocol__FlexsplitMessage *msg = NULL; + Protocol__FlexsplitMessage *init_msg=NULL; + Protocol__FlexsplitMessage *rep_msg=NULL; + Protocol__FlexsplitMessage *ser_msg=NULL; + int msg_flag; + // In the case of UDP comm, start the echo request from the client side; the server thread should be blocked until it reads the SRC port of the 1st packet + if (udp == 1) + { + msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); + + + if (msg_flag != 0) + goto error; + + int msgsize = 0; + int err_code; + if (init_msg != NULL) + msg = proto_agent_pack_message(init_msg, &msgsize); + + if (msg!= NULL) + { + LOG_D(PROTO_AGENT,"Client sending the ECHO_REQUEST message over the async channel\n"); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); + } + } + /* After sending the message, wait for any replies; + the server thread blocks until it reads any data + over the channel + */ + + new_thread(proto_client_receive, &proto_agent[mod_id]); return 0; @@ -314,7 +468,7 @@ proto_agent_send_hello(void) int msg_flag = 0; - LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n"); + LOG_D(PROTO_AGENT, "PDCP agent: Calling the HELLO packet constructor\n"); msg_flag = proto_agent_hello(proto_agent[client_mod].enb_id, NULL, &init_msg); int msgsize = 0; @@ -323,7 +477,7 @@ proto_agent_send_hello(void) proto_agent_serialize_message(init_msg, &msg, &msgsize); } - LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); + LOG_D(PROTO_AGENT,"Agent sending the message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); } @@ -347,7 +501,7 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl int ret; int err_code; - LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n"); + LOG_D(PROTO_AGENT, "PDCP agent: Calling the PDCP DATA REQ constructor\n"); data_req_args *args = malloc(sizeof(data_req_args)); @@ -373,7 +527,7 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl msg = proto_agent_pack_message(init_msg, &msgsize); - LOG_D(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); + LOG_D(PROTO_AGENT,"Sending the pdcp data_req message over the async channel\n"); if (msg!=NULL) proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel); @@ -411,7 +565,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f int ret; int err_code; - LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n"); + LOG_D(PROTO_AGENT, "PDCP agent: Calling the PDCP_DATA_IND constructor\n"); data_req_args *args = malloc(sizeof(data_req_args)); @@ -436,7 +590,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f if (msg!=NULL) { - LOG_D(PROTO_AGENT,"Server sending the pdcp data_ind message over the async channel\n"); + LOG_D(PROTO_AGENT,"Sending the pdcp data_ind message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) server_channel); } } @@ -477,7 +631,7 @@ proto_server_receive(void) goto error; } - LOG_D(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); + LOG_D(PROTO_AGENT,"Server side Received message with size %d and priority %d, calling message handle\n", size, priority); msg=proto_agent_handle_message(d->enb_id, data, size); @@ -490,7 +644,7 @@ proto_server_receive(void) ser_msg = proto_agent_pack_message(msg, &size); } - LOG_D(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); + LOG_D(PROTO_AGENT,"Server sending the reply message over the async channel\n"); if (ser_msg != NULL){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; @@ -544,6 +698,7 @@ proto_client_receive(void) { ser_msg = proto_agent_pack_message(msg, &size); } + LOG_D(PROTO_AGENT,"Server sending the reply message over the async channel\n"); if (ser_msg != NULL){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel)){ diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 0f730c1aed..885150ecd2 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -37,29 +37,49 @@ #include "proto_agent_async.h" #include "proto_agent_defs.h" + #include "log.h" +uint16_t proto_udp = 0; +uint16_t proto_tcp = 0; +uint16_t proto_sctp = 0; -proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { +proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr) { proto_agent_async_channel_t *channel; channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); + + channel->port = dst_port; + channel->peer_addr = NULL; if (channel == NULL) goto error; channel->enb_id = mod_id; /*Create a socket*/ - printf("Starting async server\n"); - channel->link = new_link_server(dst_port); - //channel->link = NULL; - printf("Started async server\n"); - if (channel->link == NULL) goto error; + if (strcmp(type, "TCP") == 0) + { + proto_tcp = 1; + channel->link = new_link_server(dst_port); + channel->type = 0; + } + else if (strcmp(type, "UDP") == 0) + { + proto_udp = 1; + //channel->link = new_udp_link_server(dst_port); + channel->link = new_link_udp_server(dst_port); + channel->type = 1; + channel->peer_addr = peer_addr; + } + else if (strcmp(type, "SCTP") == 0) + { + proto_sctp = 1; + //channel->link = new_sctp_link_server(dst_port); + channel->link = new_link_sctp_server(dst_port); + channel->type = 2; + } - LOG_I(PROTO_AGENT,"starting proto agent server for module id %d on ipv4 %s, port %d\n", - channel->enb_id, - dst_ip, - dst_port); + if (channel->link == NULL) goto error; /* * create a message queue @@ -69,11 +89,11 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char if (channel->send_queue == NULL) goto error; channel->receive_queue = new_message_queue(); if (channel->receive_queue == NULL) goto error; - + /* * create a link manager */ - channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link); + channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link, channel->type, channel->peer_addr, channel->port); if (channel->manager == NULL) goto error; return channel; @@ -84,25 +104,41 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char } -proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { +proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr) { proto_agent_async_channel_t *channel; channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); + channel->port = dst_port; + channel->peer_addr = NULL; + if (channel == NULL) goto error; channel->enb_id = mod_id; /*Create a socket*/ - channel->link = new_link_client(dst_ip, dst_port); - - if (channel->link == NULL) goto error; + if (strcmp(type, "TCP") == 0) + { + proto_tcp = 1; + channel->link = new_link_client(dst_ip, dst_port); + channel->type = 0; + } + else if (strcmp(type, "UDP") == 0) + { + proto_udp = 1; + channel->link = new_link_udp_client(dst_ip, dst_port); + channel->type = 1; + channel->peer_addr = peer_addr; + } + else if (strcmp(type, "SCTP") == 0) + { + proto_sctp = 1; + channel->link = new_link_sctp_client(dst_ip, dst_port);; + channel->type = 2; + } - - LOG_I(PROTO_AGENT,"starting proto agent client for module id %d on ipv4 %s, port %d\n", - channel->enb_id, - dst_ip, - dst_port); + + if (channel->link == NULL) goto error; /* * create a message queue @@ -116,13 +152,13 @@ proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char /* * create a link manager */ - channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link); + channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link, channel->type, channel->peer_addr, channel->port); if (channel->manager == NULL) goto error; return channel; error: - LOG_I(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT,"there was an error\n"); return 1; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h index e6abc72e6e..e20cd0feef 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h @@ -41,14 +41,17 @@ typedef struct { mid_t enb_id; + uint16_t type; // 0-> TCP, 1-> UDP, 2->SCTP + char *peer_addr; + int port; socket_link_t *link; message_queue_t *send_queue; message_queue_t *receive_queue; link_manager_t *manager; } proto_agent_async_channel_t; -proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); -proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); +proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr); +proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr); int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 1f3c7152d5..7e28aa3e41 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -254,6 +254,7 @@ int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__Flexs Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; result = data_ack->result; ack_result = result; + return 0; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index 60cbd5d4ca..23bb1ee6d4 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -40,7 +40,7 @@ #include "assertions.h" proto_agent_message_decoded_callback agent_messages_callback[][3] = { - {proto_agent_hello, proto_agent_hello, 0}, + {proto_agent_hello, 0, 0}, {proto_agent_echo_reply, 0, 0}, {0, just_print, 0}, {proto_agent_pdcp_data_req_ack, 0, 0}, @@ -100,6 +100,7 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, if ( err_code < 0 ) { + LOG_I(PROTO_AGENT, "decoded_message case : %d, direction : %d \n", decoded_message->msg_case-1, decoded_message->msg_dir-1); goto error; } else if (err_code == 1) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h index acdb5a5146..b0fa68eb0b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h @@ -45,6 +45,7 @@ typedef struct proto_agent_channel_s { RB_ENTRY(proto_agent_channel_s) entry; int channel_id; void *channel_info; +uint16_t type; // 0-> TCP, 1-> UDP, 2->SCTP /*Callbacks for channel message Tx and Rx*/ int (*msg_send)(void *data, int size, int priority, void *channel_info); int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 4eb8b701f0..a7e3562958 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -57,7 +57,7 @@ static void *link_manager_sender_thread(void *_manager) while (manager->run) { while (message_get(manager->send_queue, &data, &size, &priority) == 0) { - link_send_packet(manager->socket_link, data, size); + link_send_packet(manager->socket_link, data, size, manager->type, manager->peer_addr, manager->port); free(data); } // if (message_get(manager->send_queue, &data, &size, &priority)) @@ -86,7 +86,7 @@ static void *link_manager_receiver_thread(void *_manager) LOG_D(MAC, "starting link manager receiver thread\n"); while (manager->run) { - if (link_receive_packet(manager->socket_link, &data, &size)) + if (link_receive_packet(manager->socket_link, &data, &size, manager->type, manager->peer_addr, manager->port)) goto error; /* todo: priority */ if (message_put(manager->receive_queue, data, size, 0)) @@ -105,7 +105,10 @@ error: link_manager_t *create_link_manager( message_queue_t *send_queue, message_queue_t *receive_queue, - socket_link_t *link) + socket_link_t *link, + uint16_t type, + char *peer_addr, + int port ) { link_manager_t *ret = NULL; pthread_attr_t attr; @@ -120,6 +123,9 @@ link_manager_t *create_link_manager( ret->send_queue = send_queue; ret->receive_queue = receive_queue; ret->socket_link = link; + ret->type = type; + ret->peer_addr = peer_addr; + ret->port = port; ret->run = 1; if (pthread_attr_init(&attr)) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index 1f3049d0b2..1283aa6659 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -41,6 +41,7 @@ #include "message_queue.h" //#include "ringbuffer_queue.h" #include "socket_link.h" +#include <stdint.h> #include <pthread.h> @@ -52,6 +53,9 @@ typedef struct { message_queue_t *send_queue; message_queue_t *receive_queue; socket_link_t *socket_link; + uint16_t type; + char *peer_addr; + int port; pthread_t sender; pthread_t receiver; volatile int run; @@ -60,7 +64,11 @@ typedef struct { link_manager_t *create_link_manager( message_queue_t *send_queue, message_queue_t *receive_queue, - socket_link_t *link); + socket_link_t *link, + uint16_t type, + char *peer_addr, + int port + ); void destroy_link_manager(link_manager_t *); #ifdef __cplusplus diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h index 15fc4335a1..edb2d1a9b2 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.h +++ b/openair2/UTIL/ASYNC_IF/message_queue.h @@ -38,6 +38,7 @@ #ifndef MESSAGE_QUEUE_H #define MESSAGE_QUEUE_H +#include <stdint.h> #include <pthread.h> #ifdef __cplusplus @@ -48,6 +49,7 @@ typedef struct message_t { void *data; int size; int priority; + uint16_t type; struct message_t *next; } message_t; diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 4abc499354..64d43f915f 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -48,6 +48,7 @@ #include <netinet/ip.h> #include <netinet/tcp.h> #include <netinet/udp.h> +#include <netinet/sctp.h> #include <arpa/inet.h> #include <stdint.h> @@ -106,7 +107,6 @@ socket_link_t *new_link_server(int port) LOG_E(PROTO_AGENT, "%s:%d: accept: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } - printf("Accepted new connection from client\n"); close(socket_server); LOG_D(PROTO_AGENT, "connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); @@ -169,6 +169,202 @@ error: return NULL; } + +socket_link_t *new_link_udp_server(int port){ + + socket_link_t *ret = NULL; + + struct sockaddr_in si_me, si_other; + int socket_server, i, slen = sizeof(si_other) , recv_bytes; + char buf[1500]; + + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + ret->socket_fd = -1; + + LOG_D(PROTO_AGENT, "create a new udp link server socket at port %d\n", port); + + //create a UDP socket + if ((socket_server=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { + goto error; + } + + // zero out the structure + memset((char *) &si_me, 0, sizeof(si_me)); + + si_me.sin_family = AF_INET; + si_me.sin_port = htons(port); + si_me.sin_addr.s_addr = htonl(INADDR_ANY); + + //bind socket to port + if( bind(socket_server , (struct sockaddr*)&si_me, sizeof(si_me) ) == -1) { + goto error; + } + ret->socket_fd = socket_server; + ret->peer_port = 0; + return ret; + +error: + close(socket_server); + if (ret != NULL) close(ret->socket_fd); + free(ret); + LOG_E(PROTO_AGENT, "ERROR in new_link_udp_server (see above), returning NULL\n"); + return NULL; +} + + +socket_link_t *new_link_udp_client(char *server, int port){ + + socket_link_t *ret = NULL; + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + //goto error; + } + ret->socket_fd = -1; + + struct sockaddr_in si_other, server_info; + int s, i, slen=sizeof(si_other); + char buf[1500]; + char message[1500]; + + if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1){ + goto error; + } + + memset((char *) &si_other, 0, sizeof(si_other)); + si_other.sin_family = AF_INET; + si_other.sin_port = 0; //htons(port); + + + + if (inet_aton(server, &si_other.sin_addr) == 0){ + fprintf(stderr, "inet_aton() failed\n"); + goto error; + } + connect(s, (struct sockaddr *)&si_other, sizeof(si_other)); + + getsockname(s, (struct sockaddr *)&si_other, &slen); + + ret->socket_fd = s; + ret->peer_port = port; //ntohs(si_other.sin_port); + + return ret; +error: + if (ret != NULL) close(ret->socket_fd); + free(ret); + LOG_E(MAC, "ERROR in new_link_udp_client (see above), returning NULL\n"); + return NULL; +} + + +socket_link_t *new_link_sctp_server(int port) +{ + + socket_link_t *ret = NULL; + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + ret->socket_fd = -1; + + int listenSock, temp; + struct sockaddr_in servaddr; + + listenSock = socket (AF_INET, SOCK_STREAM, IPPROTO_SCTP); + if(listenSock == -1) + { + perror("socket()"); + exit(1); + } + + bzero ((void *) &servaddr, sizeof (servaddr)); + servaddr.sin_family = AF_INET; + servaddr.sin_addr.s_addr = htonl (INADDR_ANY); + servaddr.sin_port = htons(port); + + temp = bind (listenSock, (struct sockaddr *) &servaddr, sizeof (servaddr)); + + if(temp == -1 ) + { + perror("bind()"); + close(listenSock); + exit(1); + } + + temp = listen (listenSock, 5); + if(temp == -1 ) + { + perror("listen()"); + close(listenSock); + exit(1); + } + + ret->socket_fd = accept (listenSock, (struct sockaddr *) NULL, (int *) NULL); + + return ret; + +error: + close(listenSock); + if (ret != NULL) close(ret->socket_fd); + free(ret); + LOG_E(PROTO_AGENT, "ERROR in new_link_sctp_server (see above), returning NULL\n"); + return NULL; +} + +socket_link_t *new_link_sctp_client(char *server, int port) +{ + + socket_link_t *ret = NULL; + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + ret->socket_fd = -1; + + int temp; + struct sockaddr_in servaddr; + + ret->socket_fd = socket (AF_INET, SOCK_STREAM, IPPROTO_SCTP); + + if (ret->socket_fd == -1) + { + perror("socket()"); + exit(1); + } + + bzero ((void *) &servaddr, sizeof (servaddr)); + servaddr.sin_family = AF_INET; + servaddr.sin_port = htons (port); + if (inet_aton(server, &servaddr.sin_addr) == 0) { + LOG_E(PROTO_AGENT, "invalid IP address '%s', use a.b.c.d notation\n", server); + goto error; + } + + temp = connect (ret->socket_fd, (struct sockaddr *) &servaddr, sizeof (servaddr)); + + if (temp == -1) + { + perror("connect()"); + close(ret->socket_fd); + exit(1); + } + + return ret; + +error: + if (ret != NULL) close(ret->socket_fd); + free(ret); + LOG_E(MAC, "ERROR in new_link_sctp_client (see above), returning NULL\n"); + return NULL; +} + + /* * return -1 on error and 0 if the sending was fine */ @@ -192,6 +388,43 @@ error: return -1; } +static int socket_udp_send(int socket_fd, void *buf, int size, char *peer_addr, int port) +{ + + struct sockaddr_in si_other; + int slen = sizeof(si_other); + char *s = buf; + int l; + int my_socket; + + LOG_D(PROTO_AGENT,"UDP send\n"); + + my_socket = socket_fd; + memset((char *) &si_other, 0, sizeof(si_other)); + si_other.sin_family = AF_INET; + si_other.sin_port = htons(port); + + if (inet_aton(peer_addr , &si_other.sin_addr) == 0) + { + fprintf(stderr, "inet_aton() failed\n"); + exit(1); + } + + while (size) { + l = sendto(my_socket, s, size, 0, (struct sockaddr *) &si_other, slen); + if (l == -1) goto error; + if (l == 0) { LOG_E(PROTO_AGENT, "%s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } + size -= l; + s += l; + } + + return 0; +error: + LOG_E(PROTO_AGENT, "socket_udp_send: ERROR: %s\n", strerror(errno)); + return -1; +} + + /* * return -1 on error and 0 if the receiving was fine */ @@ -219,30 +452,85 @@ socket_closed: return -1; } +/* + * return -1 on error and 0 if the receiving was fine + */ +static int socket_udp_receive(int socket_fd, void *buf, int size) +{ + LOG_D(PROTO_AGENT,"UDP RECEIVE\n"); + + struct sockaddr_in client; + int slen = sizeof(client); + char *s = buf; + int l; + + while (size) { + l = recvfrom(socket_fd, s, size, 0, (struct sockaddr *) &client, &slen); + getsockname(s, (struct sockaddr *)&client, &slen); + LOG_D(PROTO_AGENT, "Got message from src port: %u\n", ntohs(client.sin_port)); + if (l == -1) goto error; + if (l == 0) goto socket_closed; + size -= l; + s += l; + } + + return ntohs(client.sin_port); + +error: + LOG_E(MAC, "socket_udp_receive: ERROR: %s\n", strerror(errno)); + return -1; + +socket_closed: + LOG_E(MAC, "socket_udp_receive: socket closed\n"); + return -1; +} + + /* * return -1 on error and 0 if the sending was fine */ -int link_send_packet(socket_link_t *link, void *data, int size) +int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, char *peer_addr, int port) { char sizebuf[4]; int32_t s = size; - + /* send the size first, maximum is 2^31 bytes */ sizebuf[0] = (s >> 24) & 255; sizebuf[1] = (s >> 16) & 255; sizebuf[2] = (s >> 8) & 255; sizebuf[3] = s & 255; - if (socket_send(link->socket_fd, sizebuf, 4) == -1) - goto error; - - link->bytes_sent += 4; + if ((proto_type == 0) || (proto_type == 2)) + { + if (socket_send(link->socket_fd, sizebuf, 4) == -1) + goto error; + + link->bytes_sent += 4; - if (socket_send(link->socket_fd, data, size) == -1) - goto error; + if (socket_send(link->socket_fd, data, size) == -1) + goto error; - link->bytes_sent += size; - link->packets_sent++; + link->bytes_sent += size; + link->packets_sent++; + } + else if (proto_type == 1 ) + { + while (link->peer_port == 0) + { + sleep(0.1); + } + LOG_D(PROTO_AGENT, "peer port is %d", link->peer_port); + if (socket_udp_send(link->socket_fd, sizebuf, 4, peer_addr, link->peer_port) == -1) + goto error; + + link->bytes_sent += 4; + + if (socket_udp_send(link->socket_fd, data, size, peer_addr, link->peer_port) == -1) + goto error; + + link->bytes_sent += size; + link->packets_sent++; + } return 0; @@ -253,16 +541,28 @@ error: /* * return -1 on error and 0 if the sending was fine */ -int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) +int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uint16_t proto_type, char *peer_addr, int port) { unsigned char sizebuf[4]; int32_t size; void *data = NULL; + int peer_port = 0; + if ((proto_type == 0) || (proto_type == 2)) + { /* received the size first, maximum is 2^31 bytes */ - if (socket_receive(link->socket_fd, sizebuf, 4) == -1) - goto error; - + if (socket_receive(link->socket_fd, sizebuf, 4) == -1) + goto error; + } + else if (proto_type == 1) + { + /* received the size first, maximum is 2^31 bytes */ + peer_port = socket_udp_receive(link->socket_fd, sizebuf, 4); + if ( peer_port == -1) + goto error; + if (link->peer_port == 0) link->peer_port = peer_port; + } + size = (sizebuf[0] << 24) | (sizebuf[1] << 16) | (sizebuf[2] << 8) | @@ -277,10 +577,17 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); goto error; } - - if (socket_receive(link->socket_fd, data, size) == -1) - goto error; - + + if ((proto_type == 0) || (proto_type == 2)) + { + if (socket_receive(link->socket_fd, data, size) == -1) + goto error; + } + else if (proto_type == 1) + { + if (socket_udp_receive(link->socket_fd, data, size) == -1) + goto error; + } link->bytes_received += size; link->packets_received++; *ret_data = data; diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h index c9e99b839f..c62229bbc6 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.h +++ b/openair2/UTIL/ASYNC_IF/socket_link.h @@ -44,8 +44,10 @@ extern "C" { #endif + typedef struct { int socket_fd; + int peer_port; uint64_t bytes_sent; uint64_t packets_sent; uint64_t bytes_received; @@ -54,8 +56,12 @@ typedef struct { socket_link_t *new_link_server(int port); socket_link_t *new_link_client(char *server, int port); -int link_send_packet(socket_link_t *link, void *data, int size); -int link_receive_packet(socket_link_t *link, void **data, int *size); +socket_link_t *new_link_udp_server(int port); +socket_link_t *new_link_udp_client(char *server, int port); +socket_link_t *new_link_sctp_server(int port); +socket_link_t *new_link_sctp_client(char *server, int port); +int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, char *peer_addr, int port); +int link_receive_packet(socket_link_t *link, void **data, int *size, uint16_t proto_type, char *peer_addr, int port); int close_link(socket_link_t *link); #ifdef __cplusplus diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf index 50cb6747ac..b5d13d5b54 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf @@ -118,6 +118,20 @@ eNBs = ENB_PORT_FOR_S1U = 2153; # Spec 2152 }; + FLEXSPLIT_INTERFACES : + { + DU_INTERFACE_NAME_FOR_F1U = "eth0"; + DU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1/24"; + DU_PORT_FOR_F1U = 2210; + + CU_INTERFACE_NAME_FOR_F1U = "lo"; + CU_IPV4_ADDRESS_FOR_F1U = "10.64.45.62"; //Address to search the DU + CU_PORT_FOR_F1U = 2210; + + // One of TCP/UDP/SCTP + F1_U_TRANSPORT_TYPE = "UDP"; + }; + log_config : { global_log_level ="trace"; -- GitLab From 73691de7f69a54f88a2f7797ec781e0cbf99c89a Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Thu, 8 Feb 2018 19:13:34 +0200 Subject: [PATCH 013/308] Fixes that were affecting the communication between PDCP and RLC, cleanup --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 93 +++++++++---------- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 31 ++----- openair2/UTIL/ASYNC_IF/socket_link.c | 22 ++--- .../CONF/enb.band7.tm1.50PRB.usrpb210.conf | 6 +- 4 files changed, 68 insertions(+), 84 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 05eab8a028..f2f2435441 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -87,13 +87,13 @@ void *receive_thread(void *args) { goto error; } - printf("PROTO_AGENT: Received message with size %d and priority %d, calling message handle\n", size, priority); + LOG_D(PROTO_AGENT, "Received message with size %d and priority %d, calling message handle\n", size, priority); msg=proto_agent_handle_message(d->enb_id, data, size); if (msg == NULL) { - printf("PROTO_AGENT: msg to send back is NULL\n"); + LOG_D(PROTO_AGENT, "msg to send back is NULL\n"); } if (msg != NULL){ @@ -101,14 +101,14 @@ void *receive_thread(void *args) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - printf("PROTO_AGENT: sent message with size %d\n", size); + LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } } return NULL; error: - LOG_E(PROTO_AGENT,"receive_thread: error %d occured\n",err_code); + LOG_E(PROTO_AGENT, "receive_thread: error %d occured\n",err_code); return NULL; } @@ -145,7 +145,7 @@ pthread_t new_thread(void *(*f)(void *), void *b) { void * proto_server_init(void *args) { - printf( "Initializing server thread for listening connections\n"); + //printf( "Initializing server thread for listening connections\n"); mid_t mod_id = (mid_t) 0; cudu_params_t* cudu = NULL; cudu = get_cudu_config(); @@ -167,28 +167,28 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ if (cudu->local_du.du_ipv4_address != NULL) { - //printf("PROTO_AGENT: DU ADDRESS IS %s\n",cudu->local_du.du_ipv4_address); + //LOG_D(PROTO_AGENT, "DU ADDRESS IS %s\n",cudu->local_du.du_ipv4_address); peer_address = strdup(cudu->local_du.du_ipv4_address); strcpy(in_ip, cudu->local_du.du_ipv4_address); } else { strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS); - //printf("PROTO_AGENT: Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); + //LOG_D(PROTO_AGENT, "Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); } if (cudu->local_du.du_port != 0) in_port = cudu->local_du.du_port; else { in_port = DEFAULT_PROTO_AGENT_PORT; - //printf("PROTO_AGENT: Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); + //LOG_D(PROTO_AGENT, "Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); } if(cudu->local_du.tcp == 1) { tcp = 1; link_type = strdup("TCP"); - printf("PROTO_AGENT: Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", + LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", proto_server[mod_id].enb_id, in_ip, in_port); @@ -197,7 +197,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ { udp = 1; link_type = strdup("UDP"); - printf("PROTO_AGENT: Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over UDP\n", + LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over UDP\n", proto_server[mod_id].enb_id, in_ip, in_port); @@ -206,7 +206,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ { sctp = 1; link_type = strdup("SCTP"); - printf("PROTO_AGENT: Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over SCTP\n", + LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over SCTP\n", proto_server[mod_id].enb_id, in_ip, in_port); @@ -215,7 +215,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ { tcp = 1; link_type = strdup("TCP"); - printf("PROTO_AGENT: Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", + LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", proto_server[mod_id].enb_id, in_ip, in_port); @@ -269,7 +269,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ if (udp == 0) { // If the comm is not UDP, allow the server to send the first packet over the channel - printf( "Proto agent Server: Calling the echo_request packet constructor\n"); + //printf( "Proto agent Server: Calling the echo_request packet constructor\n"); msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); if (msg_flag != 0) goto error; @@ -281,7 +281,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ if (msg!= NULL) { - printf("PROTO_AGENT: Server sending the message over the async channel\n"); + LOG_D(PROTO_AGENT, "Server sending the message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); } /* After sending the message, wait for any replies; @@ -293,11 +293,11 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ du_thread=new_thread(proto_server_receive, &proto_server[mod_id]); - printf("PROTO_AGENT: server ends with thread_id %u\n",du_thread); + LOG_D(PROTO_AGENT, "server ends with thread_id %u\n",du_thread); return 0; error: - LOG_E(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT, "there was an error\n"); return 1; } @@ -326,21 +326,21 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ else { strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS); - printf("PROTO_AGENT: Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); + LOG_D(PROTO_AGENT, "Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); } if (cudu->cu[cu_id].cu_port != 0) in_port = cudu->cu[cu_id].cu_port; else { in_port = DEFAULT_PROTO_AGENT_PORT; - printf("PROTO_AGENT: Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); + LOG_D(PROTO_AGENT, "Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); } if(cudu->cu[cu_id].tcp == 1) { tcp = 1; link_type = strdup("TCP"); - printf("PROTO_AGENT: Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", + LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", proto_server[cu_id].enb_id, in_ip, in_port); @@ -349,7 +349,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ { udp = 1; link_type = strdup("UDP"); - printf("PROTO_AGENT: Starting PROTO agent client for module id %d on ipv4 %s, port %d over UDP\n", + LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over UDP\n", proto_server[cu_id].enb_id, in_ip, in_port); @@ -358,7 +358,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ { sctp = 1; link_type = strdup("SCTP"); - printf("PROTO_AGENT: Starting PROTO agent client for module id %d on ipv4 %s, port %d over SCTP\n", + LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over SCTP\n", proto_server[cu_id].enb_id, in_ip, in_port); @@ -367,7 +367,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ { tcp = 1; link_type = strdup("TCP"); - printf("PROTO_AGENT: Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", + LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", proto_server[cu_id].enb_id, in_ip, in_port); @@ -433,7 +433,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ if (msg!= NULL) { - printf("PROTO_AGENT: Client sending the ECHO_REQUEST message over the async channel\n"); + LOG_D(PROTO_AGENT, "Client sending the ECHO_REQUEST message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); } } @@ -442,11 +442,10 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ over the channel */ cu_thread[cu_id]=new_thread(proto_client_receive, (void *) &client_info[cu_id]); - return 0; error: - LOG_E(PROTO_AGENT,"there was an error %u\n", err_code); + LOG_E(PROTO_AGENT, "there was an error %u\n", err_code); return 1; } @@ -459,7 +458,7 @@ proto_agent_send_hello(void) int msg_flag = 0; - printf( "PDCP agent: Calling the HELLO packet constructor\n"); + //printf( "PDCP agent: Calling the HELLO packet constructor\n"); msg_flag = proto_agent_hello(proto_agent[TEST_MOD].enb_id, NULL, &init_msg); int msgsize = 0; @@ -468,7 +467,7 @@ proto_agent_send_hello(void) proto_agent_serialize_message(init_msg, &msg, &msgsize); } - printf("PROTO_AGENT: Agent sending the message over the async channel\n"); + LOG_D(PROTO_AGENT, "Agent sending the message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[TEST_MOD]); } @@ -478,7 +477,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { - //printf("PROTO_AGENT: PROTOPDCP: sending the data req over the async channel\n"); + //LOG_D(PROTO_AGENT, "PROTOPDCP: sending the data req over the async channel\n"); Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; @@ -492,7 +491,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct int ret; int err_code; - printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n"); + //printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n"); data_req_args *args = malloc(sizeof(data_req_args)); @@ -518,7 +517,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct msg = proto_agent_pack_message(init_msg, &msgsize); - printf("PROTO_AGENT: Sending the pdcp data_req message over the async channel\n"); + LOG_D(PROTO_AGENT, "Sending the pdcp data_req message over the async channel\n"); if (msg!=NULL) proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[mod_id]); @@ -531,7 +530,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct return; error: - LOG_E(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT, "PROTO_AGENT there was an error\n"); return; } @@ -541,7 +540,7 @@ void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { - //printf("PROTO_AGENT: PROTOPDCP: Sending Data Indication over the async channel\n"); + //LOG_D(PROTO_AGENT, "PROTOPDCP: Sending Data Indication over the async channel\n"); Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg = NULL; @@ -556,7 +555,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f int ret; int err_code; - printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n"); + //printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n"); data_req_args *args = malloc(sizeof(data_req_args)); @@ -581,7 +580,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f if (msg!=NULL) { - printf("PROTO_AGENT: Sending the pdcp data_ind message over the async channel\n"); + LOG_D(PROTO_AGENT, "Sending the pdcp data_ind message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) server_channel); } } @@ -592,7 +591,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f return; error: - LOG_E(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT, "there was an error\n"); return; } @@ -622,26 +621,26 @@ proto_server_receive(void) goto error; } - printf("PROTO_AGENT: Server side Received message with size %d and priority %d, calling message handle\n", size, priority); + LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority); msg=proto_agent_handle_message(d->enb_id, data, size); if (msg == NULL) { - printf("PROTO_AGENT: msg to send back is NULL\n"); + LOG_D(PROTO_AGENT, "msg to send back is NULL\n"); } else { ser_msg = proto_agent_pack_message(msg, &size); } - printf("PROTO_AGENT: Server sending the reply message over the async channel\n"); + LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); if (ser_msg != NULL){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - printf("PROTO_AGENT: sent message with size %d\n", size); + LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } } @@ -649,7 +648,7 @@ proto_server_receive(void) return NULL; error: - LOG_E(PROTO_AGENT,"server_receive_thread: error %d occured\n",err_code); + LOG_E(PROTO_AGENT, "server_receive_thread: error %d occured\n",err_code); return NULL; } @@ -662,7 +661,7 @@ proto_client_receive(void *args) mid_t recv_mod = recv->mod_id; uint8_t type = recv->type_id; - printf("PROTO_AGENT: \n\nrecv mod is %u\n\n",recv_mod); + LOG_D(PROTO_AGENT, "\n\nrecv mod is %u\n\n",recv_mod); //proto_agent_instance_t *d = &proto_agent[TEST_MOD]; void *data = NULL; int size; @@ -682,32 +681,32 @@ proto_client_receive(void *args) { //just wait } - printf("PROTO_AGENT: Will receive packets\n"); + LOG_D(PROTO_AGENT, "Will receive packets\n"); if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel[recv_mod])){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - printf("PROTO_AGENT: Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", size, priority, recv_mod); + LOG_D(PROTO_AGENT, "Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", size, priority, recv_mod); msg=proto_agent_handle_message(recv_mod, data, size); if (msg == NULL) { - printf("PROTO_AGENT: msg to send back is NULL\n"); + LOG_D(PROTO_AGENT, "msg to send back is NULL\n"); } else { ser_msg = proto_agent_pack_message(msg, &size); } - printf("PROTO_AGENT: Server sending the reply message over the async channel\n"); + LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); if (ser_msg != NULL){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel[recv_mod])){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - printf("PROTO_AGENT: sent message with size %d\n", size); + LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } } @@ -715,7 +714,7 @@ proto_client_receive(void *args) return NULL; error: - LOG_E(PROTO_AGENT,"client_receive_thread: error %d occured\n",err_code); + LOG_E(PROTO_AGENT, " client_receive_thread: error %d occured\n",err_code); return NULL; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 6486370b4f..8282c5fffa 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -190,7 +190,7 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, i return 0; error: - LOG_E(PROTO_AGENT, "an error occured\n"); + LOG_E(MAC, "an error occured\n"); return -1; } @@ -344,7 +344,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp free(data_req); if(*msg != NULL) free(*msg); - LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -363,7 +363,7 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { return 0; error: - LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -372,10 +372,11 @@ int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__Flexs Protocol__FspHeader *header; xid_t xid; rlc_op_status_t result = 0; - LOG_D(PROTO_AGENT, "handling the data_req_ack message\n"); + //printf("PROTO_AGENT: handling the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; result = data_ack->result; + //printf("PROTO_AGENT: ACK RESULT IS %u\n", result); ack_result = result; return 0; @@ -485,7 +486,7 @@ int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) { return 0; error: - LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -500,7 +501,7 @@ int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) { return 0; error: - LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -611,7 +612,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp free(data_ind); if(*msg != NULL) free(*msg); - LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -623,7 +624,7 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl xid_t xid; rlc_op_status_t result = 0; - LOG_I(PROTO_AGENT, "creating the data_ind_ack message\n"); + //printf("PROTO_AGENT: creating the data_ind_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg; @@ -696,18 +697,6 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl (*msg)->has_msg_dir = 1; (*msg)->data_req_ack = ack; - - //pdcp_control_plane_data_pdu_header* pdcp_header = (pdcp_control_plane_data_pdu_header*) pdcp_pdu_p; - -// int sequence_number = pdcp_get_sequence_number_of_pdu_with_long_sn((unsigned char*)pdcp_pdu_p); -// LOG_I(PROTO_AGENT,"RECEIVED DATA IND WITH SEQ NO %d\n", sequence_number); - - - - - - - return 0; error: @@ -736,7 +725,7 @@ int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) { return 0; error: - LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index dbf0d18e51..f1d0fbdb03 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -61,7 +61,7 @@ socket_link_t *new_link_server(int port) ret->socket_fd = -1; - printf("MAC create a new link server socket at port %d\n", port); + //printf("MAC create a new link server socket at port %d\n", port); socket_server = socket(AF_INET, SOCK_STREAM, 0); if (socket_server == -1) { @@ -103,9 +103,7 @@ socket_link_t *new_link_server(int port) goto error; } - close(socket_server); - - printf("MAC connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + //printf("MAC connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); return ret; error: @@ -180,7 +178,7 @@ socket_link_t *new_link_udp_server(int port){ } ret->socket_fd = -1; - LOG_I(PROTO_AGENT, "create a new udp link server socket at port %d\n", port); + //printf("PROTO_AGENT: create a new udp link server socket at port %d\n", port); //create a UDP socket if ((socket_server=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { @@ -206,7 +204,7 @@ error: close(socket_server); if (ret != NULL) close(ret->socket_fd); free(ret); - LOG_E(PROTO_AGENT, "ERROR in new_link_udp_server (see above), returning NULL\n"); + //printf("\n\n\nERROR PROTO_AGENT: ERROR in new_link_udp_server (see above), returning NULL\n"); return NULL; } @@ -307,7 +305,7 @@ error: close(listenSock); if (ret != NULL) close(ret->socket_fd); free(ret); - LOG_E(PROTO_AGENT, "ERROR in new_link_sctp_server (see above), returning NULL\n"); + LOG_E(MAC,"ERROR in new_link_sctp_server (see above), returning NULL\n"); return NULL; } @@ -336,9 +334,9 @@ socket_link_t *new_link_sctp_client(char *server, int port) bzero ((void *) &servaddr, sizeof (servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_port = htons (port); - LOG_E(PROTO_AGENT, "invalid IP address '%s', use a.b.c.d notation\n", server); + if (inet_aton(server, &servaddr.sin_addr) == 0) { - LOG_E(PROTO_AGENT, "invalid IP address '%s', use a.b.c.d notation\n", server); + LOG_E(MAC,"invalid IP address '%s', use a.b.c.d notation\n", server); goto error; } @@ -385,14 +383,14 @@ static int socket_udp_send(int socket_fd, void *buf, int size, char *peer_addr, while (size) { l = sendto(my_socket, s, size, 0, (struct sockaddr *) &si_other, slen); if (l == -1) goto error; - if (l == 0) { LOG_E(PROTO_AGENT, "%s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } + if (l == 0) { printf("\n\n\nERROR PROTO_AGENT: %s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } size -= l; s += l; } return 0; error: - LOG_E(PROTO_AGENT, "socket_udp_send: ERROR: %s\n", strerror(errno)); + LOG_E(MAC,"socket_udp_send: ERROR: %s\n", strerror(errno)); return -1; } @@ -541,8 +539,6 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uin int peer_port = 0; /* received the size first, maximum is 2^31 bytes */ - if (socket_receive(link->socket_fd, sizebuf, 4) == -1) - goto error; if ((proto_type == 0) || (proto_type == 2)) { if (socket_receive(link->socket_fd, sizebuf, 4) == -1) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index 95e006b705..a2f5d8e209 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -140,7 +140,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "10.64.93.26"; + mme_ip_address = ( { ipv4 = "10.64.93.19"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -164,7 +164,7 @@ DU = ( { DU_INTERFACE_NAME_FOR_F1U = "lo"; DU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1/16"; - DU_PORT_FOR_F1U = 2210; + DU_PORT_FOR_F1U = 22100; F1_U_DU_TRANSPORT_TYPE = "TCP"; } ); @@ -173,7 +173,7 @@ CU = ( { CU_INTERFACE_NAME_FOR_F1U = "lo"; CU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1"; //Address to search the DU - CU_PORT_FOR_F1U = 2210; + CU_PORT_FOR_F1U = 22100; F1_U_CU_TRANSPORT_TYPE = "TCP"; // One of TCP/UDP/SCTP DU_TYPE = "LTE"; }//, -- GitLab From da7c24b53994d28c51a3ce44239d0c16b3fcc7a8 Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Wed, 11 Apr 2018 20:45:54 +0300 Subject: [PATCH 014/308] =?UTF-8?q?Added=20definitions=20for=20F1AP=20ASN?= =?UTF-8?q?=20messages=20Added=20asn1c=20compiler=20compatible=20with=20th?= =?UTF-8?q?e=20F1AP=20definitions=20Compilation=20fails=20for=20the=20S1AP?= =?UTF-8?q?=20messages=20with=20"error:=20unknown=20type=20name=20?= =?UTF-8?q?=E2=80=98asn=5Fcomp=5Frval=5Ft=E2=80=99"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake_targets/CMakeLists.txt | 70 ++ cmake_targets/tools/build_helper | 3 + cmake_targets/tools/fix_asn1 | 2 +- .../ASN1/R15/38.473.Common-Definitions.asn | 32 + .../ASN1/R15/38.473.Constant-Definitions.asn | 179 +++ .../ASN1/R15/38.473.Container-Definitions.asn | 184 +++ .../ASN1/R15/38.473.Elementary-Procedures.asn | 258 ++++ ...38.473.Information-Element-Definitions.asn | 870 +++++++++++++ .../ASN1/R15/38.473.PDU-Definitions.asn | 1076 +++++++++++++++++ .../F1AP/MESSAGES/ASN1/R15/asn1_constants.h | 3 + openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py | 697 +++++++++++ 11 files changed, 3373 insertions(+), 1 deletion(-) create mode 100755 openair2/F1AP/MESSAGES/ASN1/R15/38.473.Common-Definitions.asn create mode 100755 openair2/F1AP/MESSAGES/ASN1/R15/38.473.Constant-Definitions.asn create mode 100755 openair2/F1AP/MESSAGES/ASN1/R15/38.473.Container-Definitions.asn create mode 100755 openair2/F1AP/MESSAGES/ASN1/R15/38.473.Elementary-Procedures.asn create mode 100755 openair2/F1AP/MESSAGES/ASN1/R15/38.473.Information-Element-Definitions.asn create mode 100755 openair2/F1AP/MESSAGES/ASN1/R15/38.473.PDU-Definitions.asn create mode 100644 openair2/F1AP/MESSAGES/ASN1/R15/asn1_constants.h create mode 100644 openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 7e6109b15b..2e6bd7df68 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -480,6 +480,76 @@ add_library(X2AP_LIB include_directories ("${X2AP_C_DIR}") include_directories ("${X2AP_DIR}") + + + +#F1AP +# Same limitation as described in RRC/S1AP: unknown generated file list +# so we generate it at cmake time +############## +add_list1_option(F1AP_VERSION R15 "F1AP Asn.1 grammar version" R14 R15) +set(F1AP_DIR ${OPENAIR2_DIR}/F1AP) +#if (${F1AP_VERSION} STREQUAL "R14") + set (ASN1RELDIR R15) +#endif(${F1AP_VERSION} STREQUAL "R14") +set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) +set(F1AP_ASN_FILES + ${F1AP_ASN_DIR}/38.473.Common-Definitions.asn + ${F1AP_ASN_DIR}/38.473.Constant-Definitions.asn + ${F1AP_ASN_DIR}/38.473.Information-Element-Definitions.asn + ${F1AP_ASN_DIR}/38.473.PDU-Definitions.asn + ${F1AP_ASN_DIR}/38.473.Elementary-Procedures.asn + ${F1AP_ASN_DIR}/38.473.Container-Definitions.asn + ) + +set(F1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR}) +execute_process(COMMAND ${asn1c_call} ${F1AP_C_DIR} ${F1AP_ASN_FILES} + RESULT_VARIABLE ret) +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) +execute_process(COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/38.473.PDU-Definitions.asn -o ${F1AP_C_DIR} + RESULT_VARIABLE ret) +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "asn1tostruct.py: error") +endif (NOT ${ret} STREQUAL 0) +execute_process(COMMAND ${fix_asn1c_call} ${F1AP_C_DIR} F1AP ${F1AP_VERSION} + RESULT_VARIABLE ret) +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${fix_asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) +file(GLOB F1AP_source ${F1AP_C_DIR}/*.c) + +#set(F1AP_OAI_generated +# ${X2AP_C_DIR}/x2ap_decoder.c +# ${X2AP_C_DIR}/x2ap_encoder.c +# ${X2AP_C_DIR}/x2ap_xer_print.c +# ${X2AP_C_DIR}/x2ap_ies_defs.h +# ) +file(GLOB f1ap_h ${F1AP_C_DIR}/*.h) +set(f1ap_h ${f1ap_h} ) + +##message("calling ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}") +#add_custom_command ( +# OUTPUT ${F1AP_OAI_generated} +# COMMAND ${asn1c_call} ${F1AP_C_DIR} ${F1AP_ASN_FILES} +# COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/38.473.PDU-Definitions.asn -o ${F1AP_C_DIR} +# COMMAND ${fix_asn1c_call} ${F1AP_C_DIR} F1AP ${F1AP_VERSION} +# DEPENDS ${F1AP_ASN_FILES} +# ) + +add_library(F1AP_LIB + ${F1AP_OAI_generated} + ${F1AP_source} +# ${F1AP_DIR}/f1ap_common.c + ) + +include_directories ("${F1AP_C_DIR}") +include_directories ("${F1AP_DIR}") + + + + # Hardware dependant options ################################### add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 3bb051f291..da4b34f26d 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -661,6 +661,9 @@ install_asn1c_from_source(){ $SUDO rm -rf /tmp/asn1c GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c cd /tmp/asn1c + git checkout master + git pull + test -f configure || autoreconf -iv ./configure make -j`nproc` $SUDO make install diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1 index fe819c2716..9d5d6a393e 100755 --- a/cmake_targets/tools/fix_asn1 +++ b/cmake_targets/tools/fix_asn1 @@ -23,7 +23,7 @@ reset_color="$(tput sgr0)" function error() { echo -e "$red_color"ERROR: "$@""$reset_color" - exit 1 + #exit 1 } function check_sha1() diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Common-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Common-Definitions.asn new file mode 100755 index 0000000000..12dfbd12ff --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Common-Definitions.asn @@ -0,0 +1,32 @@ +-- ************************************************************** +-- +-- Common definitions +-- +-- ************************************************************** + +F1AP-CommonDataTypes { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-CommonDataTypes (3) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +Criticality ::= ENUMERATED { reject, ignore, notify } + +Presence ::= ENUMERATED { optional, conditional, mandatory } + +PrivateIE-ID ::= CHOICE { + local INTEGER (0..65535), + global OBJECT IDENTIFIER +} + +ProcedureCode ::= INTEGER (0..255) + +ProtocolExtensionID ::= INTEGER (0..65535) + +ProtocolIE-ID ::= INTEGER (0..65535) + +TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessfull-outcome } + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Constant-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Constant-Definitions.asn new file mode 100755 index 0000000000..4ec60632f0 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Constant-Definitions.asn @@ -0,0 +1,179 @@ +-- ************************************************************** +-- +-- Constant definitions +-- +-- ************************************************************** + +F1AP-Constants { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Constants (4) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + ProcedureCode, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes; + + +-- ************************************************************** +-- +-- Elementary Procedures +-- +-- ************************************************************** + +id-Reset ProcedureCode ::= 0 +id-F1Setup ProcedureCode ::= 1 +id-ErrorIndication ProcedureCode ::= 2 +id-gNBDUConfigurationUpdate ProcedureCode ::= 3 +id-gNBCUConfigurationUpdate ProcedureCode ::= 4 +id-UEContextSetup ProcedureCode ::= 5 +id-UEContextRelease ProcedureCode ::= 6 +id-UEContextModification ProcedureCode ::= 7 +id-UEContextModificationRequired ProcedureCode ::= 8 +id-UEMobilityCommand ProcedureCode ::= 9 +id-UEContextReleaseRequest ProcedureCode ::= 10 +id-InitialULRRCMessageTransfer ProcedureCode ::= 11 +id-DLRRCMessageTransfer ProcedureCode ::= 12 +id-ULRRCMessageTransfer ProcedureCode ::= 13 +id-privateMessage ProcedureCode ::= 14 + +-- ************************************************************** +-- +-- Extension constants +-- +-- ************************************************************** + +maxPrivateIEs INTEGER ::= 65535 +maxProtocolExtensions INTEGER ::= 65535 +maxProtocolIEs INTEGER ::= 65535 +-- ************************************************************** +-- +-- Lists +-- +-- ************************************************************** + +maxNRARFCN INTEGER ::= 3266667 +maxnoofErrors INTEGER ::= 256 +maxnoofIndividualF1ConnectionsToReset INTEGER ::= 65536 +maxCellingNBDU INTEGER ::= 512 +maxnoofSCells INTEGER ::= 64 +maxnoofSRBs INTEGER ::= 8 +maxnoofDRBs INTEGER ::= 64 +maxnoofULTunnels INTEGER ::= 2 +maxnoofDLTunnels INTEGER ::= 2 +maxnoofBPLMNs INTEGER ::= 6 +maxnoofCandidateSpCells INTEGER ::= 64 +maxnoofPotentialSpCells INTEGER ::= 64 + +-- ************************************************************** +-- +-- IEs +-- +-- ************************************************************** + +id-Cause ProtocolIE-ID ::= 0 +id-Cells-Failed-to-be-Activated-List ProtocolIE-ID ::= 1 +id-Cells-Failed-to-be-Activated-List-Item ProtocolIE-ID ::= 2 +id-Cells-to-be-Activated-List ProtocolIE-ID ::= 3 +id-Cells-to-be-Activated-List-Item ProtocolIE-ID ::= 4 +id-Cells-to-be-Deactivated-List ProtocolIE-ID ::= 5 +id-Cells-to-be-Deactivated-List-Item ProtocolIE-ID ::= 6 +id-CriticalityDiagnostics ProtocolIE-ID ::= 7 +id-CUtoDURRCInformation ProtocolIE-ID ::= 9 +id-DRBs-FailedToBeModifiedConf-Item ProtocolIE-ID ::= 10 +id-DRBs-FailedToBeModifiedConf-List ProtocolIE-ID ::= 11 +id-DRBs-FailedToBeModified-Item ProtocolIE-ID ::= 12 +id-DRBs-FailedToBeModified-List ProtocolIE-ID ::= 13 +id-DRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 14 +id-DRBs-FailedToBeSetup-List ProtocolIE-ID ::= 15 +id-DRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 16 +id-DRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 17 +id-DRBs-ModifiedConf-Item ProtocolIE-ID ::= 18 +id-DRBs-ModifiedConf-List ProtocolIE-ID ::= 19 +id-DRBs-Modified-Item ProtocolIE-ID ::= 20 +id-DRBs-Modified-List ProtocolIE-ID ::= 21 +id-DRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 22 +id-DRBs-Required-ToBeModified-List ProtocolIE-ID ::= 23 +id-DRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 24 +id-DRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 25 +id-DRBs-Setup-Item ProtocolIE-ID ::= 26 +id-DRBs-Setup-List ProtocolIE-ID ::= 27 +id-DRBs-SetupMod-Item ProtocolIE-ID ::= 28 +id-DRBs-SetupMod-List ProtocolIE-ID ::= 29 +id-DRBs-ToBeModified-Item ProtocolIE-ID ::= 30 +id-DRBs-ToBeModified-List ProtocolIE-ID ::= 31 +id-DRBs-ToBeReleased-Item ProtocolIE-ID ::= 32 +id-DRBs-ToBeReleased-List ProtocolIE-ID ::= 33 +id-DRBs-ToBeSetup-Item ProtocolIE-ID ::= 34 +id-DRBs-ToBeSetup-List ProtocolIE-ID ::= 35 +id-DRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 36 +id-DRBs-ToBeSetupMod-List ProtocolIE-ID ::= 37 +id-DRXCycle ProtocolIE-ID ::= 38 +id-DUtoCURRCInformation ProtocolIE-ID ::= 39 +id-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 40 +id-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 41 +id-gNB-DU-ID ProtocolIE-ID ::= 42 +id-GNB-DU-Served-Cells-Item ProtocolIE-ID ::= 43 +id-gNB-DU-Served-Cells-List ProtocolIE-ID ::= 44 +id-gNB-DU-Name ProtocolIE-ID ::= 45 +id-NRCellID ProtocolIE-ID ::= 46 +id-oldgNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 47 +id-ResetType ProtocolIE-ID ::= 48 +id-ResourceCoordinationTransferContainer ProtocolIE-ID ::= 49 +id-RRCContainer ProtocolIE-ID ::= 50 +id-SCell-ToBeRemoved-Item ProtocolIE-ID ::= 51 +id-SCell-ToBeRemoved-List ProtocolIE-ID ::= 52 +id-SCell-ToBeSetup-Item ProtocolIE-ID ::= 53 +id-SCell-ToBeSetup-List ProtocolIE-ID ::= 54 +id-SCell-ToBeSetupMod-Item ProtocolIE-ID ::= 55 +id-SCell-ToBeSetupMod-List ProtocolIE-ID ::= 56 +id-Served-Cells-To-Add-Item ProtocolIE-ID ::= 57 +id-Served-Cells-To-Add-List ProtocolIE-ID ::= 58 +id-Served-Cells-To-Delete-Item ProtocolIE-ID ::= 59 +id-Served-Cells-To-Delete-List ProtocolIE-ID ::= 60 +id-Served-Cells-To-Modify-Item ProtocolIE-ID ::= 61 +id-Served-Cells-To-Modify-List ProtocolIE-ID ::= 62 +id-SpCell-ID ProtocolIE-ID ::= 63 +id-SRBID ProtocolIE-ID ::= 64 +id-SRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 65 +id-SRBs-FailedToBeSetup-List ProtocolIE-ID ::= 66 +id-SRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 67 +id-SRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 68 +id-SRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 69 +id-SRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 70 +id-SRBs-ToBeReleased-Item ProtocolIE-ID ::= 71 +id-SRBs-ToBeReleased-List ProtocolIE-ID ::= 72 +id-SRBs-ToBeSetup-Item ProtocolIE-ID ::= 73 +id-SRBs-ToBeSetup-List ProtocolIE-ID ::= 74 +id-SRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 75 +id-SRBs-ToBeSetupMod-List ProtocolIE-ID ::= 76 +id-TimeToWait ProtocolIE-ID ::= 75 +id-TransactionID ProtocolIE-ID ::= 78 +id-TransmissionStopIndicator ProtocolIE-ID ::= 79 +id-UE-associatedLogicalF1-ConnectionItem ProtocolIE-ID ::= 80 +id-UE-associatedLogicalF1-ConnectionListResAck ProtocolIE-ID ::= 81 +id-gNB-CU-Name ProtocolIE-ID ::= 82 +id-SCell-FailedtoSetup-List ProtocolIE-ID ::= 83 +id-SCell-FailedtoSetup-Item ProtocolIE-ID ::= 84 +id-SCell-FailedtoSetupMod-List ProtocolIE-ID ::= 85 +id-SCell-FailedtoSetupMod-Item ProtocolIE-ID ::= 86 +id-RRCRconfigurationCompleteIndicator ProtocolIE-ID ::= 87 +id-Active-Cells-Item ProtocolIE-ID ::= 88 +id-Active-Cells-List ProtocolIE-ID ::= 89 +id-Candidate-SpCell-List ProtocolIE-ID ::= 90 +id-Candidate-SpCell-Item ProtocolIE-ID ::= 91 +id-Potential-SpCell-List ProtocolIE-ID ::= 92 +id-Potential-SpCell-Item ProtocolIE-ID ::= 93 + + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Container-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Container-Definitions.asn new file mode 100755 index 0000000000..ed5dfba961 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Container-Definitions.asn @@ -0,0 +1,184 @@ +-- ************************************************************** +-- +-- Container definitions +-- +-- ************************************************************** + +F1AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + Presence, + PrivateIE-ID, + ProtocolExtensionID, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs + +FROM F1AP-Constants; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +F1AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolExtensionID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +F1AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {F1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-SingleContainer {F1AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {F1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality F1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality F1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue F1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality F1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue F1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality F1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue F1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {F1AP-PRIVATE-IES : IEsSetParam } ::= + SEQUENCE (SIZE (1.. maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {F1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality F1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Elementary-Procedures.asn b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Elementary-Procedures.asn new file mode 100755 index 0000000000..99a67d89da --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Elementary-Procedures.asn @@ -0,0 +1,258 @@ +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +F1AP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Descriptions (0)} + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureCode + +FROM F1AP-CommonDataTypes + Reset, + ResetAcknowledge, + F1SetupRequest, + F1SetupResponse, + F1SetupFailure, + GNBDUConfigurationUpdate, + GNBDUConfigurationUpdateAcknowledge, + GNBDUConfigurationUpdateFailure, + GNBCUConfigurationUpdate, + GNBCUConfigurationUpdateAcknowledge, + GNBCUConfigurationUpdateFailure, + UEContextSetupRequest, + UEContextSetupResponse, + UEContextSetupFailure, + UEContextReleaseCommand, + UEContextReleaseComplete, + UEContextModificationRequest, + UEContextModificationResponse, + UEContextModificationFailure, + UEContextModificationRequired, + UEContextModificationConfirm, + ErrorIndication, + UEContextReleaseRequest, + DLRRCMessageTransfer, + ULRRCMessageTransfer, + PrivateMessage + +FROM F1AP-PDU-Contents + id-Reset, + id-F1Setup, + id-gNBDUConfigurationUpdate, + id-gNBCUConfigurationUpdate, + id-UEContextSetup, + id-UEContextRelease, + id-UEContextModification, + id-UEContextModificationRequired, + id-ErrorIndication, + id-UEContextReleaseRequest, + id-DLRRCMessageTransfer, + id-ULRRCMessageTransfer, + id-privateMessage + + +FROM F1AP-Constants; + + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &procedureCode ProcedureCode UNIQUE, + &criticality Criticality DEFAULT ignore +} +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + PROCEDURE CODE &procedureCode + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +F1AP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + successfulOutcome SuccessfulOutcome, + unsuccessfulOutcome UnsuccessfulOutcome, + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURES F1AP-ELEMENTARY-PROCEDURE ::= { + F1AP-ELEMENTARY-PROCEDURES-CLASS-1 | + F1AP-ELEMENTARY-PROCEDURES-CLASS-2, + ... +} + + +F1AP-ELEMENTARY-PROCEDURES-CLASS-1 F1AP-ELEMENTARY-PROCEDURE ::= { + reset | + f1Setup | + gNBDUConfigurationUpdate | + gNBCUConfigurationUpdate | + uEContextSetup | + uEContextRelease | + uEContextModification | + uEContextModificationRequired , + ...} + + F1AP-ELEMENTARY-PROCEDURES-CLASS-2 F1AP-ELEMENTARY-PROCEDURE ::= { + errorIndication | + uEContextReleaseRequest | + dLRRCMessageTransfer | + uLRRCMessageTransfer | + privateMessage , + ... +} +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +reset F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Reset + SUCCESSFUL OUTCOME ResetAcknowledge + PROCEDURE CODE id-Reset + CRITICALITY reject +} + +f1Setup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1SetupRequest + SUCCESSFUL OUTCOME F1SetupResponse + UNSUCCESSFUL OUTCOME F1SetupFailure + PROCEDURE CODE id-F1Setup + CRITICALITY reject +} + +gNBDUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUConfigurationUpdate + SUCCESSFUL OUTCOME GNBDUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBDUConfigurationUpdateFailure + PROCEDURE CODE id-gNBDUConfigurationUpdate + CRITICALITY reject +} + +gNBCUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBCUConfigurationUpdate + SUCCESSFUL OUTCOME GNBCUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBCUConfigurationUpdateFailure + PROCEDURE CODE id-gNBCUConfigurationUpdate + CRITICALITY reject +} + +uEContextSetup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextSetupRequest + SUCCESSFUL OUTCOME UEContextSetupResponse + UNSUCCESSFUL OUTCOME UEContextSetupFailure + PROCEDURE CODE id-UEContextSetup + CRITICALITY reject +} + +uEContextRelease F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseCommand + SUCCESSFUL OUTCOME UEContextReleaseComplete + PROCEDURE CODE id-UEContextRelease + CRITICALITY reject +} + +uEContextModification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequest + SUCCESSFUL OUTCOME UEContextModificationResponse + UNSUCCESSFUL OUTCOME UEContextModificationFailure + PROCEDURE CODE id-UEContextModification + CRITICALITY reject +} + +uEContextModificationRequired F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequired + SUCCESSFUL OUTCOME UEContextModificationConfirm + PROCEDURE CODE id-UEContextModificationRequired + CRITICALITY reject +} + + +errorIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + PROCEDURE CODE id-ErrorIndication + CRITICALITY ignore +} + +uEContextReleaseRequest F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseRequest + PROCEDURE CODE id-UEContextReleaseRequest + CRITICALITY ignore +} + + +dLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DLRRCMessageTransfer + PROCEDURE CODE id-DLRRCMessageTransfer + CRITICALITY ignore +} + +uLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ULRRCMessageTransfer + PROCEDURE CODE id-ULRRCMessageTransfer + CRITICALITY ignore +} + + +privateMessage F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + PROCEDURE CODE id-privateMessage + CRITICALITY ignore +} + + + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Information-Element-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Information-Element-Definitions.asn new file mode 100755 index 0000000000..672407d851 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Information-Element-Definitions.asn @@ -0,0 +1,870 @@ +-- ************************************************************** +-- +-- Information Element Definitions +-- +-- ************************************************************** + +F1AP-IEs { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-IEs (2) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + maxNRARFCN, + maxnoofErrors, + maxnoofBPLMNs, + maxnoofDLTunnels, + maxnoofULTunnels + +FROM F1AP-Constants + + Criticality, + ProcedureCode, + ProtocolIE-ID, + TriggeringMessage + +FROM F1AP-CommonDataTypes + + ProtocolExtensionContainer{}, + F1AP-PROTOCOL-EXTENSION, + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + +-- A + +Active-Cells-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Active-Cells-ItemExtIEs } } OPTIONAL, + ... +} + +Active-Cells-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL, + ... +} + +AllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +-- B + +BitRate ::= INTEGER (0..4000000000000,...) + +BroadcastPLMNs-Item ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF PLMN-Identity + +-- C + +Candidate-SpCell-Item ::= SEQUENCE { + candidate-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Candidate-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Candidate-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cause ::= CHOICE { + radioNetwork CauseRadioNetwork, + transport CauseTransport, + protocol CauseProtocol, + misc CauseMisc, + ... +} + +CauseMisc ::= ENUMERATED { + control-processing-overload, + not-enough-user-plane-processing-resources, + hardware-failure, + om-intervention, + unspecified, +... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + abstract-syntax-error-falsely-constructed-message, + unspecified, + ... +} + +CauseRadioNetwork ::= ENUMERATED { + unspecified, + rlc-failure, + unknown-or-already-allocated-gnb-cu-ue-f1ap-id, + unknown-or-already-allocated-gnd-du-ue-f1ap-id, + unknown-or-inconsistent-pair-of-ue-f1ap-id, + interaction-with-other-procedure, + not-supported-qci-Value, + action-desirable-for-radio-reasons, + no-radio-resources-available, + procedure-cancelled, + normal-release, + ... +} + +CauseTransport ::= ENUMERATED { + unspecified, + transport-resource-unavailable, + ... +} + + + +CellGroupConfig ::= OCTET STRING + +Cells-Failed-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { Cells-Failed-to-be-Activated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Failed-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Activated-List-ItemExtIEs} } OPTIONAL, + ... +} + +Cells-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Deactivated-List-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Deactivated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-to-be-Deactivated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics ::= SEQUENCE { + procedureCode ProcedureCode OPTIONAL, + triggeringMessage TriggeringMessage OPTIONAL, + procedureCriticality Criticality OPTIONAL, + transactionID TransactionID OPTIONAL, + iEsCriticalityDiagnostics CriticalityDiagnostics-IE-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1.. maxnoofErrors)) OF CriticalityDiagnostics-IE-Item + +CriticalityDiagnostics-IE-Item ::= SEQUENCE { + iECriticality Criticality, + iE-ID ProtocolIE-ID, + typeOfError TypeOfError, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-IE-Item-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-IE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CUtoDURRCInformation ::= SEQUENCE { + cG-ConfigInfo CG-ConfigInfo OPTIONAL, + uE-CapabilityRAT-ContainerList UE-CapabilityRAT-ContainerList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CUtoDURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +CUtoDURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- D + +DLTunnels-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDLTunnels)) OF DLTunnels-ToBeSetup-Item + +DLTunnels-ToBeSetup-Item ::= SEQUENCE { + dL-GTP-Tunnel-EndPoint GTPTunnelEndpoint , + iE-Extensions ProtocolExtensionContainer { { DLTunnels-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DLTunnels-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBID ::= INTEGER (1..32, ...) + +DRBs-FailedToBeModified-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-FailedToBeModifiedConf-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeModifiedConf-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-FailedToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Modified-Item ::= SEQUENCE { + dRBID DRBID, + dLTunnels-ToBeSetup-List DLTunnels-ToBeSetup-List, + iE-Extensions ProtocolExtensionContainer { { DRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ModifiedConf-Item ::= SEQUENCE { + dRBID DRBID, + uLTunnels-ToBeSetup-List ULTunnels-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-ModifiedConf-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Required-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + dLTunnels-ToBeSetup-List DLTunnels-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Required-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Setup-Item ::= SEQUENCE { + dRBID DRBID, + dLTunnels-ToBeSetup-List DLTunnels-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-SetupMod-Item ::= SEQUENCE { + dRBID DRBID, + dLTunnels-ToBeSetup-List DLTunnels-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + eUTRANQoS EUTRANQoS OPTIONAL, + uLTunnels-ToBeSetup-List ULTunnels-ToBeSetup-List , + uLConfiguration ULConfiguration OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + eUTRANQoS EUTRANQoS OPTIONAL, + uLTunnels-ToBeSetup-List ULTunnels-ToBeSetup-List , + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-ToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID, + eUTRANQoS EUTRANQoS OPTIONAL, + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + uLTunnels-ToBeSetup-List ULTunnels-ToBeSetup-List, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRXCycle ::= SEQUENCE { + longDRXCycleLength LongDRXCycleLength, + shortDRXCycleLength ShortDRXCycleLength OPTIONAL, + shortDRXCycleTimer ShortDRXCycleTimer OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRXCycle-ExtIEs} } OPTIONAL, + ... +} + +DRXCycle-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +DUtoCURRCInformation ::= SEQUENCE { + cellGroupConfig CellGroupConfig, + gapOffset GapOffset OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DUtoCURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +DUtoCURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +-- E + +EUTRANQoS ::= SEQUENCE { + qCI QCI, + allocationAndRetentionPriority AllocationAndRetentionPriority, + gbrQosInformation GBR-QosInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { EUTRANQoS-ExtIEs} } OPTIONAL, + ... +} + +EUTRANQoS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Extended-TAC ::= OCTET STRING (SIZE(3)) + +-- F + +FDD-Info ::= SEQUENCE { + uL-NRARFCN NRARFCN, + dL-NRARFCN NRARFCN, + uL-Transmission-Bandwidth Transmission-Bandwidth, + dL-Transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- G + +GapOffset ::= OCTET STRING + +GBR-QosInformation ::= SEQUENCE { + e-RAB-MaximumBitrateDL BitRate, + e-RAB-MaximumBitrateUL BitRate, + e-RAB-GuaranteedBitrateDL BitRate, + e-RAB-GuaranteedBitrateUL BitRate, + iE-Extensions ProtocolExtensionContainer { { GBR-QosInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + + +GNB-CU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-ID ::= INTEGER (0..68719476735) + +GNB-CU-Name ::= PrintableString(SIZE(1..150,...)) + +GNB-DU-Name ::= PrintableString(SIZE(1..150,...)) + +GNB-DU-Served-Cells-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Served-Cells-ItemExtIEs} } OPTIONAL, + ... +} + +GNB-DU-Served-Cells-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-System-Information ::= SEQUENCE { + mIB-message MIB-message, + sIB1-message SIB1-message, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-System-Information-ExtIEs } } OPTIONAL, + ... +} + +GNB-DU-System-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GTP-TEID ::= OCTET STRING (SIZE (4)) + +GTPTunnelEndpoint ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { GTPTunnelEndpoint-ExtIEs} } OPTIONAL, + ... +} + + +GTPTunnelEndpoint-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- H + +-- I + +-- J + +-- K + +-- L + +LongDRXCycleLength ::= ENUMERATED +{ms10, ms20, ms32, ms40, ms60, ms64, ms70, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ms1024, ms1280, ms2048, ms2560, ms5120, ms10240, ...} + +-- M + +MIB-message ::= OCTET STRING + +-- N + +NRARFCN ::= INTEGER (0..maxNRARFCN) + +NRCGI ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + nRCellIdentity NRCellIdentity, + iE-Extensions ProtocolExtensionContainer { {NRCGI-ExtIEs} } OPTIONAL, + ... +} + +NRCGI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-Mode-Info ::= CHOICE { + fDD FDD-Info, + tDD TDD-Info, + ... +} + +NRCellIdentity ::= BIT STRING (SIZE(36)) + +NRNRB ::= ENUMERATED { nrb11, nrb18, nrb24, nrb25, nrb31, nrb32, nrb38, nrb51, nrb52, nrb65, nrb66, nrb78, nrb79, nrb93, nrb106, nrb107, nrb121, nrb132, nrb133, nrb135, nrb160, nrb162, nrb189, nrb216, nrb217, nrb245, nrb264, nrb270, nrb273, ...} + +NRPCI ::= INTEGER(0..1007) + +NRSCS ::= ENUMERATED { scs15, scs30, scs60, scs120, ...} + +-- O + +-- P + +PLMN-Identity ::= OCTET STRING (SIZE(3)) + +Pre-emptionCapability ::= ENUMERATED { + shall-not-trigger-pre-emption, + may-trigger-pre-emption +} + +Pre-emptionVulnerability ::= ENUMERATED { + not-pre-emptable, + pre-emptable +} + +PriorityLevel ::= INTEGER { spare (0), highest (1), lowest (14), no-priority (15) } (0..15) + +Potential-SpCell-Item ::= SEQUENCE { + potential-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Potential-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Potential-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- Q + +QCI ::= INTEGER (0..255) + +-- R + +ResourceCoordinationTransferContainer ::= OCTET STRING + +RLCMode ::= ENUMERATED { + rlc-am, + rlc-um +} + +RRCContainer ::= OCTET STRING + +RRCRconfigurationCompleteIndicator ::= ENUMERATED {true, ...} + +-- S + +SCell-FailedtoSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-FailedtoSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeRemoved-Item ::= SEQUENCE { + sCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeRemoved-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeRemoved-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCellIndex ::=INTEGER (0..31, ...) + +CG-ConfigInfo ::= OCTET STRING + +Served-Cell-Information ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI, + extended-TAC Extended-TAC, + broadcastPLMNs BroadcastPLMNs-Item, + nR-Mode-Info NR-Mode-Info, + sUL-Information SUL-Information OPTIONAL, + measurementTimingConfiguration OCTET STRING, + iE-Extensions ProtocolExtensionContainer { {Served-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Add-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Add-ItemExtIEs} } OPTIONAL, + ... +} + +Served-Cells-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Delete-Item ::= SEQUENCE { + oldNRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Delete-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Delete-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Modify-Item ::= SEQUENCE { + oldNRCGI NRCGI , + served-Cell-Information Served-Cell-Information , + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Modify-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Modify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ShortDRXCycleLength ::= ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ...} + +ShortDRXCycleTimer ::= INTEGER (1..16) + +SIB1-message ::= OCTET STRING + +SRBID ::= INTEGER (1..3, ...) + +SRBs-FailedToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SUL-Information ::= SEQUENCE { + sUL-NRARFCN NRARFCN, + sUL-transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { { SUL-InformationExtIEs} } OPTIONAL, + ... +} + +SUL-InformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- T + +TDD-Info ::= SEQUENCE { + nRARFCN NRARFCN, + transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeToWait ::= ENUMERATED {v1s, v2s, v5s, v10s, v20s, v60s, ...} + +TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...)) + +TransactionID ::= INTEGER (0..255, ...) + +Transmission-Bandwidth ::= SEQUENCE { + nRSCS NRSCS, + nRNRB NRNRB, + iE-Extensions ProtocolExtensionContainer { { Transmission-Bandwidth-ExtIEs} } OPTIONAL, + ... +} + +Transmission-Bandwidth-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionStopIndicator ::= ENUMERATED {true, ...} + +TypeOfError ::= ENUMERATED { + not-understood, + missing, + ... +} + +-- U + +UE-associatedLogicalF1-ConnectionItem ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID OPTIONAL, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UE-associatedLogicalF1-ConnectionItemExtIEs} } OPTIONAL, + ... +} + +UE-associatedLogicalF1-ConnectionItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-CapabilityRAT-ContainerList::= OCTET STRING + +ULConfiguration ::= SEQUENCE { + uLUEConfiguration ULUEConfiguration, + iE-Extensions ProtocolExtensionContainer { { ULConfigurationExtIEs } } OPTIONAL, + ... +} +ULConfigurationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULUEConfiguration ::= ENUMERATED {no-data, shared, only, ...} + + +ULTunnels-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofULTunnels)) OF ULTunnels-ToBeSetup-Item + +ULTunnels-ToBeSetup-Item ::=SEQUENCE { + uL-GTP-Tunnel-EndPoint GTPTunnelEndpoint, + iE-Extensions ProtocolExtensionContainer { { ULTunnels-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +ULTunnels-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- V + +-- W + +-- X + +-- Y + +-- Z + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.PDU-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.PDU-Definitions.asn new file mode 100755 index 0000000000..813c79ac54 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15/38.473.PDU-Definitions.asn @@ -0,0 +1,1076 @@ +-- ************************************************************** +-- +-- PDU definitions for F1AP. +-- +-- ************************************************************** + +F1AP-PDU-Contents { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Contents (1) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Active-Cells-Item, + Candidate-SpCell-Item, + Cause, + Cells-Failed-to-be-Activated-List-Item, + Cells-to-be-Activated-List-Item, + Cells-to-be-Deactivated-List-Item, + CriticalityDiagnostics, + CUtoDURRCInformation, + DRBID, + DRBs-FailedToBeModifiedConf-Item, + DRBs-FailedToBeModified-Item, + DRBs-FailedToBeSetup-Item, + DRBs-FailedToBeSetupMod-Item, + DRBs-ModifiedConf-Item, + DRBs-Modified-Item, + DRBs-Required-ToBeModified-Item, + DRBs-Required-ToBeReleased-Item, + DRBs-Setup-Item, + DRBs-SetupMod-Item, + DRBs-ToBeModified-Item, + DRBs-ToBeReleased-Item, + DRBs-ToBeSetup-Item, + DRBs-ToBeSetupMod-Item, + DRXCycle, + DUtoCURRCInformation, + EUTRANQoS, + GNB-CU-UE-F1AP-ID, + GNB-DU-UE-F1AP-ID, + GNB-DU-ID, + GNB-DU-Served-Cells-Item, + GNB-DU-System-Information, + GNB-CU-Name, + GNB-DU-Name, + GTPTunnelEndpoint, + NRCGI, + NRPCI, + Potential-SpCell-Item, + ResourceCoordinationTransferContainer, + RRCContainer, + RRCRconfigurationCompleteIndicator, + SCellIndex, + SCell-ToBeRemoved-Item, + SCell-ToBeSetup-Item, + SCell-ToBeSetupMod-Item, + SCell-FailedtoSetup-Item, + SCell-FailedtoSetupMod-Item, + Served-Cell-Information, + Served-Cells-To-Add-Item, + Served-Cells-To-Delete-Item, + Served-Cells-To-Modify-Item, + SRBID, + SRBs-FailedToBeSetup-Item, + SRBs-FailedToBeSetupMod-Item, + SRBs-Required-ToBeReleased-Item, + SRBs-ToBeReleased-Item, + SRBs-ToBeSetup-Item, + SRBs-ToBeSetupMod-Item, + TimeToWait, + TransactionID, + TransmissionStopIndicator, + UE-associatedLogicalF1-ConnectionItem, + ULTunnels-ToBeSetup-Item + +FROM F1AP-IEs + + PrivateIE-Container{}, + ProtocolExtensionContainer{}, + ProtocolIE-Container{}, + ProtocolIE-ContainerPair{}, + ProtocolIE-SingleContainer{}, + F1AP-PRIVATE-IES, + F1AP-PROTOCOL-EXTENSION, + F1AP-PROTOCOL-IES, + F1AP-PROTOCOL-IES-PAIR + +FROM F1AP-Containers + + id-Active-Cells-Item, + id-Active-Cells-List, + id-Candidate-SpCell-Item, + id-Candidate-SpCell-List, + id-Cause, + id-Cells-Failed-to-be-Activated-List, + id-Cells-Failed-to-be-Activated-List-Item, + id-Cells-to-be-Activated-List, + id-Cells-to-be-Activated-List-Item, + id-Cells-to-be-Deactivated-List, + id-Cells-to-be-Deactivated-List-Item, + id-CriticalityDiagnostics, + id-CUtoDURRCInformation, + id-DRBs-FailedToBeModifiedConf-Item, + id-DRBs-FailedToBeModifiedConf-List, + id-DRBs-FailedToBeModified-Item, + id-DRBs-FailedToBeModified-List, + id-DRBs-FailedToBeSetup-Item, + id-DRBs-FailedToBeSetup-List, + id-DRBs-FailedToBeSetupMod-Item, + id-DRBs-FailedToBeSetupMod-List, + id-DRBs-ModifiedConf-Item, + id-DRBs-ModifiedConf-List, + id-DRBs-Modified-Item, + id-DRBs-Modified-List, + id-DRBs-Required-ToBeModified-Item, + id-DRBs-Required-ToBeModified-List, + id-DRBs-Required-ToBeReleased-Item, + id-DRBs-Required-ToBeReleased-List, + id-DRBs-Setup-Item, + id-DRBs-Setup-List, + id-DRBs-SetupMod-Item, + id-DRBs-SetupMod-List, + id-DRBs-ToBeModified-Item, + id-DRBs-ToBeModified-List, + id-DRBs-ToBeReleased-Item, + id-DRBs-ToBeReleased-List, + id-DRBs-ToBeSetup-Item, + id-DRBs-ToBeSetup-List, + id-DRBs-ToBeSetupMod-Item, + id-DRBs-ToBeSetupMod-List, + id-DRXCycle, + id-DUtoCURRCInformation, + id-gNB-CU-UE-F1AP-ID, + id-gNB-DU-UE-F1AP-ID, + id-gNB-DU-ID, + id-GNB-DU-Served-Cells-Item, + id-gNB-DU-Served-Cells-List, + id-gNB-CU-Name, + id-gNB-DU-Name, + id-oldgNB-DU-UE-F1AP-ID, + id-Potential-SpCell-Item, + id-Potential-SpCell-List, + id-ResetType, + id-ResourceCoordinationTransferContainer, + id-RRCContainer, + id-RRCRconfigurationCompleteIndicator, + id-SCell-FailedtoSetup-List, + id-SCell-FailedtoSetup-Item, + id-SCell-FailedtoSetupMod-List, + id-SCell-FailedtoSetupMod-Item, + id-SCell-ToBeRemoved-Item, + id-SCell-ToBeRemoved-List, + id-SCell-ToBeSetup-Item, + id-SCell-ToBeSetup-List, + id-SCell-ToBeSetupMod-Item, + id-SCell-ToBeSetupMod-List, + id-Served-Cells-To-Add-Item, + id-Served-Cells-To-Add-List, + id-Served-Cells-To-Delete-Item, + id-Served-Cells-To-Delete-List, + id-Served-Cells-To-Modify-Item, + id-Served-Cells-To-Modify-List, + id-SpCell-ID, + id-SRBID, + id-SRBs-FailedToBeSetup-Item, + id-SRBs-FailedToBeSetup-List, + id-SRBs-FailedToBeSetupMod-Item, + id-SRBs-FailedToBeSetupMod-List, + id-SRBs-Required-ToBeReleased-Item, + id-SRBs-Required-ToBeReleased-List, + id-SRBs-ToBeReleased-Item, + id-SRBs-ToBeReleased-List, + id-SRBs-ToBeSetup-Item, + id-SRBs-ToBeSetup-List, + id-SRBs-ToBeSetupMod-Item, + id-SRBs-ToBeSetupMod-List, + id-TimeToWait, + id-TransactionID, + id-TransmissionStopIndicator, + id-UE-associatedLogicalF1-ConnectionItem, + id-UE-associatedLogicalF1-ConnectionListResAck, + maxCellingNBDU, + maxnoofCandidateSpCells, + maxnoofDRBs, + maxnoofErrors, + maxnoofIndividualF1ConnectionsToReset, + maxnoofPotentialSpCells, + maxnoofSCells, + maxnoofSRBs + +FROM F1AP-Constants; + + +-- ************************************************************** +-- +-- RESET ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Reset +-- +-- ************************************************************** + +Reset ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetIEs} }, + ... +} + +ResetIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-ResetType CRITICALITY reject TYPE ResetType PRESENCE mandatory }, + ... +} + +ResetType ::= CHOICE { + f1-Interface ResetAll, + partOfF1-Interface UE-associatedLogicalF1-ConnectionListRes, + ... +} + + +ResetAll ::= ENUMERATED { + reset-all, + ... +} + +UE-associatedLogicalF1-ConnectionListRes ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemRes } } + +UE-associatedLogicalF1-ConnectionItemRes F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY reject TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory}, + ... +} + + + + +-- ************************************************************** +-- +-- Reset Acknowledge +-- +-- ************************************************************** + +ResetAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetAcknowledgeIEs} }, + ... +} + +ResetAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UE-associatedLogicalF1-ConnectionListResAck CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionListResAck PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +UE-associatedLogicalF1-ConnectionListResAck ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemResAck } } + +UE-associatedLogicalF1-ConnectionItemResAck F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- ERROR INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Error Indication +-- +-- ************************************************************** + +ErrorIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ErrorIndicationIEs}}, + ... +} + +ErrorIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- F1 SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Setup Request +-- +-- ************************************************************** + +F1SetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupRequestIEs} }, + ... +} + +F1SetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE mandatory }| + { ID id-gNB-DU-Name CRITICALITY ignore TYPE GNB-DU-Name PRESENCE optional }| + { ID id-gNB-DU-Served-Cells-List CRITICALITY reject TYPE GNB-DU-Served-Cells-List PRESENCE mandatory }, + ... +} + + +GNB-DU-Served-Cells-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { GNB-DU-Served-Cells-ItemIEs } } + +GNB-DU-Served-Cells-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-Served-Cells-Item CRITICALITY reject TYPE GNB-DU-Served-Cells-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- F1 Setup Response +-- +-- ************************************************************** + +F1SetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupResponseIEs} }, + ... +} + + +F1SetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-CU-Name CRITICALITY ignore TYPE GNB-CU-Name PRESENCE optional }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }, + ... +} + + +Cells-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Activated-List-ItemIEs } } + +Cells-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-Cells-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-to-be-Activated-List-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- F1 Setup Failure +-- +-- ************************************************************** + +F1SetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupFailureIEs} }, + ... +} + +F1SetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBDUConfigurationUpdate::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateIEs} }, + ... +} + +GNBDUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Served-Cells-To-Add-List CRITICALITY reject TYPE Served-Cells-To-Add-List PRESENCE optional }| + { ID id-Served-Cells-To-Modify-List CRITICALITY reject TYPE Served-Cells-To-Modify-List PRESENCE optional }| + { ID id-Served-Cells-To-Delete-List CRITICALITY reject TYPE Served-Cells-To-Delete-List PRESENCE optional }| + { ID id-Active-Cells-List CRITICALITY reject TYPE Active-Cells-List PRESENCE optional }, + ... +} +Served-Cells-To-Add-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Add-ItemIEs } } +Served-Cells-To-Modify-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Modify-ItemIEs } } +Served-Cells-To-Delete-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Delete-ItemIEs } } +Active-Cells-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Active-Cells-ItemIEs } } + +Served-Cells-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Add-Item CRITICALITY reject TYPE Served-Cells-To-Add-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Modify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Modify-Item CRITICALITY reject TYPE Served-Cells-To-Modify-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Delete-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Delete-Item CRITICALITY reject TYPE Served-Cells-To-Delete-Item PRESENCE mandatory }, +... +} + +Active-Cells-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Active-Cells-Item CRITICALITY reject TYPE Active-Cells-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBDUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateFailureIEs} }, + ... +} + +GNBDUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBCUConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateIEs} }, + ... +} + +GNBCUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Deactivated-List-ItemIEs } } + +Cells-to-be-Deactivated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Deactivated-List-Item CRITICALITY reject TYPE Cells-to-be-Deactivated-List-Item PRESENCE mandatory }, +...} + + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBCUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Failed-to-be-Activated-List CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +Cells-Failed-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Failed-to-be-Activated-List-ItemIEs } } + +Cells-Failed-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Failed-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateFailureIEs} }, + ... +} + +GNBCUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE Context Setup ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT SETUP REQUEST +-- +-- ************************************************************** + +UEContextSetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupRequestIEs} }, + ... +} + +UEContextSetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SpCell-ID CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE mandatory}| + { ID id-Candidate-SpCell-List CRITICALITY ignore TYPE Candidate-SpCell-List PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-SCell-ToBeSetup-List CRITICALITY ignore TYPE SCell-ToBeSetup-List PRESENCE optional }| + { ID id-SRBs-ToBeSetup-List CRITICALITY reject TYPE SRBs-ToBeSetup-List PRESENCE optional }| + { ID id-DRBs-ToBeSetup-List CRITICALITY reject TYPE DRBs-ToBeSetup-List PRESENCE mandatory }, + ... +} + +Candidate-SpCell-List::= SEQUENCE (SIZE(1..maxnoofCandidateSpCells)) OF ProtocolIE-SingleContainer { { Candidate-SpCell-ItemIEs} } +SCell-ToBeSetup-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetup-ItemIEs} } +SRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetup-ItemIEs} } +DRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetup-ItemIEs} } + + +Candidate-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Candidate-SpCell-Item CRITICALITY ignore TYPE Candidate-SpCell-Item PRESENCE mandatory }, + ... +} + + +SCell-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetup-Item CRITICALITY ignore TYPE SCell-ToBeSetup-Item PRESENCE mandatory }, + ... +} + +SRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetup-Item CRITICALITY reject TYPE SRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetup-Item CRITICALITY reject TYPE DRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- UE CONTEXT SETUP RESPONSE +-- +-- ************************************************************** + +UEContextSetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupResponseIEs} }, + ... +} + + +UEContextSetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DRBs-Setup-List CRITICALITY ignore TYPE DRBs-Setup-List PRESENCE mandatory}| + { ID id-SRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetup-List CRITICALITY ignore TYPE DRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-SCell-FailedtoSetup-List CRITICALITY ignore TYPE SCell-FailedtoSetup-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +DRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Setup-ItemIEs} } +SRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetup-ItemIEs} } +DRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetup-ItemIEs} } +SCell-FailedtoSetup-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetup-ItemIEs} } + +DRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Setup-Item CRITICALITY ignore TYPE DRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetup-Item CRITICALITY ignore TYPE SCell-FailedtoSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP FAILURE +-- +-- ************************************************************** + +UEContextSetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupFailureIEs} }, + ... +} + +UEContextSetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Potential-SpCell-List CRITICALITY ignore TYPE Potential-SpCell-List PRESENCE optional }, + ... +} + +Potential-SpCell-List::= SEQUENCE (SIZE(0..maxnoofPotentialSpCells)) OF ProtocolIE-SingleContainer { { Potential-SpCell-ItemIEs} } + +Potential-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Potential-SpCell-Item CRITICALITY ignore TYPE Potential-SpCell-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Context Release Request ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Release Request +-- +-- ************************************************************** + +UEContextReleaseRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEContextReleaseRequestIEs}}, + ... +} + +UEContextReleaseRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- UE Context Release (gNB-CU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMMAND +-- +-- ************************************************************** + +UEContextReleaseCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCommandIEs} }, + ... +} + +UEContextReleaseCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMPLETE +-- +-- ************************************************************** + +UEContextReleaseComplete ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCompleteIEs} }, + ... +} + + +UEContextReleaseCompleteIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, ... +} + +-- ************************************************************** +-- +-- UE Context Modification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUEST +-- +-- ************************************************************** + +UEContextModificationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequestIEs} }, + ... +} + +UEContextModificationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SpCell-ID CRITICALITY ignore TYPE NRCGI PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE optional }| + { ID id-TransmissionStopIndicator CRITICALITY ignore TYPE TransmissionStopIndicator PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-RRCRconfigurationCompleteIndicator CRITICALITY ignore TYPE RRCRconfigurationCompleteIndicator PRESENCE optional }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE optional }| + { ID id-SCell-ToBeSetupMod-List CRITICALITY ignore TYPE SCell-ToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-ToBeRemoved-List CRITICALITY ignore TYPE SCell-ToBeRemoved-List PRESENCE optional }| + { ID id-SRBs-ToBeSetupMod-List CRITICALITY reject TYPE SRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeSetupMod-List CRITICALITY reject TYPE DRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeModified-List CRITICALITY reject TYPE DRBs-ToBeModified-List PRESENCE optional }| + { ID id-SRBs-ToBeReleased-List CRITICALITY reject TYPE SRBs-ToBeReleased-List PRESENCE optional }| + { ID id-DRBs-ToBeReleased-List CRITICALITY reject TYPE DRBs-ToBeReleased-List PRESENCE optional }, + ... +} + +SCell-ToBeSetupMod-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetupMod-ItemIEs} } +SCell-ToBeRemoved-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeRemoved-ItemIEs} } +SRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetupMod-ItemIEs} } +DRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetupMod-ItemIEs} } + +DRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeModified-ItemIEs} } +SRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeReleased-ItemIEs} } +DRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeReleased-ItemIEs} } + +SCell-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetupMod-Item CRITICALITY ignore TYPE SCell-ToBeSetupMod-Item PRESENCE mandatory }, + ... +} + +SCell-ToBeRemoved-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeRemoved-Item CRITICALITY ignore TYPE SCell-ToBeRemoved-Item PRESENCE mandatory }, + ... +} + + +SRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetupMod-Item CRITICALITY reject TYPE DRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeModified-Item CRITICALITY reject TYPE DRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + + +SRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeReleased-Item CRITICALITY reject TYPE SRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeReleased-Item CRITICALITY reject TYPE DRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION RESPONSE +-- +-- ************************************************************** + +UEContextModificationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationResponseIEs} }, + ... +} + + +UEContextModificationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-SetupMod-List CRITICALITY ignore TYPE DRBs-SetupMod-List PRESENCE optional}| + { ID id-DRBs-Modified-List CRITICALITY ignore TYPE DRBs-Modified-List PRESENCE optional}| + { ID id-SRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-FailedtoSetupMod-List CRITICALITY ignore TYPE SCell-FailedtoSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeModified-List CRITICALITY ignore TYPE DRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +DRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-SetupMod-ItemIEs} } +DRBs-Modified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Modified-ItemIEs } } +DRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeModified-ItemIEs} } +SRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetupMod-ItemIEs} } +DRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetupMod-ItemIEs} } +SCell-FailedtoSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetupMod-ItemIEs} } + +DRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-SetupMod-Item CRITICALITY ignore TYPE DRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Modified-Item CRITICALITY ignore TYPE DRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + + +DRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeModified-Item CRITICALITY ignore TYPE DRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetupMod-Item CRITICALITY ignore TYPE SCell-FailedtoSetupMod-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION FAILURE +-- +-- ************************************************************** + +UEContextModificationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationFailureIEs} }, + ... +} + +UEContextModificationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- UE Context Modification Required (gNB-DU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUIRED +-- +-- ************************************************************** + +UEContextModificationRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequiredIEs} }, + ... +} + +UEContextModificationRequiredIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-Required-ToBeModified-List CRITICALITY reject TYPE DRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-DRBs-Required-ToBeReleased-List CRITICALITY reject TYPE DRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +DRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeModified-ItemIEs } } +DRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeReleased-ItemIEs } } + +SRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Required-ToBeReleased-ItemIEs } } + +DRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeModified-Item CRITICALITY reject TYPE DRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +DRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE DRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION CONFIRM +-- +-- ************************************************************** + +UEContextModificationConfirm::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationConfirmIEs} }, + ... +} + + +UEContextModificationConfirmIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DRBs-ModifiedConf-List CRITICALITY ignore TYPE DRBs-ModifiedConf-List PRESENCE optional}| + { ID id-DRBs-FailedToBeModifiedConf-List CRITICALITY ignore TYPE DRBs-FailedToBeModifiedConf-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +DRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ModifiedConf-ItemIEs } } +DRBs-FailedToBeModifiedConf-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeModifiedConf-ItemIEs} } + +DRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ModifiedConf-Item CRITICALITY ignore TYPE DRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +DRBs-FailedToBeModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeModifiedConf-Item CRITICALITY ignore TYPE DRBs-FailedToBeModifiedConf-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- DL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DL RRC Message Transfer +-- +-- ************************************************************** + +DLRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DLRRCMessageTransferIEs}}, + ... +} + +DLRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }, + ... +} +-- ************************************************************** +-- +-- UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UL RRC Message Transfer +-- +-- ************************************************************** + +ULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ULRRCMessageTransferIEs}}, + ... +} + +ULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PRIVATE MESSAGE +-- +-- ************************************************************** + +PrivateMessage ::= SEQUENCE { + privateIEs PrivateIE-Container {{PrivateMessage-IEs}}, + ... +} + +PrivateMessage-IEs F1AP-PRIVATE-IES ::= { + ... +} + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/asn1_constants.h b/openair2/F1AP/MESSAGES/ASN1/R15/asn1_constants.h new file mode 100644 index 0000000000..5f7897148d --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15/asn1_constants.h @@ -0,0 +1,3 @@ +#ifndef __ASN1_CONSTANTS_H__ +#define __ASN1_CONSTANTS_H__ +#endif diff --git a/openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py b/openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py new file mode 100644 index 0000000000..8c0f7e8a16 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py @@ -0,0 +1,697 @@ +import re, os, sys, string +import datetime +import getopt +import getpass + +version = "1.0.2" + +lines = "" +iesDefs = {} +ieofielist = {} +outdir = './' + +filenames = [] +verbosity = 0 +prefix = "" + +FAIL = '\033[91m' +WARN = '\033[93m' +ENDC = '\033[0m' + +fileprefix = "" +fileprefix_first_upper = "" + +def printFail(string): + sys.stderr.write(FAIL + string + ENDC + "\n") + +def printWarning(string): + print WARN + string + ENDC + +def printDebug(string): + if verbosity > 0: + print string + +def outputHeaderToFile(f, filename): + now = datetime.datetime.now() + f.write("""/* + * 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 + */ + +""") + f.write("/*******************************************************************************\n") + f.write(" * This file had been created by asn1tostruct.py script v%s\n" % (version)) + f.write(" * Please do not modify this file but regenerate it via script.\n") + f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filenames)) + f.write(" ******************************************************************************/\n") + +def lowerFirstCamelWord(word): + """ puts the first word in a CamelCase Word in lowercase. + + I.e. CustomerID becomes customerID, XMLInfoTest becomes xmlInfoTest + """ + newstr = '' + swapped = word.swapcase() + idx = 0 + + # if it's all-caps, return an all-lowered version + lowered = word.lower() + + if swapped == lowered: + return lowered + + for c in swapped: + if c in string.lowercase: + newstr += c + idx += 1 + else: + break + if idx < 2: + newstr += word[idx:] + else: + newstr = newstr[:-1]+ word[idx-1:] + + return newstr + +def usage(): + print "Python parser for asn1 v%s" % (version) + print "Usage: python asn1tostruct.py [options]" + print "Available options:" + print "-d Enable script debug" + print "-f [file] Input file to parse" + print "-o [dir] Output files to given directory" + print "-h Print this help and return" + +try: + opts, args = getopt.getopt(sys.argv[1:], "df:ho:", ["debug", "file", "help", "outdir"]) +except getopt.GetoptError as err: + # print help information and exit: + usage() + sys.exit(2) + +for o, a in opts: + if o in ("-f", "--file"): + filenames.append(a) + if o in ("-d", "--debug"): + verbosity = 1 + if o in ("-o", "--outdir"): + outdir = a + if outdir.rfind('/') != len(outdir): + outdir += '/' + if o in ("-h", "--help"): + usage() + sys.exit(2) + +for filename in filenames: + file = open(filename, 'r') + for line in file: + # Removing any comment + if line.find('--') >= 0: + line = line[:line.find('--')] + # Removing any carriage return + lines += re.sub('\r', '', line) + + for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+SEQUENCE\s+\(\s*SIZE\s*\(\s*\d+\s*\.\.\s*[0-9a-zA-Z-]+\s*\)\s*\)\s*OF\s+[a-zA-Z-]+\s*\{\s*\{\s*([0-9a-zA-Z-]+)\s*\}\s*\}', lines, re.MULTILINE): + ieofielist[m[0]] = m[1] + for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+E-RAB-IE-ContainerList\s*\{\s*\{\s*([a-zA-Z0-9-]+)\s*\}\s*\}', lines, re.MULTILINE): + ieofielist[m[0]] = m[1] + + for i in re.findall(r'([a-zA-Z0-9-]+)\s+([A-Z0-9-]+)\s*::=\s*\{\s+([\,\|\{\}\t\n\.{3}\ \-a-zA-Z0-9]+)\s+}\n', lines, re.MULTILINE): + ies = [] + maxLength = 0 + # TODO: handle extensions + if i[1].find('EXTENSION') >= 0: + continue + if fileprefix == "": + fileprefix = i[1][:i[1].find('-')].lower() + for j in re.findall(r'\s*\{\s*([a-zA-Z0-9-\ \t]+)\s*\}\s*[\|,]*', i[2], re.MULTILINE): + for k in re.findall(r'ID\s*([a-zA-Z0-9\-]+)\s*CRITICALITY\s*([a-zA-Z0-9\-]+)\s+[A-Z]+\s+([a-zA-Z0-9\-]+)\s*PRESENCE\s*([a-zA-Z0-9\-]+)', j, re.MULTILINE): + printDebug("Got new ie for message " + i[0] + ": " + str(k)) + if len(k[2]) > maxLength: + maxLength = len(k[2]) + ies.append(k) + + if len(ies) > 0: + iesDefs[i[0]] = { "length": maxLength, "ies": ies } + else: + printWarning("Didn't find any information element for message: " + i[0]) + +if len(iesDefs) == 0: + printFail("No Information Element parsed, exiting") + sys.exit(0) + +fileprefix_first_upper = fileprefix[0].upper() + fileprefix[1:] + +f = open(outdir + fileprefix + '_ies_defs.h', 'w') +outputHeaderToFile(f, filename) +f.write("#include \"%s_common.h\"\n\n" % (fileprefix)) +f.write("#ifndef %s_IES_DEFS_H_\n#define %s_IES_DEFS_H_\n\n" % (fileprefix.upper(), fileprefix.upper())) +f.write("/* Define the version of script used to generate this file */\n") +f.write("#define %s_SCRIPT_VERSION (%s)\n\n" % (fileprefix.upper(), re.sub('\.', '', version))) + +for key in iesDefs: + + if key not in ieofielist.values(): + continue + + for (i, j) in ieofielist.items(): + if j == key: + break + + f.write("typedef struct %sIEs_s {\n" % (re.sub('-', '_', i))) + f.write(" A_SEQUENCE_OF(struct %s_s) %s;\n" % (re.sub('IEs', '', re.sub('-', '_', ieofielist[i])), lowerFirstCamelWord(re.sub('IEs', '', re.sub('-', '_', ieofielist[i]))))) + f.write("} %sIEs_t;\n\n" % (re.sub('-', '_', i))) + +for key in iesDefs: + keyupperunderscore = re.sub('-', '_', key.upper()) + keylowerunderscore = re.sub('-', '_', key.lower()) + shift = 0 + + if len(iesDefs[key]["ies"]) == 0: + continue + + # Presence mask + for ie in iesDefs[key]["ies"]: + ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper() + + if ie[3] == "optional" or ie[3] == "conditional": + f.write("#define {0:<{pad}} {1}\n".format("%s_%s_PRESENT" % (keyupperunderscore, ieupperunderscore), "(1 << %d)" % shift, + pad=iesDefs[key]["length"] + len(keyupperunderscore) + 9)) + shift += 1 + if (shift > 0): + f.write("\n") + + f.write("typedef struct %s_s {\n" % (re.sub('-', '_', key))) + if (shift > 0): + f.write(" {0:<{pad}} {1};\n".format("uint16_t", "presenceMask", pad=iesDefs[key]["length"] + 2)) + for ie in iesDefs[key]["ies"]: + ieunderscore = re.sub('-', '_', ie[2]) + iename = re.sub('id-', '', ie[0]) + ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename)) + if ie[2] in ieofielist: + f.write(" %sIEs_t %s;" % (re.sub('-', '_', ie[2]), ienameunderscore)) + else: + f.write(" {0:<{pad}} {1};".format("%s_t" % ieunderscore, ienameunderscore, pad=iesDefs[key]["length"] + 2)) + if ie[3] == "optional": + f.write(" ///< Optional field") + elif ie[3] == "conditional": + f.write(" ///< Conditional field") + f.write("\n") + + f.write("} %s_t;\n\n" % (re.sub('-', '_', key))) + +f.write("typedef struct %s_message_s {\n" % (fileprefix)) +f.write(" %s_ProcedureCode_t procedureCode;\n" % (fileprefix_first_upper)) +f.write(" %s_Criticality_t criticality;\n" % (fileprefix_first_upper)) +f.write(" uint8_t direction;\n") +f.write(" union {\n") + +messageList = iesDefs.keys() +messageList.sort() +for message in messageList: + if message in ieofielist.values(): + continue + if len(iesDefs[message]["ies"]) == 0: + continue + f.write(" %s_t %s;\n" % (re.sub('-', '_', message), lowerFirstCamelWord(re.sub('-', '_', message)))) +f.write(" } msg;\n") +f.write("} %s_message;\n\n" % (fileprefix)) + +for key in iesDefs: + if key in ieofielist.values(): + continue + structName = re.sub('ies', '', key) + asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key))) + asn1cStruct = re.sub('Item', 'List', asn1cStruct) + keylowerunderscore = re.sub('-', '_', key.lower()) + firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct))) + f.write("/** \\brief Decode function for %s ies.\n" % (key)) + if len(iesDefs[key]["ies"]) != 0: + f.write(" * \\param %s Pointer to ASN1 structure in which data will be stored\n" % (lowerFirstCamelWord(re.sub('-', '_', key)))) + f.write(" * \\param any_p Pointer to the ANY value to decode.\n") + f.write(" **/\n") + f.write("int %s_decode_%s(\n" % (fileprefix, keylowerunderscore)) + + if len(iesDefs[key]["ies"]) != 0: + f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) + f.write(" ANY_t *any_p);\n\n") + + if len(iesDefs[key]["ies"]) == 0: + continue + + f.write("/** \\brief Encode function for %s ies.\n" % (key)) + f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower)) + f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key)))) + f.write(" **/\n") + f.write("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower()))) + f.write(" %s_t *%s,\n" % (asn1cStruct, firstlower)) + f.write(" %s_t *%s);\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) + +for key in iesDefs: + if key not in ieofielist.values(): + continue + asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key)) + asn1cStruct = re.sub('Item', 'List', asn1cStruct) + firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct))) + f.write("/** \\brief Encode function for %s ies.\n" % (key)) + f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower)) + f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key)))) + f.write(" **/\n") + f.write("int %s_encode_%s(\n" % (fileprefix, firstlower.lower())) + f.write(" %s_t *%s,\n" % (asn1cStruct, firstlower)) + f.write(" %sIEs_t *%sIEs);\n\n" % (asn1cStruct, firstlower)) + f.write("/** \\brief Decode function for %s ies.\n" % (key)) + f.write(" * \\param any_p Pointer to the ANY value to decode.\n") + f.write(" * \\param callback Callback function called when any_p is successfully decoded.\n") + f.write(" **/\n") + f.write("int %s_decode_%s(\n" % (fileprefix, firstlower.lower())) + f.write(" %sIEs_t *%sIEs,\n" % (asn1cStruct, firstlower)) + f.write(" %s_t *%s);\n\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct))) + +for key in iesDefs: + asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key)) + asn1cStruct = re.sub('Item', 'List', asn1cStruct) + firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct))) + + if key in ieofielist.values(): + f.write("/** \\brief Display %s encapsulated IE using XER encoding.\n" % (asn1cStruct)) + f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key)))) + f.write(" * \\param file File descriptor to write output.\n") + f.write(" **/\n") + f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('item', 'list', firstlower.lower()))) + f.write(" asn_app_consume_bytes_f *cb,\n") + f.write(" void *app_key,\n") + f.write(" %sIEs_t *%sIEs);\n\n" % (re.sub('item', 'list', asn1cStruct), firstlower)) + else: + f.write("/** \\brief Display %s message using XER encoding.\n" % (asn1cStruct)) + f.write(" * \\param message_p Pointer to root message.\n") + f.write(" * \\param file File descriptor to write output.\n") + f.write(" **/\n") + f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, firstlower.lower())) + f.write(" asn_app_consume_bytes_f *cb,\n") + f.write(" void *app_key,\n") + f.write(" %s_message *message_p);\n\n" % (fileprefix)) + +f.write("int %s_xer__print2sp(const void *buffer, size_t size, void *app_key);\n\n" % (fileprefix.lower())) +f.write("int %s_xer__print2fp(const void *buffer, size_t size, void *app_key);\n\n" % (fileprefix.lower())) +f.write("extern size_t %s_string_total_size;\n\n" % (fileprefix.lower())) +f.write("#endif /* %s_IES_DEFS_H_ */\n\n" % (fileprefix.upper())) + +#Generate Decode functions +f = open(outdir + fileprefix + '_decoder.c', 'w') +outputHeaderToFile(f, filename) +f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n\n" % (fileprefix, fileprefix)) +for key in iesDefs: + if key in ieofielist.values(): + continue + structName = re.sub('ies', '', key) + asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key)) + if asn1cStruct.rfind('_') == len(asn1cStruct) - 1: + asn1cStruct = asn1cStruct[:-1] + asn1cStruct = re.sub('Item', 'List', asn1cStruct) + ielistname = re.sub('UE', 'ue', asn1cStruct) + ielistnamefirstlower = ielistname[:1].lower() + ielistname[1:] + asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:] + keyName = re.sub('-', '_', key) + keyupperunderscore = keyName.upper() + firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct))) + + iesaccess = "" + if key not in ieofielist.values(): + iesaccess = "%s_ies." % (firstlower) + + f.write("int %s_decode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower()))) + if len(iesDefs[key]["ies"]) != 0: + f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) + f.write(" ANY_t *any_p) {\n\n") + + f.write(" %s_t %s;\n %s_t *%s_p = &%s;\n" % (asn1cStruct, asn1cStructfirstlower, asn1cStruct, asn1cStructfirstlower, asn1cStructfirstlower)) + f.write(" int i, decoded = 0;\n") + if len(iesDefs[key]["ies"]) != 0: + f.write(" int tempDecoded = 0;\n") + + f.write(" assert(any_p != NULL);\n") + if len(iesDefs[key]["ies"]) != 0: + f.write(" assert(%s != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', key)))) + + f.write(" %s_DEBUG(\"Decoding message %s (%%s:%%d)\\n\", __FILE__, __LINE__);\n\n" % (fileprefix.upper(), re.sub('-', '_', keyName))) + f.write(" ANY_to_type_aper(any_p, &asn_DEF_%s, (void**)&%s_p);\n\n" % (asn1cStruct, asn1cStructfirstlower)) + f.write(" for (i = 0; i < %s_p->%slist.count; i++) {\n" % (asn1cStructfirstlower, iesaccess)) + f.write(" %s_IE_t *ie_p;\n" % (fileprefix[0].upper() + fileprefix[1:])) + f.write(" ie_p = %s_p->%slist.array[i];\n" % (asn1cStructfirstlower, iesaccess)) + f.write(" switch(ie_p->id) {\n") + for ie in iesDefs[key]["ies"]: + iename = re.sub('id-', '', ie[0]) + ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename)) + ienameunderscorefirstlower = lowerFirstCamelWord(ienameunderscore) + ietypesubst = re.sub('-', '', ie[2]) + ietypeunderscore = re.sub('-', '_', ie[2]) + ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper() + + if ie[3] == "optional": + f.write(" /* Optional field */\n") + elif ie[3] == "conditional": + f.write(" /* Conditional field */\n") + f.write(" case %s_ProtocolIE_ID_%s:\n" % (fileprefix_first_upper, re.sub('-', '_', ie[0]))) + f.write(" {\n") + f.write(" %s_t *%s_p = NULL;\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst))) + if ie[3] != "mandatory": + f.write(" %s->presenceMask |= %s_%s_PRESENT;\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore)) + f.write(" tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_%s, (void**)&%s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst))) + f.write(" if (tempDecoded < 0 || %s_p == NULL) {\n" % (lowerFirstCamelWord(ietypesubst))) + f.write(" %s_ERROR(\"Decoding of IE %s failed\\n\");\n" % (fileprefix.upper(), ienameunderscore)) + f.write(" if (%s_p)\n" % (lowerFirstCamelWord(ietypesubst))) + f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst))) + f.write(" return -1;\n") + f.write(" }\n") + f.write(" decoded += tempDecoded;\n") + f.write(" if (asn1_xer_print)\n") + f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst))) + if ie[2] in ieofielist.keys(): + f.write(" if (%s_decode_%s(&%s->%s, %s_p) < 0) {\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst))) + f.write(" %s_ERROR(\"Decoding of encapsulated IE %s failed\\n\");\n" % (fileprefix.upper(), lowerFirstCamelWord(ietypesubst))) + f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst))) + f.write(" }\n") + else: + f.write(" memcpy(&%s->%s, %s_p, sizeof(%s_t));\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst), ietypeunderscore)) + #f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst))) + f.write(" } break;\n") + f.write(" default:\n") + f.write(" %s_ERROR(\"Unknown protocol IE id (%%d) for message %s\\n\", (int)ie_p->id);\n" % (fileprefix.upper(), re.sub('-', '_', structName.lower()))) + f.write(" return -1;\n") + f.write(" }\n") + f.write(" }\n") + f.write(" return decoded;\n") + f.write("}\n\n") + +for key in iesDefs: + if key not in ieofielist.values(): + continue + + keyname = re.sub('IEs', '', re.sub('Item', 'List', key)) + + f.write("int %s_decode_%s(\n" % (fileprefix, re.sub('-', '_', keyname).lower())) + f.write(" %sIEs_t *%sIEs,\n" % (re.sub('-', '_', keyname), lowerFirstCamelWord(re.sub('-', '_', keyname)))) + f.write(" %s_t *%s) {\n\n" % (re.sub('-', '_', keyname), lowerFirstCamelWord(re.sub('-', '_', keyname)))) + f.write(" int i, decoded = 0;\n") + f.write(" int tempDecoded = 0;\n\n") + + f.write(" assert(%s != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname)))); + f.write(" assert(%sIEs != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname)))); + + f.write(" for (i = 0; i < %s->list.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname)))) + f.write(" %s_IE_t *ie_p = %s->list.array[i];\n" % (fileprefix[0].upper() + fileprefix[1:], lowerFirstCamelWord(re.sub('-', '_', keyname)))) + f.write(" switch (ie_p->id) {\n") + for ie in iesDefs[key]["ies"]: + iename = re.sub('id-', '', ie[0]) + ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename)) + f.write(" case %s_ProtocolIE_ID_%s:\n" % (fileprefix_first_upper, re.sub('-', '_', ie[0]))) + f.write(" {\n") + f.write(" %s_t *%s_p = NULL;\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2])))) + f.write(" tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_%s, (void**)&%s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2])))) + f.write(" if (tempDecoded < 0 || %s_p == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2])))) + f.write(" %s_ERROR(\"Decoding of IE %s for message %s failed\\n\");\n" % (fileprefix.upper(), ienameunderscore, re.sub('-', '_', keyname))) + f.write(" if (%s_p)\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2])))) + #f.write(" free(%s_p);\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2])))) + f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2])))) + f.write(" return -1;\n") + f.write(" }\n") + f.write(" decoded += tempDecoded;\n") + f.write(" if (asn1_xer_print)\n") + f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2])))) + f.write(" ASN_SEQUENCE_ADD(&%sIEs->%s, %s_p);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname)), + re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), lowerFirstCamelWord(re.sub('-', '', ie[2])))) + f.write(" } break;\n") + f.write(" default:\n") + f.write(" %s_ERROR(\"Unknown protocol IE id (%%d) for message %s\\n\", (int)ie_p->id);\n" % (fileprefix.upper(), re.sub('-', '_', structName.lower()))) + f.write(" return -1;\n") + f.write(" }\n") + f.write(" }\n") + f.write(" return decoded;\n") + f.write("}\n\n") + + +#Generate IES Encode functions +f = open(outdir + fileprefix + '_encoder.c', 'w') +outputHeaderToFile(f,filename) +f.write("#include \"%s_common.h\"\n" % (fileprefix)) +f.write("#include \"%s_ies_defs.h\"\n\n" % (fileprefix)) +for key in iesDefs: + if key in ieofielist.values(): + continue + + structName = re.sub('ies', '', key) + asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key)) + asn1cStruct = re.sub('Item', 'List', asn1cStruct) + if asn1cStruct.rfind('_') == len(asn1cStruct) - 1: + asn1cStruct = asn1cStruct[:-1] + asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:] + firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct))) + + iesaccess = "" + if key not in ieofielist.values(): + iesaccess = "%s_ies." % (firstwordlower) + + keyName = re.sub('-', '_', key) + keyupperunderscore = keyName.upper() + # No IE to encode... + if len(iesDefs[key]["ies"]) == 0: + continue + + f.write("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower()))) + f.write(" %s_t *%s,\n" % (asn1cStruct, firstwordlower)) + f.write(" %s_t *%s) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) + + f.write(" %s_IE_t *ie;\n\n" % (fileprefix_first_upper)) + + f.write(" assert(%s != NULL);\n" % (firstwordlower)); + f.write(" assert(%s != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', key)))); + + for ie in iesDefs[key]["ies"]: + iename = re.sub('-', '_', re.sub('id-', '', ie[0])) + ienameunderscore = re.sub('-', '_', iename) + ienamefirstwordlower = lowerFirstCamelWord(iename) + ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper() + ietypeunderscore = re.sub('-', '_', ie[2]) + + if ie[3] != "mandatory": + if ie[3] == "optional": + f.write(" /* Optional field */\n") + elif ie[3] == "conditional": + f.write(" /* Conditional field */\n") + f.write(" if (%s->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore)) + #f.write(" == %s_%s_PRESENT) {\n" % (keyupperunderscore, ieupperunderscore)) + f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0]))) + f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1])) + f.write(" &asn_DEF_%s,\n" % (ietypeunderscore)) + f.write(" &%s->%s)) == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower)) + f.write(" return -1;\n") + f.write(" }\n") + f.write(" ASN_SEQUENCE_ADD(&%s->%slist, ie);\n" % (firstwordlower, iesaccess)) + f.write(" }\n\n") + else: + if ie[2] in ieofielist.keys(): + f.write(" %s_t %s;\n\n" % (ietypeunderscore, ienamefirstwordlower)) + f.write(" memset(&%s, 0, sizeof(%s_t));\n" % (ienamefirstwordlower, ietypeunderscore)) + f.write("\n") + f.write(" if (%s_encode_%s(&%s, &%s->%s) < 0) return -1;\n" % (fileprefix, ietypeunderscore.lower(), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower)) + f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0]))) + f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1])) + f.write(" &asn_DEF_%s,\n" % (ietypeunderscore)) + if ie[2] in ieofielist.keys(): + f.write(" &%s)) == NULL) {\n" % (ienamefirstwordlower)) + else: + f.write(" &%s->%s)) == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower)) + f.write(" return -1;\n") + f.write(" }\n") + f.write(" ASN_SEQUENCE_ADD(&%s->%slist, ie);\n\n" % (firstwordlower, iesaccess)) + if ie[2] in ieofielist.keys(): + f.write(" /* Free any dynamic allocation that is no more used */\n") + f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, &%s);\n\n" % (ietypeunderscore, ienamefirstwordlower)) + + f.write(" return 0;\n") + f.write("}\n\n") + +for (key, value) in iesDefs.items(): + if key not in ieofielist.values(): + continue + + ie = value["ies"][0] + ietypeunderscore = re.sub('-', '_', ie[2]) + asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key))) + asn1cStruct = re.sub('Item', 'List', asn1cStruct) + firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct))) + + for (i, j) in ieofielist.items(): + if j == key: + break + f.write("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', i).lower())) + f.write(" %s_t *%s,\n" % (asn1cStruct, firstwordlower)) + f.write(" %sIEs_t *%sIEs) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i)))) + f.write(" int i;\n") + + f.write(" %s_IE_t *ie;\n\n" % (fileprefix_first_upper)) + + f.write(" assert(%s != NULL);\n" % (firstwordlower)); + f.write(" assert(%sIEs != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i)))); + + f.write(" for (i = 0; i < %sIEs->%s.count; i++) {\n" % (firstwordlower, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))))) + f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0]))) + f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1])) + f.write(" &asn_DEF_%s,\n" % (ietypeunderscore)) + f.write(" %sIEs->%s.array[i])) == NULL) {\n" % (firstwordlower, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))))) + f.write(" return -1;\n") + f.write(" }\n") + f.write(" ASN_SEQUENCE_ADD(&%s->list, ie);\n" % (firstwordlower)) + f.write(" }\n") + f.write(" return 0;\n") + f.write("}\n\n") + +#Generate xer print functions +f = open(outdir + fileprefix + '_xer_print.c', 'w') +outputHeaderToFile(f, filename) +f.write("#include <stdlib.h>\n") +f.write("#include <stdio.h>\n\n") +f.write("#include <asn_application.h>\n#include <asn_internal.h>\n\n") +f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n\n" % (fileprefix, fileprefix)) + +f.write("size_t %s_string_total_size = 0;\n\n" % (fileprefix.lower())) +f.write("""int +%s_xer__print2fp(const void *buffer, size_t size, void *app_key) { + FILE *stream = (FILE *)app_key; + + if(fwrite(buffer, 1, size, stream) != size) + return -1; + + return 0; +} + +""" % (fileprefix.lower())) + +f.write("""int %s_xer__print2sp(const void *buffer, size_t size, void *app_key) { + char *string = (char *)app_key; + + /* Copy buffer to the formatted string */ + memcpy(&string[%s_string_total_size], buffer, size); + + %s_string_total_size += size; + + return 0; +} + +""" % (fileprefix.lower(), fileprefix.lower(), fileprefix.lower())) + +f.write("""static asn_enc_rval_t +xer_encode_local(asn_TYPE_descriptor_t *td, void *sptr, + asn_app_consume_bytes_f *cb, void *app_key, int indent) { + asn_enc_rval_t er, tmper; + const char *mname; + size_t mlen; + int xcan = 2; + + if(!td || !sptr) goto cb_failed; + + mname = td->xml_tag; + mlen = strlen(mname); + + _i_ASN_TEXT_INDENT(0, indent); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = td->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key); + if(tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("</", 2, mname, mlen, ">\\n", xcan); + + er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded; + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} +""") + +for (key, value) in iesDefs.items(): + keyName = re.sub('-', '_', key) + keyupperunderscore = keyName.upper() + iesStructName = lowerFirstCamelWord(re.sub('-', '_', key)) + + ie = value["ies"][0] + ietypeunderscore = re.sub('-', '_', ie[2]) + + if key in ieofielist.values(): + f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('ies', '', re.sub('item', 'list', re.sub('-', '_', key).lower())))) + else: + f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('ies', '', re.sub('-', '_', key).lower()))) + #f.write(" FILE *file,\n") + f.write(" asn_app_consume_bytes_f *cb,\n") + f.write(" void *app_key,\n") + if key in ieofielist.values(): + iesStructName = lowerFirstCamelWord(re.sub('Item', 'List', re.sub('-', '_', key))) + f.write(" %sIEs_t *%s) {\n\n" % (re.sub('IEs', '', re.sub('Item', 'List', re.sub('-', '_', key))), iesStructName)) + f.write(" int i;\n") + f.write(" asn_enc_rval_t er;\n") + else: + f.write(" %s_message *message_p)\n{\n" % (fileprefix)) + f.write(" %s_t *%s;\n" % (re.sub('-', '_', key), iesStructName)) + f.write(" asn_enc_rval_t er;\n") + #f.write(" void *app_key = (void *)file;\n") + #f.write(" asn_app_consume_bytes_f *cb = %s_xer__print2fp;\n\n" % (fileprefix.lower())) + + f.write(" %s = &message_p->msg.%s;\n\n" % (iesStructName, iesStructName)) + + if key in ieofielist.values(): + # Increase indentation level + f.write(" for (i = 0; i < %s->%s.count; i++) {\n" % (iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))))) + #f.write(" xer_fprint(file, &asn_DEF_%s, %s->%s.array[i]);\n" % (ietypeunderscore, iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))))) + f.write(" er = xer_encode(&asn_DEF_%s, %s->%s.array[i], XER_F_BASIC, cb, app_key);\n" % (ietypeunderscore, iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))))) + f.write(" }\n") + else: + f.write(" cb(\"<%s-PDU>\\n\", %d, app_key);\n" % (key, len("<%s-PDU>\n" % (key)))) + f.write(" xer_encode_local(&asn_DEF_%s_Criticality, &message_p->criticality, cb, app_key, 1);\n" % fileprefix_first_upper) + f.write(" xer_encode_local(&asn_DEF_%s_ProcedureCode, &message_p->procedureCode, cb, app_key, 1);\n" % fileprefix_first_upper) + + f.write(" cb(\" <%s>\\n\", %d, app_key);\n" % (key, len(" <%s>\n" % (key)))) + + for ie in iesDefs[key]["ies"]: + iename = re.sub('-', '_', re.sub('id-', '', ie[0])) + ienameunderscore = re.sub('-', '_', iename) + ienamefirstwordlower = lowerFirstCamelWord(iename) + ietypeunderscore = re.sub('-', '_', ie[2]) + ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper() + + if ie[3] != "mandatory": + if ie[3] == "optional": + f.write(" /* Optional field */\n") + elif ie[3] == "conditional": + f.write(" /* Conditional field */\n") + f.write(" if (%s->presenceMask & %s_%s_PRESENT)\n " % (iesStructName, keyupperunderscore, ieupperunderscore)) + + # Is it an encapsulated IE ? + if ie[2] in ieofielist.keys(): + f.write(" %s_xer_print_%s(cb, app_key, &%s->%s);\n" % (fileprefix, re.sub('ies', '', re.sub('-', '_', ie[2]).lower()), iesStructName, ienamefirstwordlower)) + else: + f.write(" xer_encode_local(&asn_DEF_%s, &%s->%s, cb, app_key, 2);\n" % (ietypeunderscore, iesStructName, ienamefirstwordlower)) + f.write(" cb(\" </%s>\\n\", %d, app_key);\n" % (key, len(" </%s>\n" % (key)))) + f.write(" cb(\"</%s-PDU>\\n\", %d, app_key);\n" % (key, len("</%s-PDU>\n" % (key)))) + + f.write(" _ASN_ENCODED_OK(er);\n") + #if key not in ieofielist.values(): + #f.write("cb_failed:\n") + #f.write(" return er;\n") + f.write("}\n\n") -- GitLab From 3aabed57d23c719be73ece65efd7fd9e9fdecbd1 Mon Sep 17 00:00:00 2001 From: Nikos Makris <nimakris@gmail.com> Date: Fri, 27 Apr 2018 15:24:17 +0300 Subject: [PATCH 015/308] Applied patch for aper asn1c - Compile with flag --pdcp-split --- cmake_targets/CMakeLists.txt | 22 +-- cmake_targets/tools/build_helper | 2 +- cmake_targets/tools/fix_asn1 | 12 +- cmake_targets/tools/generate_asn1 | 4 +- ...finitions.asn => F1AP-CommonDataTypes.asn} | 0 ...ant-Definitions.asn => F1AP-Constants.asn} | 0 ...er-Definitions.asn => F1AP-Containers.asn} | 0 ...n-Element-Definitions.asn => F1AP-IEs.asn} | 0 ...-Definitions.asn => F1AP-PDU-Contents.asn} | 0 ...ocedures.asn => F1AP-PDU-Descriptions.asn} | 0 openair2/RRC/LITE/L2_interface.c | 2 +- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 35 ++-- openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c | 11 ++ openair2/RRC/LITE/rrc_UE.c | 4 +- openair2/RRC/LITE/rrc_eNB.c | 8 +- openair2/RRC/LITE/rrc_eNB_S1AP.c | 4 +- openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py | 170 +----------------- 17 files changed, 65 insertions(+), 209 deletions(-) rename openair2/F1AP/MESSAGES/ASN1/R15/{38.473.Common-Definitions.asn => F1AP-CommonDataTypes.asn} (100%) rename openair2/F1AP/MESSAGES/ASN1/R15/{38.473.Constant-Definitions.asn => F1AP-Constants.asn} (100%) rename openair2/F1AP/MESSAGES/ASN1/R15/{38.473.Container-Definitions.asn => F1AP-Containers.asn} (100%) rename openair2/F1AP/MESSAGES/ASN1/R15/{38.473.Information-Element-Definitions.asn => F1AP-IEs.asn} (100%) rename openair2/F1AP/MESSAGES/ASN1/R15/{38.473.PDU-Definitions.asn => F1AP-PDU-Contents.asn} (100%) rename openair2/F1AP/MESSAGES/ASN1/R15/{38.473.Elementary-Procedures.asn => F1AP-PDU-Descriptions.asn} (100%) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 2e6bd7df68..c0b864182e 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -487,19 +487,19 @@ include_directories ("${X2AP_DIR}") # Same limitation as described in RRC/S1AP: unknown generated file list # so we generate it at cmake time ############## -add_list1_option(F1AP_VERSION R15 "F1AP Asn.1 grammar version" R14 R15) +add_list1_option(F1AP_VERSION R15 "F1AP Asn.1 grammar version" R15) set(F1AP_DIR ${OPENAIR2_DIR}/F1AP) -#if (${F1AP_VERSION} STREQUAL "R14") +#if (${F1AP_VERSION} STREQUAL "R15") set (ASN1RELDIR R15) -#endif(${F1AP_VERSION} STREQUAL "R14") +#endif(${F1AP_VERSION} STREQUAL "R15") set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) set(F1AP_ASN_FILES - ${F1AP_ASN_DIR}/38.473.Common-Definitions.asn - ${F1AP_ASN_DIR}/38.473.Constant-Definitions.asn - ${F1AP_ASN_DIR}/38.473.Information-Element-Definitions.asn - ${F1AP_ASN_DIR}/38.473.PDU-Definitions.asn - ${F1AP_ASN_DIR}/38.473.Elementary-Procedures.asn - ${F1AP_ASN_DIR}/38.473.Container-Definitions.asn + ${F1AP_ASN_DIR}/F1AP-CommonDataTypes.asn + ${F1AP_ASN_DIR}/F1AP-Constants.asn + ${F1AP_ASN_DIR}/F1AP-PDU-Descriptions.asn + ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn + ${F1AP_ASN_DIR}/F1AP-IEs.asn + ${F1AP_ASN_DIR}/F1AP-Containers.asn ) set(F1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR}) @@ -508,7 +508,7 @@ execute_process(COMMAND ${asn1c_call} ${F1AP_C_DIR} ${F1AP_ASN_FILES} if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${asn1c_call}: error") endif (NOT ${ret} STREQUAL 0) -execute_process(COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/38.473.PDU-Definitions.asn -o ${F1AP_C_DIR} +execute_process(COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn -o ${F1AP_C_DIR} RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "asn1tostruct.py: error") @@ -533,7 +533,7 @@ set(f1ap_h ${f1ap_h} ) #add_custom_command ( # OUTPUT ${F1AP_OAI_generated} # COMMAND ${asn1c_call} ${F1AP_C_DIR} ${F1AP_ASN_FILES} -# COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/38.473.PDU-Definitions.asn -o ${F1AP_C_DIR} +# COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn -o ${F1AP_C_DIR} # COMMAND ${fix_asn1c_call} ${F1AP_C_DIR} F1AP ${F1AP_VERSION} # DEPENDS ${F1AP_ASN_FILES} # ) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index da4b34f26d..9b5c932077 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -661,7 +661,7 @@ install_asn1c_from_source(){ $SUDO rm -rf /tmp/asn1c GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c cd /tmp/asn1c - git checkout master + git checkout master.aper git pull test -f configure || autoreconf -iv ./configure diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1 index 9d5d6a393e..5fbb3bdbe9 100755 --- a/cmake_targets/tools/fix_asn1 +++ b/cmake_targets/tools/fix_asn1 @@ -23,7 +23,7 @@ reset_color="$(tput sgr0)" function error() { echo -e "$red_color"ERROR: "$@""$reset_color" - #exit 1 +# exit 1 } function check_sha1() @@ -56,11 +56,11 @@ function patch_file() echo -e "$green_color""patch file $file with $OPENAIR_DIR/cmake_targets/tools/$patch""$reset_color" - patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch" - if [ $? -ne 0 ] - then - error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed" - fi +# patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch" +# if [ $? -ne 0 ] +# then +# error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed" +# fi } function apply_patches() diff --git a/cmake_targets/tools/generate_asn1 b/cmake_targets/tools/generate_asn1 index 79becbf288..1a9cb975ac 100755 --- a/cmake_targets/tools/generate_asn1 +++ b/cmake_targets/tools/generate_asn1 @@ -99,7 +99,7 @@ echo done with asnfix echo running asn1c -asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample +asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample rm -f fixed_grammar.asn @@ -107,7 +107,7 @@ echo asn1c done else -asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample +asn1c -gen-PER -fcompound-names -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample fi diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Common-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-CommonDataTypes.asn similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/38.473.Common-Definitions.asn rename to openair2/F1AP/MESSAGES/ASN1/R15/F1AP-CommonDataTypes.asn diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Constant-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Constants.asn similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/38.473.Constant-Definitions.asn rename to openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Constants.asn diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Container-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Containers.asn similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/38.473.Container-Definitions.asn rename to openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Containers.asn diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Information-Element-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-IEs.asn similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/38.473.Information-Element-Definitions.asn rename to openair2/F1AP/MESSAGES/ASN1/R15/F1AP-IEs.asn diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.PDU-Definitions.asn b/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-PDU-Contents.asn similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/38.473.PDU-Definitions.asn rename to openair2/F1AP/MESSAGES/ASN1/R15/F1AP-PDU-Contents.asn diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/38.473.Elementary-Procedures.asn b/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-PDU-Descriptions.asn similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/38.473.Elementary-Procedures.asn rename to openair2/F1AP/MESSAGES/ASN1/R15/F1AP-PDU-Descriptions.asn diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LITE/L2_interface.c index 91834d9c9d..8a5136792c 100644 --- a/openair2/RRC/LITE/L2_interface.c +++ b/openair2/RRC/LITE/L2_interface.c @@ -190,7 +190,7 @@ mac_rrc_data_req( if( (Srb_id & RAB_OFFSET ) == MIBCH) { mib->message.systemFrameNumber.buf = &sfn; - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, NULL, (void*)mib, carrier->MIB, 24); diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 77ba0c4cad..45b331a330 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -238,7 +238,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, NULL, (void*)mib, carrier->MIB, 24); @@ -445,7 +445,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, #ifdef XER_PRINT xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, NULL, (void*)bcch_message, buffer, 100); @@ -971,7 +971,7 @@ uint8_t do_SIB23(uint8_t Mod_id, #ifdef XER_PRINT xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, NULL, (void*)bcch_message, buffer, 900); @@ -1059,7 +1059,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.bits_unused = 7; - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message, NULL, (void*)&ul_ccch_msg, buffer, 100); @@ -1140,7 +1140,7 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.bits_unused=0; */ - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL, (void*)&ul_dcch_msg, buffer, 100); @@ -1200,7 +1200,7 @@ do_RRCConnectionReconfigurationComplete( RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8; rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL; - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL, (void*)&ul_dcch_msg, buffer, 100); @@ -1587,7 +1587,7 @@ do_RRCConnectionSetup( #ifdef XER_PRINT xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, NULL, (void*)&dl_ccch_msg, buffer, 100); @@ -1658,7 +1658,7 @@ do_SecurityModeCommand( #ifdef XER_PRINT xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, NULL, (void*)&dl_dcch_msg, buffer, 100); @@ -1734,7 +1734,7 @@ do_UECapabilityEnquiry( #ifdef XER_PRINT xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, NULL, (void*)&dl_dcch_msg, buffer, 100); @@ -1894,7 +1894,7 @@ do_RRCConnectionReconfiguration( rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.dedicatedInfoNASList = dedicatedInfoNASList; rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO = NULL; - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, NULL, (void*)&dl_dcch_msg, buffer, RRC_BUF_SIZE); @@ -2108,6 +2108,7 @@ do_RRCConnectionReestablishment( xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + NULL, (void*)&dl_ccch_msg, buffer, 100); @@ -2165,7 +2166,7 @@ do_RRCConnectionReestablishmentReject( #ifdef XER_PRINT xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, NULL, (void*)&dl_ccch_msg, buffer, 100); @@ -2224,7 +2225,7 @@ do_RRCConnectionReject( #ifdef XER_PRINT xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, NULL, (void*)&dl_ccch_msg, buffer, 100); @@ -2286,7 +2287,7 @@ uint8_t do_RRCConnectionRelease( rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension=CALLOC(1, sizeof(*rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension)); - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, NULL, (void*)&dl_dcch_msg, buffer, RRC_BUF_SIZE); @@ -2413,7 +2414,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, #ifdef XER_PRINT xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message, NULL, (void*)mcch_message, buffer, 100); @@ -2542,7 +2543,7 @@ 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); - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL, (void*)&ul_dcch_msg, buffer, 100); @@ -2676,7 +2677,7 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin LOG_D(RRC, "[eNB %d] do_Paging paging_record: cn_Domain %ld, ue_paging_identity.presenceMask %d, PagingRecordList.count %d\n", Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count); - enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, (void*)&pcch_msg, buffer, RRC_BUF_SIZE); + enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, NULL, (void*)&pcch_msg, buffer, RRC_BUF_SIZE); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); @@ -2848,7 +2849,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) #ifdef XER_PRINT xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability, + enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability, NULL, (void*)UE_EUTRA_Capability, &UECapability.sdu[0], MAX_UE_CAPABILITY_SIZE); diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c index 43721bbfd5..7583be251f 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c @@ -131,6 +131,7 @@ uint8_t do_MIB_NB_IoT( (uint32_t)hsfn_LSB); enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message_NB, + NULL, (void*)mib_NB_IoT, carrier->MIB_NB_IoT, 100); @@ -387,6 +388,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB, + NULL, (void*)bcch_message, carrier->SIB1_NB_IoT, 100); @@ -669,6 +671,7 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB, + NULL, (void*)bcch_message, carrier->SIB23_NB_IoT, 900); @@ -888,6 +891,7 @@ uint8_t do_RRCConnectionSetup_NB_IoT( xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + NULL, (void*)&dl_ccch_msg_NB_IoT, buffer, 100); @@ -939,6 +943,7 @@ uint8_t do_SecurityModeCommand_NB_IoT( xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, + NULL, (void*)&dl_dcch_msg_NB_IoT, buffer, 100); @@ -1000,6 +1005,7 @@ uint8_t do_UECapabilityEnquiry_NB_IoT( xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, + NULL, (void*)&dl_dcch_msg_NB_IoT, buffer, 100); @@ -1094,6 +1100,7 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT( rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.fullConfig_r13 = NULL; enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, + NULL, (void*)&dl_dcch_msg_NB_IoT, buffer, RRC_BUF_SIZE); @@ -1140,6 +1147,7 @@ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT( xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + NULL, (void*)&dl_ccch_msg_NB_IoT, buffer, 100); @@ -1210,6 +1218,7 @@ uint8_t do_RRCConnectionReject_NB_IoT( xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + NULL, (void*)&dl_ccch_msg_NB_IoT, buffer, 100); @@ -1336,6 +1345,7 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT( rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.nextHopChainingCount_r13=0; enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + NULL, (void*)&dl_ccch_msg_NB_IoT, buffer, RRC_BUF_SIZE); @@ -1405,6 +1415,7 @@ uint8_t do_RRCConnectionRelease_NB_IoT( sizeof(*rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension)); enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, + NULL, (void*)&dl_dcch_msg_NB_IoT, buffer, RRC_BUF_SIZE);//check diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 3edf230ac2..1ebfde3890 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -1739,7 +1739,7 @@ rrc_ue_process_securityModeCommand( LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d)\n", ctxt_pP->module_id,ctxt_pP->frame,eNB_index); - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL, (void*)&ul_dcch_msg, buffer, 100); @@ -1853,7 +1853,7 @@ rrc_ue_process_ueCapabilityEnquiry( &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list, &ue_CapabilityRAT_Container); - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100); + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", enc_rval.failed_type->name, enc_rval.encoded); diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 9faa686ef6..8bb244a34d 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -6886,8 +6886,8 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); if (ue_context_p->ue_context.UE_Capability) { LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti); - asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability, - ue_context_p->ue_context.UE_Capability, 0); + ASN_STRUCT_FREE(asn_DEF_UE_EUTRA_Capability, + ue_context_p->ue_context.UE_Capability); ue_context_p->ue_context.UE_Capability = 0; } dec_rval = uper_decode(NULL, @@ -6907,8 +6907,8 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), dec_rval.consumed); - asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability, - ue_context_p->ue_context.UE_Capability, 0); + ASN_STRUCT_FREE(asn_DEF_UE_EUTRA_Capability, + ue_context_p->ue_context.UE_Capability); ue_context_p->ue_context.UE_Capability = 0; } diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LITE/rrc_eNB_S1AP.c index 80ae1c9ba5..9c58a05b59 100644 --- a/openair2/RRC/LITE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LITE/rrc_eNB_S1AP.c @@ -680,7 +680,7 @@ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND( return; } - asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_UECapabilityInformation, ueCapabilityInformation, buf, 4096); + asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_UECapabilityInformation, NULL, ueCapabilityInformation, buf, 4096); if (ret.encoded == -1) abort(); memset(&rac, 0, sizeof(UERadioAccessCapabilityInformation_t)); @@ -694,7 +694,7 @@ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND( /* 8192 is arbitrary, should be big enough */ buf2 = malloc16(8192); if (buf2 == NULL) abort(); - ret = uper_encode_to_buffer(&asn_DEF_UERadioAccessCapabilityInformation, &rac, buf2, 8192); + ret = uper_encode_to_buffer(&asn_DEF_UERadioAccessCapabilityInformation, NULL, &rac, buf2, 8192); if (ret.encoded == -1) abort(); MessageDef *msg_p; diff --git a/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py b/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py index 4603e869a6..b5a141349b 100644 --- a/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py +++ b/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py @@ -253,15 +253,6 @@ for key in iesDefs: f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) f.write(" ANY_t *any_p);\n\n") - f.write("/* %s in iesDefs not in ieofielist.values() */\n" % (key)) - f.write("/** \\brief Compare function for %s ies.\n" % (key)) - f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower)) - f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower)) - f.write(" **/\n") - f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, keylowerunderscore)) - f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) - f.write(" %s_t *%s2);\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) - if len(iesDefs[key]["ies"]) == 0: continue @@ -298,13 +289,6 @@ for key in iesDefs: f.write("int %s_decode_%s(\n" % (fileprefix, firstlower.lower())) f.write(" %sIEs_t *%sIEs,\n" % (asn1cStruct, firstlower)) f.write(" %s_t *%s);\n\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct))) - f.write("/** \\brief Compare function for %s ies.\n" % (key)) - f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower)) - f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower)) - f.write(" **/\n") - f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, firstlower.lower())) - f.write(" %sIEs_t *%s1,\n" % (asn1cStruct, firstlower)) - f.write(" %sIEs_t *%s2);\n\n" % (asn1cStruct, firstlower)) @@ -634,19 +618,19 @@ xer_encode_local(asn_TYPE_descriptor_t *td, void *sptr, mname = td->xml_tag; mlen = strlen(mname); - _i_ASN_TEXT_INDENT(0, indent); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + ASN__TEXT_INDENT(0, indent); + ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); - tmper = td->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key); + tmper = td->op->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key); if(tmper.encoded == -1) return tmper; - _ASN_CALLBACK3("</", 2, mname, mlen, ">\\n", xcan); + ASN__CALLBACK3("</", 2, mname, mlen, ">\\n", xcan); er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded; - _ASN_ENCODED_OK(er); + ASN__ENCODED_OK(er); cb_failed: - _ASN_ENCODE_FAILED; + ASN__ENCODE_FAILED; } """) @@ -714,7 +698,7 @@ for (key, value) in iesDefs.items(): f.write(" cb(\" </%s>\\n\", %d, app_key);\n" % (key, len(" </%s>\n" % (key)))) f.write(" cb(\"</%s-PDU>\\n\", %d, app_key);\n" % (key, len("</%s-PDU>\n" % (key)))) - f.write(" _ASN_ENCODED_OK(er);\n") + f.write(" ASN__ENCODED_OK(er);\n") #if key not in ieofielist.values(): #f.write("cb_failed:\n") #f.write(" return er;\n") @@ -731,119 +715,6 @@ f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n" % (fileprefix, f.write("#include \"%s-ProtocolIE-ID.h\"\n\n" % (fileprefix_first_upper)) -for key in iesDefs: - if key in ieofielist.values(): - continue - structName = re.sub('ies', '', key) - asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key)) - asn1cStruct = re.sub('Item', 'List', asn1cStruct) - if asn1cStruct.rfind('_') == len(asn1cStruct) - 1: - asn1cStruct = asn1cStruct[:-1] - asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:] - firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct))) - - iesaccess = "" - if key not in ieofielist.values(): - iesaccess = "%s_ies." % (firstwordlower) - - keyName = re.sub('-', '_', key) - keyupperunderscore = keyName.upper() - # No IE to encode... - if len(iesDefs[key]["ies"]) == 0: - continue - - f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower()))) - f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) - f.write(" %s_t *%s2) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key)))) - - f.write(" asn_comp_rval_t *rv = NULL;\n\n") - f.write(" asn_comp_rval_t *rv2 = NULL;\n\n") - - f.write(" assert(%s1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key)))); - f.write(" assert(%s2 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key)))); - - loop = 0 - for ie in iesDefs[key]["ies"]: - iename = re.sub('-', '_', re.sub('id-', '', ie[0])) - ienameunderscore = re.sub('-', '_', iename) - ienamefirstwordlower = lowerFirstCamelWord(iename) - ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper() - ietypeunderscore = re.sub('-', '_', ie[2]) - - if ie[3] != "mandatory": - - loop = loop + 1 - if loop == 1: - #f.write(" %s_IE_t *ie1 = NULL;\n" % (fileprefix_first_upper)) - #f.write(" %s_IE_t *ie2 = NULL;\n" % (fileprefix_first_upper)) - f.write(" if (%s1->presenceMask != %s2->presenceMask) {rv=calloc(1,sizeof(asn_comp_rval_t));rv->name = asn_DEF_%s.name;rv->structure1 = %s1;rv->structure2 = %s2;rv->err_code = COMPARE_ERR_CODE_VALUE_NULL; return rv;}\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key)), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key)))) - - if ie[3] == "optional": - f.write(" /* Optional field */\n") - elif ie[3] == "conditional": - f.write(" /* Conditional field */\n") - f.write(" if (%s1->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore)) - - - if ie[2] in ieofielist.keys(): - f.write(" /* collection field */\n") - f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower )) - f.write(" if(rv2) {") - f.write(" if (NULL == rv) {") - f.write(" rv = rv2;") - f.write(" } else {") - f.write(" rv2->next = rv;") - f.write(" rv = rv2;") - f.write(" }") - f.write(" rv2 = NULL;") - f.write(" }") - else: - f.write(" /* simple field */\n") - f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s); \n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower )) - f.write(" if (rv2) {") - f.write(" if (NULL == rv) {") - f.write(" rv = rv2;") - f.write(" } else {") - f.write(" rv2->next = rv;") - f.write(" rv = rv2;") - f.write(" }") - f.write(" rv2 = NULL;") - f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;" % (ietypeunderscore)) - f.write(" }") - - f.write(" assert(0);\n"); - f.write(" }\n\n") - - else: - if ie[2] in ieofielist.keys(): - f.write(" /* Mandatory collection field */\n") - f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower )) - f.write(" if (rv2) {\n") - f.write(" if (NULL == rv) {\n") - f.write(" rv = rv2;\n") - f.write(" } else {\n") - f.write(" rv2->next = rv;\n") - f.write(" rv = rv2;\n") - f.write(" }\n") - f.write(" rv2 = NULL;\n") - f.write(" }\n") - - else: - f.write(" /* Mandatory simple field */\n") - f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower )) - f.write(" if(rv2) {\n") - f.write(" if (NULL == rv) {\n") - f.write(" rv = rv2;\n") - f.write(" } else {\n") - f.write(" rv2->next = rv;\n") - f.write(" rv = rv2;\n") - f.write(" }\n") - f.write(" rv2 = NULL;\n") - f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;\n" % (ietypeunderscore)) - f.write(" }\n") - f.write(" return rv;\n") - f.write("}\n\n") - for (key, value) in iesDefs.items(): if key not in ieofielist.values(): continue @@ -859,30 +730,3 @@ for (key, value) in iesDefs.items(): break f.write("extern asn_TYPE_descriptor_t asn_DEF_%s;\n" % (ietypeunderscore)) - - f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', i).lower())) - f.write(" %sIEs_t *%sIEs1,\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i)))) - f.write(" %sIEs_t *%sIEs2) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i)))) - f.write(" int i;\n") - f.write(" asn_comp_rval_t *rv = NULL;\n\n") - f.write(" asn_comp_rval_t *rv2 = NULL;\n\n") - - - f.write(" assert(%sIEs1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', i)))); - f.write(" assert(%sIEs2 != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i)))); - - f.write(" for (i = 0; i < %sIEs1->%s.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))))) - f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, %sIEs1->%s.array[i], &asn_DEF_%s, %sIEs2->%s.array[i]);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))))) - f.write(" if(rv2) {") - f.write(" if (NULL == rv) {") - f.write(" rv = rv2;") - f.write(" } else {") - f.write(" rv2->next = rv;") - f.write(" rv = rv2;") - f.write(" }") - f.write(" rv2 = NULL;") - f.write(" }") - f.write(" }\n") - f.write(" return rv;\n") - f.write("}\n\n") - -- GitLab From a21258ece77e80dd9b9069ead4da6fd8774d0e66 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 26 Jun 2018 10:58:46 +0200 Subject: [PATCH 016/308] Update the F1 messages and build scripts for proper generation of F1 messages --- .gitignore | 7 +++ cmake_targets/CMakeLists.txt | 46 ++++++++++--------- cmake_targets/build_oai | 12 +++-- cmake_targets/tools/build_helper | 15 ++++-- cmake_targets/tools/fix_asn1 | 19 ++++++++ .../{R15 => R15.1.1}/F1AP-CommonDataTypes.asn | 2 +- .../ASN1/{R15 => R15.1.1}/F1AP-Constants.asn | 4 +- .../ASN1/{R15 => R15.1.1}/F1AP-Containers.asn | 2 +- .../ASN1/{R15 => R15.1.1}/F1AP-IEs.asn | 2 +- .../{R15 => R15.1.1}/F1AP-PDU-Contents.asn | 0 .../F1AP-PDU-Descriptions.asn | 0 .../ASN1/{R15 => R15.1.1}/asn1_constants.h | 0 openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py | 2 +- 13 files changed, 76 insertions(+), 35 deletions(-) create mode 100644 .gitignore rename openair2/F1AP/MESSAGES/ASN1/{R15 => R15.1.1}/F1AP-CommonDataTypes.asn (99%) mode change 100755 => 100644 rename openair2/F1AP/MESSAGES/ASN1/{R15 => R15.1.1}/F1AP-Constants.asn (99%) mode change 100755 => 100644 rename openair2/F1AP/MESSAGES/ASN1/{R15 => R15.1.1}/F1AP-Containers.asn (99%) mode change 100755 => 100644 rename openair2/F1AP/MESSAGES/ASN1/{R15 => R15.1.1}/F1AP-IEs.asn (99%) mode change 100755 => 100644 rename openair2/F1AP/MESSAGES/ASN1/{R15 => R15.1.1}/F1AP-PDU-Contents.asn (100%) mode change 100755 => 100644 rename openair2/F1AP/MESSAGES/ASN1/{R15 => R15.1.1}/F1AP-PDU-Descriptions.asn (100%) mode change 100755 => 100644 rename openair2/F1AP/MESSAGES/ASN1/{R15 => R15.1.1}/asn1_constants.h (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..35696f4cbf --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# vim swp +*.swp + +# log and exec file +log/ +lte_build_oai/ +targets/bin/ diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 4d154fc34e..ecf03c81ca 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -507,11 +507,13 @@ include_directories ("${X2AP_DIR}") # Same limitation as described in RRC/S1AP: unknown generated file list # so we generate it at cmake time ############## -add_list1_option(F1AP_VERSION R15 "F1AP Asn.1 grammar version" R15) +add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15) set(F1AP_DIR ${OPENAIR2_DIR}/F1AP) -#if (${F1AP_VERSION} STREQUAL "R15") - set (ASN1RELDIR R15) -#endif(${F1AP_VERSION} STREQUAL "R15") +if (${F1AP_RELEASE} STREQUAL "R15") + make_version(F1AP_VERSION 15 1 1) + set (ASN1RELDIR R15.1.1) +endif(${F1AP_RELEASE} STREQUAL "R15") +add_definitions(-DF1AP_VERSION=${F1AP_VERSION}) set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) set(F1AP_ASN_FILES ${F1AP_ASN_DIR}/F1AP-CommonDataTypes.asn @@ -522,22 +524,24 @@ set(F1AP_ASN_FILES ${F1AP_ASN_DIR}/F1AP-Containers.asn ) -set(F1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR}) +set(F1AP_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR}) +set(ENV{ASN1C_PREFIX} F1AP_) execute_process(COMMAND ${asn1c_call} ${F1AP_C_DIR} ${F1AP_ASN_FILES} - RESULT_VARIABLE ret) + RESULT_VARIABLE reti) +unset(ENV{ASN1C_PREFIX}) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${asn1c_call}: error") endif (NOT ${ret} STREQUAL 0) -execute_process(COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn -o ${F1AP_C_DIR} - RESULT_VARIABLE ret) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "asn1tostruct.py: error") -endif (NOT ${ret} STREQUAL 0) -execute_process(COMMAND ${fix_asn1c_call} ${F1AP_C_DIR} F1AP ${F1AP_VERSION} - RESULT_VARIABLE ret) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${fix_asn1c_call}: error") -endif (NOT ${ret} STREQUAL 0) +#execute_process(COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn -o ${F1AP_C_DIR} +# RESULT_VARIABLE ret) +#if (NOT ${ret} STREQUAL 0) +# message(FATAL_ERROR "asn1tostruct.py: error") +#endif (NOT ${ret} STREQUAL 0) +#execute_process(COMMAND ${fix_asn1c_call} ${F1AP_C_DIR} F1AP ${F1AP_VERSION} +# RESULT_VARIABLE ret) +#if (NOT ${ret} STREQUAL 0) +# message(FATAL_ERROR "${fix_asn1c_call}: error") +#endif (NOT ${ret} STREQUAL 0) file(GLOB F1AP_source ${F1AP_C_DIR}/*.c) #set(F1AP_OAI_generated @@ -907,8 +911,8 @@ set(FLPT_MSG_FILES ${FLPT_MSG_DIR}/control_delegation.proto ) -set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR}) -message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}") +set(FLPT_C_DIR ${protobuf_generated_dir}/FLPT_${FLPTDIR}) +#message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}") execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES}) file(GLOB FLPT_source ${FLPT_C_DIR}/*.c) set(FLPT_OAI_generated @@ -988,10 +992,10 @@ if (PDCP_SPLIT) ${FSPT_MSG_DIR}/flexsplit.proto ) - set(FSPT_C_DIR ${protobuf_generated_dir}/${FSPTDIR}) - message("calling protoc_call=${protoc_call} FSPT_C_DIR=${FSPT_C_DIR} FSPT_MSG_FILES=${FSPT_MSG_FILES}") + set(FSPT_C_DIR ${protobuf_generated_dir}/FSPT_${FSPTDIR}) + message("calling protoc_call=${protoc_call} FSPT_C_DIR=${FSPT_C_DIR} FSPT_MSG_DIR=${FSPT_MSG_DIR} FSPT_MSG_FILES=${FSPT_MSG_FILES}") execute_process(COMMAND ${protoc_call} ${FSPT_C_DIR} ${FSPT_MSG_DIR} ${FSPT_MSG_FILES}) - file(GLOB FSPT_source ${FSPT_C_DIR}/*.c) + file(GLOB FSPT_source ${FSPT_C_DIR}/*.c) set(FSPT_OAI_generated ${FSPT_C_DIR}/flexsplit.pb-c.c ) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 60bf3951c2..743b1a53b5 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -105,6 +105,10 @@ Options Enables agent for software-defined control of the eNB --pdcp-split Enables PDCP-RLC U plane split +--CU + Build the CU entity +--DU + Build the CU entity -r | --3gpp-release default is Rel14, Rel8 limits the implementation to 3GPP Release 8 version @@ -214,9 +218,11 @@ function main() { -a | --agent) echo_info "FlexRAN support is always compiled into the eNB" shift;; - --pdcp-split) + --pdcp-split | --CU | --DU ) PDCP_SPLIT=1 - echo_info "Will compile PDCP-RLC U plane split support" + CU=1 + DU=1 + echo_info "Will compile for $1 with F1AP support " shift;; --UE) UE=1 @@ -473,7 +479,7 @@ function main() { if [ "$INSTALL_EXTERNAL" = "1" ] ; then echo_info "Installing packages" - check_install_oai_software + check_install_oai_software $PDCP_SPLIT if [ "$HW" == "OAI_USRP" ] ; then echo_info "installing packages for USRP support" check_install_usrp_uhd_driver diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 0270556b88..1f9ca5cd82 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -567,7 +567,8 @@ check_install_oai_software() { pydb \ libyaml-dev \ wget \ - libxpm-dev + libxpm-dev \ + libboost-all-dev $SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET" @@ -653,7 +654,7 @@ check_install_oai_software() { libyaml-devel fi - install_asn1c_from_source + install_asn1c_from_source $1 $SUDO rm -fr /opt/ssh $SUDO git clone https://gist.github.com/2190472.git /opt/ssh } @@ -663,10 +664,14 @@ install_asn1c_from_source(){ echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log " ( $SUDO rm -rf /tmp/asn1c - GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c + if [ $1 -eq "1" ]; then + echo "building ASN1C from https://github.com/brchiu/asn1c branch" + GIT_SSL_NO_VERIFY=true git clone https://github.com/brchiu/asn1c.git --branch velichkov_s1ap_plus_option_group /tmp/asn1c + else + echo "building ASN1C from https://gitlab.eurecom.fr/oai/asn1c branch" + GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git --branch master.aper /tmp/asn1c + fi cd /tmp/asn1c - git checkout master.aper - git pull test -f configure || autoreconf -iv ./configure make -j`nproc` diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1 index 5fbb3bdbe9..1486589a0c 100755 --- a/cmake_targets/tools/fix_asn1 +++ b/cmake_targets/tools/fix_asn1 @@ -140,6 +140,22 @@ function patch_s1ap() esac } +function patch_f1ap() +{ + local directory="$1" + local version="$2" + + case "$version" in + R15 ) + #nothing to do anymore (fixes went to asn1c) + ;; + * ) + error unknwon/unhandled F1AP version \'"$version"\' + ;; + esac +} + + function main() { if [ $# -ne 3 ] @@ -167,6 +183,9 @@ function main() S1AP ) patch_s1ap "$directory" "$version" ;; + F1AP ) + patch_f1ap "$directory" "$version" + ;; * ) error unknown module "$module" ;; diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-CommonDataTypes.asn b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-CommonDataTypes.asn old mode 100755 new mode 100644 similarity index 99% rename from openair2/F1AP/MESSAGES/ASN1/R15/F1AP-CommonDataTypes.asn rename to openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-CommonDataTypes.asn index 12dfbd12ff..3e4e417845 --- a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-CommonDataTypes.asn +++ b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-CommonDataTypes.asn @@ -29,4 +29,4 @@ ProtocolIE-ID ::= INTEGER (0..65535) TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessfull-outcome } -END +END \ No newline at end of file diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Constants.asn b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-Constants.asn old mode 100755 new mode 100644 similarity index 99% rename from openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Constants.asn rename to openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-Constants.asn index 4ec60632f0..6840b00bf4 --- a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Constants.asn +++ b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-Constants.asn @@ -157,7 +157,7 @@ id-SRBs-ToBeSetup-Item ProtocolIE-ID ::= 73 id-SRBs-ToBeSetup-List ProtocolIE-ID ::= 74 id-SRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 75 id-SRBs-ToBeSetupMod-List ProtocolIE-ID ::= 76 -id-TimeToWait ProtocolIE-ID ::= 75 +id-TimeToWait ProtocolIE-ID ::= 77 id-TransactionID ProtocolIE-ID ::= 78 id-TransmissionStopIndicator ProtocolIE-ID ::= 79 id-UE-associatedLogicalF1-ConnectionItem ProtocolIE-ID ::= 80 @@ -176,4 +176,4 @@ id-Potential-SpCell-List ProtocolIE-ID ::= 92 id-Potential-SpCell-Item ProtocolIE-ID ::= 93 -END +END \ No newline at end of file diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Containers.asn b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-Containers.asn old mode 100755 new mode 100644 similarity index 99% rename from openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Containers.asn rename to openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-Containers.asn index ed5dfba961..52c09d156a --- a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-Containers.asn +++ b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-Containers.asn @@ -181,4 +181,4 @@ PrivateIE-Field {F1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { value F1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) } -END +END \ No newline at end of file diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-IEs.asn b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-IEs.asn old mode 100755 new mode 100644 similarity index 99% rename from openair2/F1AP/MESSAGES/ASN1/R15/F1AP-IEs.asn rename to openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-IEs.asn index 672407d851..4a0d2abdff --- a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-IEs.asn +++ b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-IEs.asn @@ -867,4 +867,4 @@ ULTunnels-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { -- Z -END +END \ No newline at end of file diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-PDU-Contents.asn b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-PDU-Contents.asn old mode 100755 new mode 100644 similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/F1AP-PDU-Contents.asn rename to openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-PDU-Contents.asn diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/F1AP-PDU-Descriptions.asn b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-PDU-Descriptions.asn old mode 100755 new mode 100644 similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/F1AP-PDU-Descriptions.asn rename to openair2/F1AP/MESSAGES/ASN1/R15.1.1/F1AP-PDU-Descriptions.asn diff --git a/openair2/F1AP/MESSAGES/ASN1/R15/asn1_constants.h b/openair2/F1AP/MESSAGES/ASN1/R15.1.1/asn1_constants.h similarity index 100% rename from openair2/F1AP/MESSAGES/ASN1/R15/asn1_constants.h rename to openair2/F1AP/MESSAGES/ASN1/R15.1.1/asn1_constants.h diff --git a/openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py b/openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py index 8c0f7e8a16..b5f019f486 100644 --- a/openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py +++ b/openair2/F1AP/MESSAGES/ASN1/asn1tostruct.py @@ -132,7 +132,7 @@ for filename in filenames: for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+E-RAB-IE-ContainerList\s*\{\s*\{\s*([a-zA-Z0-9-]+)\s*\}\s*\}', lines, re.MULTILINE): ieofielist[m[0]] = m[1] - for i in re.findall(r'([a-zA-Z0-9-]+)\s+([A-Z0-9-]+)\s*::=\s*\{\s+([\,\|\{\}\t\n\.{3}\ \-a-zA-Z0-9]+)\s+}\n', lines, re.MULTILINE): + for i in re.findall(r'([a-zA-Z0-9-]+)\s+([A-Z0-9-]+)\s*::=\s*\{\s+([\,\|\{\}\t\n\.{3}\ \-a-zA-Z0-9]+)\s+}\n?', lines, re.MULTILINE): ies = [] maxLength = 0 # TODO: handle extensions -- GitLab From b797dafdc67689808191015d0b2b344d0b2a75a0 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 28 Aug 2018 14:52:46 +0200 Subject: [PATCH 017/308] 1.Update the F1 messages with F1AP spec R15.2.1 and build scripts for proper generation of F1 messages 2.Add SCTP procedure (without ITTI) with F1AP 3.Add F1AP test code --- cmake_targets/CMakeLists.txt | 85 +- cmake_targets/tools/generate_asn1 | 62 +- common/utils/LOG/log.h | 1 + common/utils/T/T_IDs.h | 546 ++++++ openair2/COMMON/f1ap_messages_def.h | 77 + openair2/COMMON/f1ap_messages_types.h | 646 +++++++ openair2/F1AP/CU_F1AP.c | 1494 ++++++++++++++++ openair2/F1AP/DU_F1AP.c | 1506 ++++++++++++++++ .../ASN1/R15.2.1/F1AP-CommonDataTypes.asn | 32 + .../MESSAGES/ASN1/R15.2.1/F1AP-Constants.asn | 256 +++ .../MESSAGES/ASN1/R15.2.1/F1AP-Containers.asn | 184 ++ .../F1AP/MESSAGES/ASN1/R15.2.1/F1AP-IEs.asn | 1441 +++++++++++++++ .../ASN1/R15.2.1/F1AP-PDU-Contents.asn | 1578 +++++++++++++++++ .../ASN1/R15.2.1/F1AP-PDU-Descriptions.asn | 353 ++++ openair2/F1AP/f1ap_common.c | 199 +++ openair2/F1AP/f1ap_common.h | 483 +++++ openair2/F1AP/f1ap_decoder.c | 235 +++ openair2/F1AP/f1ap_decoder.h | 42 + openair2/F1AP/f1ap_default_values.h | 46 + openair2/F1AP/f1ap_encoder.c | 382 ++++ openair2/F1AP/f1ap_encoder.h | 39 + openair2/F1AP/f1ap_handlers.c | 1381 +++++++++++++++ openair2/F1AP/f1ap_handlers.h | 41 + openair2/F1AP/f1ap_messaging.c | 88 + openair2/F1AP/f1ap_messaging.h | 50 + openair2/F1AP/sctp_cu.c | 123 ++ openair2/F1AP/sctp_du.c | 139 ++ openair2/F1AP/test_f1ap_cu.c | 11 + openair2/F1AP/test_f1ap_du.c | 5 + openair3/UTILS/conversions.h | 31 + 30 files changed, 11494 insertions(+), 62 deletions(-) create mode 100644 common/utils/T/T_IDs.h create mode 100644 openair2/COMMON/f1ap_messages_def.h create mode 100644 openair2/COMMON/f1ap_messages_types.h create mode 100644 openair2/F1AP/CU_F1AP.c create mode 100644 openair2/F1AP/DU_F1AP.c create mode 100644 openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-CommonDataTypes.asn create mode 100644 openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-Constants.asn create mode 100644 openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-Containers.asn create mode 100644 openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-IEs.asn create mode 100644 openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-PDU-Contents.asn create mode 100644 openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-PDU-Descriptions.asn create mode 100644 openair2/F1AP/f1ap_common.c create mode 100644 openair2/F1AP/f1ap_common.h create mode 100644 openair2/F1AP/f1ap_decoder.c create mode 100644 openair2/F1AP/f1ap_decoder.h create mode 100644 openair2/F1AP/f1ap_default_values.h create mode 100644 openair2/F1AP/f1ap_encoder.c create mode 100644 openair2/F1AP/f1ap_encoder.h create mode 100644 openair2/F1AP/f1ap_handlers.c create mode 100644 openair2/F1AP/f1ap_handlers.h create mode 100644 openair2/F1AP/f1ap_messaging.c create mode 100644 openair2/F1AP/f1ap_messaging.h create mode 100644 openair2/F1AP/sctp_cu.c create mode 100644 openair2/F1AP/sctp_du.c create mode 100644 openair2/F1AP/test_f1ap_cu.c create mode 100644 openair2/F1AP/test_f1ap_du.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 8c2aaa8cb3..3b22302133 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -170,7 +170,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ") # add autotools definitions that were maybe used! set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -DASN_DISABLE_OER_SUPPORT -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'" + "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 " @@ -478,15 +478,13 @@ include_directories ("${X2AP_DIR}") -#F1AP -# Same limitation as described in RRC/S1AP: unknown generated file list -# so we generate it at cmake time +# F1AP ############## add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15) set(F1AP_DIR ${OPENAIR2_DIR}/F1AP) if (${F1AP_RELEASE} STREQUAL "R15") - make_version(F1AP_VERSION 15 1 1) - set (ASN1RELDIR R15.1.1) + make_version(F1AP_VERSION 15 2 1) + set (ASN1RELDIR R15.2.1) endif(${F1AP_RELEASE} STREQUAL "R15") add_definitions(-DF1AP_VERSION=${F1AP_VERSION}) set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) @@ -507,47 +505,53 @@ unset(ENV{ASN1C_PREFIX}) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${asn1c_call}: error") endif (NOT ${ret} STREQUAL 0) -#execute_process(COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn -o ${F1AP_C_DIR} -# RESULT_VARIABLE ret) -#if (NOT ${ret} STREQUAL 0) -# message(FATAL_ERROR "asn1tostruct.py: error") -#endif (NOT ${ret} STREQUAL 0) -#execute_process(COMMAND ${fix_asn1c_call} ${F1AP_C_DIR} F1AP ${F1AP_VERSION} -# RESULT_VARIABLE ret) -#if (NOT ${ret} STREQUAL 0) -# message(FATAL_ERROR "${fix_asn1c_call}: error") -#endif (NOT ${ret} STREQUAL 0) file(GLOB F1AP_source ${F1AP_C_DIR}/*.c) #set(F1AP_OAI_generated -# ${X2AP_C_DIR}/x2ap_decoder.c -# ${X2AP_C_DIR}/x2ap_encoder.c -# ${X2AP_C_DIR}/x2ap_xer_print.c -# ${X2AP_C_DIR}/x2ap_ies_defs.h +# ${F1AP_C_DIR}/per_decoder.c +# ${F1AP_C_DIR}/per_encoder.c + #${F1AP_C_DIR}/f1ap_xer_print.c +# ${F1AP_C_DIR}/F1AP_ProtocolIE-Field.h # ) + file(GLOB f1ap_h ${F1AP_C_DIR}/*.h) set(f1ap_h ${f1ap_h} ) -##message("calling ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}") -#add_custom_command ( -# OUTPUT ${F1AP_OAI_generated} -# COMMAND ${asn1c_call} ${F1AP_C_DIR} ${F1AP_ASN_FILES} -# COMMAND python ${F1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn -o ${F1AP_C_DIR} -# COMMAND ${fix_asn1c_call} ${F1AP_C_DIR} F1AP ${F1AP_VERSION} -# DEPENDS ${F1AP_ASN_FILES} -# ) - add_library(F1AP_LIB - ${F1AP_OAI_generated} + #${F1AP_OAI_generated} + #${f1ap_h} ${F1AP_source} -# ${F1AP_DIR}/f1ap_common.c ) include_directories ("${F1AP_C_DIR}") include_directories ("${F1AP_DIR}") +add_library(F1AP + #${F1AP_DIR}/test.c + ${F1AP_DIR}/DU_F1AP.c + ${F1AP_DIR}/CU_F1AP.c + ) +add_executable(test_f1ap_du + ${F1AP_DIR}/test_f1ap_du.c + ${F1AP_DIR}/DU_F1AP.c + ${F1AP_DIR}/sctp_du.c + ) + +target_link_libraries(test_f1ap_du + -Wl,--start-group F1AP_LIB sctp pthread -Wl,--end-group + ) + +add_executable(test_f1ap_cu + ${F1AP_DIR}/test_f1ap_cu.c + ${F1AP_DIR}/CU_F1AP.c + ${F1AP_DIR}/sctp_cu.c + ) + +target_link_libraries(test_f1ap_cu + -Wl,--start-group F1AP_LIB sctp pthread -Wl,--end-group + ) # Hardware dependant options ################################### @@ -832,6 +836,7 @@ include_directories("${OPENAIR3_DIR}/SECU") include_directories("${OPENAIR3_DIR}/SCTP") include_directories("${OPENAIR3_DIR}/S1AP") include_directories("${OPENAIR2_DIR}/X2AP") +include_directories("${OPENAIR2_DIR}/F1AP") include_directories("${OPENAIR3_DIR}/UDP") include_directories("${OPENAIR3_DIR}/GTPV1-U") include_directories("${OPENAIR_DIR}/targets/COMMON") @@ -2049,6 +2054,8 @@ add_definitions(-DASN1_MINIMUM_VERSION=924) add_executable(lte-softmodem ${rrc_h} ${s1ap_h} + ${f1ap_h} + #${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c @@ -2073,7 +2080,7 @@ add_executable(lte-softmodem target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 + RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7 NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl) @@ -2088,6 +2095,8 @@ target_link_libraries (lte-softmodem ${T_LIB}) add_executable(lte-softmodem-nos1 ${rrc_h} ${s1ap_h} + ${f1ap_h} + #${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c @@ -2126,6 +2135,8 @@ target_link_libraries (lte-softmodem-nos1 ${T_LIB}) add_executable(lte-uesoftmodem ${rrc_h} ${s1ap_h} + ${f1ap_h} + #${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c @@ -2149,7 +2160,7 @@ add_executable(lte-uesoftmodem target_link_libraries (lte-uesoftmodem -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU + RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl) @@ -2164,6 +2175,8 @@ target_link_libraries (lte-uesoftmodem ${T_LIB}) add_executable(lte-uesoftmodem-nos1 ${rrc_h} ${s1ap_h} + ${f1ap_h} +# ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c @@ -2266,7 +2279,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 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 F1AP_LIB F1AP 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 @@ -2286,7 +2299,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 GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE 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 F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE 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} ) @@ -2322,7 +2335,7 @@ if (${T_TRACER}) dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim ulsim #all "add_library" definitions - ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB + ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB F1AP_LIB F1AP oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_eth_transpro FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA diff --git a/cmake_targets/tools/generate_asn1 b/cmake_targets/tools/generate_asn1 index 1a9cb975ac..b382730c6a 100755 --- a/cmake_targets/tools/generate_asn1 +++ b/cmake_targets/tools/generate_asn1 @@ -2,23 +2,29 @@ function main() { -mkdir -p $1 -cd $1 +PROTOCOL_DIR=$1 +mkdir -p ${PROTOCOL_DIR} +cd ${PROTOCOL_DIR} + +# Because use $* also include directory, so we need shift shift -#if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC -#(there may be a better way...) -if [ $# -eq 1 ]; then +# There are three types parameter for asn1c +# One is for RRC +# and one is for F1AP +# another is for other protocols + +if echo ${PROTOCOL_DIR} | grep -q "RRC"; then -#asn1c does not work well with extension groups, we need the following fix: -# replace [[ by '<name> SEQUENCE {' -# and ]] by '} OPTIONAL' -#<name> is ext<N> with N starting from 1 and incremented at each new [[ ]] just -#following another [[ ]] -# -#this is what the following C program does + #asn1c does not work well with extension groups, we need the following fix: + # replace [[ by '<name> SEQUENCE {' + # and ]] by '} OPTIONAL' + #<name> is ext<N> with N starting from 1 and incremented at each new [[ ]] just + #following another [[ ]] + # + #this is what the following C program does -echo generate asnfix.c + echo generate asnfix.c cat << EOF > asnfix.c /* transforms: @@ -85,30 +91,34 @@ int main(void) } EOF -echo compile asnfix.c + echo compile asnfix.c -gcc -Wall -o asnfix asnfix.c + gcc -Wall -o asnfix asnfix.c -echo run asnfix on $1 + echo run asnfix on $1 -./asnfix < $1 > fixed_grammar.asn + ./asnfix < $1 > fixed_grammar.asn -rm -f asnfix asnfix.c + rm -f asnfix asnfix.c -echo done with asnfix + echo done with asnfix -echo running asn1c + echo running asn1c -asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample -rm -f fixed_grammar.asn + rm -f fixed_grammar.asn -echo asn1c done + echo asn1c done +elif echo ${PROTOCOL_DIR} | grep -q "F1AP"; then + + asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + else - -asn1c -gen-PER -fcompound-names -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample - + + asn1c -gen-PER -fcompound-names -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + fi awk ' diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index de4a926c7a..7354c32c7d 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -173,6 +173,7 @@ typedef enum { GTPU, SPGW, S1AP, + F1AP, SCTP, HW, OSA, diff --git a/common/utils/T/T_IDs.h b/common/utils/T/T_IDs.h new file mode 100644 index 0000000000..58b4307518 --- /dev/null +++ b/common/utils/T/T_IDs.h @@ -0,0 +1,546 @@ +/* generated file, do not edit by hand */ + +#define T_ENB_MASTER_TICK T_ID(0) +#define T_ENB_PHY_UL_TICK T_ID(1) +#define T_ENB_PHY_DL_TICK T_ID(2) +#define T_ENB_PHY_DLSCH_UE_DCI T_ID(3) +#define T_ENB_PHY_DLSCH_UE_ACK T_ID(4) +#define T_ENB_PHY_DLSCH_UE_NACK T_ID(5) +#define T_ENB_PHY_ULSCH_UE_DCI T_ID(6) +#define T_ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION T_ID(7) +#define T_ENB_PHY_ULSCH_UE_ACK T_ID(8) +#define T_ENB_PHY_ULSCH_UE_NACK T_ID(9) +#define T_ENB_PHY_INPUT_SIGNAL T_ID(10) +#define T_ENB_PHY_OUTPUT_SIGNAL T_ID(11) +#define T_ENB_PHY_UL_CHANNEL_ESTIMATE T_ID(12) +#define T_ENB_PHY_PUSCH_IQ T_ID(13) +#define T_ENB_PHY_PUCCH_1AB_IQ T_ID(14) +#define T_ENB_PHY_PUCCH_1_ENERGY T_ID(15) +#define T_ENB_PHY_PHICH T_ID(16) +#define T_ENB_PHY_MSG3_ALLOCATION T_ID(17) +#define T_ENB_PHY_INITIATE_RA_PROCEDURE T_ID(18) +#define T_ENB_MAC_UE_DL_SDU T_ID(19) +#define T_ENB_MAC_UE_UL_SCHEDULE T_ID(20) +#define T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION T_ID(21) +#define T_ENB_MAC_UE_UL_PDU T_ID(22) +#define T_ENB_MAC_UE_UL_PDU_WITH_DATA T_ID(23) +#define T_ENB_MAC_UE_UL_SDU T_ID(24) +#define T_ENB_MAC_UE_UL_SDU_WITH_DATA T_ID(25) +#define T_ENB_MAC_UE_UL_CE T_ID(26) +#define T_ENB_MAC_UE_DL_PDU_WITH_DATA T_ID(27) +#define T_ENB_MAC_SCHEDULING_REQUEST T_ID(28) +#define T_ENB_RLC_DL T_ID(29) +#define T_ENB_RLC_UL T_ID(30) +#define T_ENB_RLC_MAC_DL T_ID(31) +#define T_ENB_RLC_MAC_UL T_ID(32) +#define T_ENB_PDCP_UL T_ID(33) +#define T_ENB_PDCP_DL T_ID(34) +#define T_ENB_RRC_CONNECTION_SETUP_COMPLETE T_ID(35) +#define T_ENB_RRC_SECURITY_MODE_COMMAND T_ID(36) +#define T_ENB_RRC_SECURITY_MODE_COMPLETE T_ID(37) +#define T_ENB_RRC_SECURITY_MODE_FAILURE T_ID(38) +#define T_ENB_RRC_UE_CAPABILITY_ENQUIRY T_ID(39) +#define T_ENB_RRC_UE_CAPABILITY_INFORMATION T_ID(40) +#define T_ENB_RRC_CONNECTION_REQUEST T_ID(41) +#define T_ENB_RRC_CONNECTION_REJECT T_ID(42) +#define T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST T_ID(43) +#define T_ENB_RRC_CONNECTION_REESTABLISHMENT T_ID(44) +#define T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE T_ID(45) +#define T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT T_ID(46) +#define T_ENB_RRC_CONNECTION_RELEASE T_ID(47) +#define T_ENB_RRC_CONNECTION_RECONFIGURATION T_ID(48) +#define T_ENB_RRC_MEASUREMENT_REPORT T_ID(49) +#define T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION T_ID(50) +#define T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE T_ID(51) +#define T_ENB_RRC_CONNECTION_SETUP T_ID(52) +#define T_ENB_RRC_UL_CCCH_DATA_IN T_ID(53) +#define T_ENB_RRC_UL_DCCH_DATA_IN T_ID(54) +#define T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER T_ID(55) +#define T_ENB_RRC_UL_INFORMATION_TRANSFER T_ID(56) +#define T_ENB_RRC_COUNTER_CHECK_RESPONSE T_ID(57) +#define T_ENB_RRC_UE_INFORMATION_RESPONSE_R9 T_ID(58) +#define T_ENB_RRC_PROXIMITY_INDICATION_R9 T_ID(59) +#define T_ENB_RRC_RECONFIGURATION_COMPLETE_R10 T_ID(60) +#define T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10 T_ID(61) +#define T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION T_ID(62) +#define T_ENB_RRC_UNKNOW_MESSAGE T_ID(63) +#define T_LEGACY_MAC_INFO T_ID(64) +#define T_LEGACY_MAC_ERROR T_ID(65) +#define T_LEGACY_MAC_WARNING T_ID(66) +#define T_LEGACY_MAC_DEBUG T_ID(67) +#define T_LEGACY_MAC_TRACE T_ID(68) +#define T_LEGACY_PHY_INFO T_ID(69) +#define T_LEGACY_PHY_ERROR T_ID(70) +#define T_LEGACY_PHY_WARNING T_ID(71) +#define T_LEGACY_PHY_DEBUG T_ID(72) +#define T_LEGACY_PHY_TRACE T_ID(73) +#define T_LEGACY_S1AP_INFO T_ID(74) +#define T_LEGACY_S1AP_ERROR T_ID(75) +#define T_LEGACY_S1AP_WARNING T_ID(76) +#define T_LEGACY_S1AP_DEBUG T_ID(77) +#define T_LEGACY_S1AP_TRACE T_ID(78) +#define T_LEGACY_X2AP_INFO T_ID(79) +#define T_LEGACY_X2AP_ERROR T_ID(80) +#define T_LEGACY_X2AP_WARNING T_ID(81) +#define T_LEGACY_X2AP_DEBUG T_ID(82) +#define T_LEGACY_X2AP_TRACE T_ID(83) +#define T_LEGACY_RRC_INFO T_ID(84) +#define T_LEGACY_RRC_ERROR T_ID(85) +#define T_LEGACY_RRC_WARNING T_ID(86) +#define T_LEGACY_RRC_DEBUG T_ID(87) +#define T_LEGACY_RRC_TRACE T_ID(88) +#define T_LEGACY_RLC_INFO T_ID(89) +#define T_LEGACY_RLC_ERROR T_ID(90) +#define T_LEGACY_RLC_WARNING T_ID(91) +#define T_LEGACY_RLC_DEBUG T_ID(92) +#define T_LEGACY_RLC_TRACE T_ID(93) +#define T_LEGACY_PDCP_INFO T_ID(94) +#define T_LEGACY_PDCP_ERROR T_ID(95) +#define T_LEGACY_PDCP_WARNING T_ID(96) +#define T_LEGACY_PDCP_DEBUG T_ID(97) +#define T_LEGACY_PDCP_TRACE T_ID(98) +#define T_LEGACY_ENB_APP_INFO T_ID(99) +#define T_LEGACY_ENB_APP_ERROR T_ID(100) +#define T_LEGACY_ENB_APP_WARNING T_ID(101) +#define T_LEGACY_ENB_APP_DEBUG T_ID(102) +#define T_LEGACY_ENB_APP_TRACE T_ID(103) +#define T_LEGACY_FLEXRAN_AGENT_INFO T_ID(104) +#define T_LEGACY_FLEXRAN_AGENT_ERROR T_ID(105) +#define T_LEGACY_FLEXRAN_AGENT_WARNING T_ID(106) +#define T_LEGACY_FLEXRAN_AGENT_DEBUG T_ID(107) +#define T_LEGACY_FLEXRAN_AGENT_TRACE T_ID(108) +#define T_LEGACY_SCTP_INFO T_ID(109) +#define T_LEGACY_SCTP_ERROR T_ID(110) +#define T_LEGACY_SCTP_WARNING T_ID(111) +#define T_LEGACY_SCTP_DEBUG T_ID(112) +#define T_LEGACY_SCTP_TRACE T_ID(113) +#define T_LEGACY_UDP__INFO T_ID(114) +#define T_LEGACY_UDP__ERROR T_ID(115) +#define T_LEGACY_UDP__WARNING T_ID(116) +#define T_LEGACY_UDP__DEBUG T_ID(117) +#define T_LEGACY_UDP__TRACE T_ID(118) +#define T_LEGACY_NAS_INFO T_ID(119) +#define T_LEGACY_NAS_ERROR T_ID(120) +#define T_LEGACY_NAS_WARNING T_ID(121) +#define T_LEGACY_NAS_DEBUG T_ID(122) +#define T_LEGACY_NAS_TRACE T_ID(123) +#define T_LEGACY_HW_INFO T_ID(124) +#define T_LEGACY_HW_ERROR T_ID(125) +#define T_LEGACY_HW_WARNING T_ID(126) +#define T_LEGACY_HW_DEBUG T_ID(127) +#define T_LEGACY_HW_TRACE T_ID(128) +#define T_LEGACY_EMU_INFO T_ID(129) +#define T_LEGACY_EMU_ERROR T_ID(130) +#define T_LEGACY_EMU_WARNING T_ID(131) +#define T_LEGACY_EMU_DEBUG T_ID(132) +#define T_LEGACY_EMU_TRACE T_ID(133) +#define T_LEGACY_OTG_INFO T_ID(134) +#define T_LEGACY_OTG_ERROR T_ID(135) +#define T_LEGACY_OTG_WARNING T_ID(136) +#define T_LEGACY_OTG_DEBUG T_ID(137) +#define T_LEGACY_OTG_TRACE T_ID(138) +#define T_LEGACY_OCG_INFO T_ID(139) +#define T_LEGACY_OCG_ERROR T_ID(140) +#define T_LEGACY_OCG_WARNING T_ID(141) +#define T_LEGACY_OCG_DEBUG T_ID(142) +#define T_LEGACY_OCG_TRACE T_ID(143) +#define T_LEGACY_OCM_INFO T_ID(144) +#define T_LEGACY_OCM_ERROR T_ID(145) +#define T_LEGACY_OCM_WARNING T_ID(146) +#define T_LEGACY_OCM_DEBUG T_ID(147) +#define T_LEGACY_OCM_TRACE T_ID(148) +#define T_LEGACY_OIP_INFO T_ID(149) +#define T_LEGACY_OIP_ERROR T_ID(150) +#define T_LEGACY_OIP_WARNING T_ID(151) +#define T_LEGACY_OIP_DEBUG T_ID(152) +#define T_LEGACY_OIP_TRACE T_ID(153) +#define T_LEGACY_OMG_INFO T_ID(154) +#define T_LEGACY_OMG_ERROR T_ID(155) +#define T_LEGACY_OMG_WARNING T_ID(156) +#define T_LEGACY_OMG_DEBUG T_ID(157) +#define T_LEGACY_OMG_TRACE T_ID(158) +#define T_LEGACY_OPT_INFO T_ID(159) +#define T_LEGACY_OPT_ERROR T_ID(160) +#define T_LEGACY_OPT_WARNING T_ID(161) +#define T_LEGACY_OPT_DEBUG T_ID(162) +#define T_LEGACY_OPT_TRACE T_ID(163) +#define T_LEGACY_GTPU_INFO T_ID(164) +#define T_LEGACY_GTPU_ERROR T_ID(165) +#define T_LEGACY_GTPU_WARNING T_ID(166) +#define T_LEGACY_GTPU_DEBUG T_ID(167) +#define T_LEGACY_GTPU_TRACE T_ID(168) +#define T_LEGACY_TMR_INFO T_ID(169) +#define T_LEGACY_TMR_ERROR T_ID(170) +#define T_LEGACY_TMR_WARNING T_ID(171) +#define T_LEGACY_TMR_DEBUG T_ID(172) +#define T_LEGACY_TMR_TRACE T_ID(173) +#define T_LEGACY_OSA_INFO T_ID(174) +#define T_LEGACY_OSA_ERROR T_ID(175) +#define T_LEGACY_OSA_WARNING T_ID(176) +#define T_LEGACY_OSA_DEBUG T_ID(177) +#define T_LEGACY_OSA_TRACE T_ID(178) +#define T_LEGACY_SIM_INFO T_ID(179) +#define T_LEGACY_SIM_ERROR T_ID(180) +#define T_LEGACY_SIM_WARNING T_ID(181) +#define T_LEGACY_SIM_DEBUG T_ID(182) +#define T_LEGACY_SIM_TRACE T_ID(183) +#define T_LEGACY_component_INFO T_ID(184) +#define T_LEGACY_component_ERROR T_ID(185) +#define T_LEGACY_component_WARNING T_ID(186) +#define T_LEGACY_component_DEBUG T_ID(187) +#define T_LEGACY_component_TRACE T_ID(188) +#define T_LEGACY_componentP_INFO T_ID(189) +#define T_LEGACY_componentP_ERROR T_ID(190) +#define T_LEGACY_componentP_WARNING T_ID(191) +#define T_LEGACY_componentP_DEBUG T_ID(192) +#define T_LEGACY_componentP_TRACE T_ID(193) +#define T_LEGACY_CLI_INFO T_ID(194) +#define T_LEGACY_CLI_ERROR T_ID(195) +#define T_LEGACY_CLI_WARNING T_ID(196) +#define T_LEGACY_CLI_DEBUG T_ID(197) +#define T_LEGACY_CLI_TRACE T_ID(198) +#define T_UE_MASTER_TICK T_ID(199) +#define T_UE_PHY_UL_TICK T_ID(200) +#define T_UE_PHY_DL_TICK T_ID(201) +#define T_UE_PHY_DLSCH_UE_DCI T_ID(202) +#define T_UE_PHY_DLSCH_UE_ACK T_ID(203) +#define T_UE_PHY_DLSCH_UE_NACK T_ID(204) +#define T_UE_PHY_ULSCH_UE_DCI T_ID(205) +#define T_UE_PHY_ULSCH_UE_ACK T_ID(206) +#define T_UE_PHY_ULSCH_UE_NACK T_ID(207) +#define T_UE_PHY_INPUT_SIGNAL T_ID(208) +#define T_UE_PHY_DL_CHANNEL_ESTIMATE T_ID(209) +#define T_UE_PHY_PDCCH_IQ T_ID(210) +#define T_UE_PHY_PDCCH_ENERGY T_ID(211) +#define T_UE_PHY_PDSCH_IQ T_ID(212) +#define T_UE_PHY_PDSCH_ENERGY T_ID(213) +#define T_UE_PHY_PUSCH_TX_POWER T_ID(214) +#define T_UE_PHY_PUCCH_TX_POWER T_ID(215) +#define T_UE_PHY_MEAS T_ID(216) +#define T_first T_ID(217) +#define T_buf_test T_ID(218) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_ENB T_ID(219) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_ENB T_ID(220) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_ENB T_ID(221) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_ENB T_ID(222) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_ENB T_ID(223) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_ENB T_ID(224) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_ENB T_ID(225) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_ENB T_ID(226) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_RU T_ID(227) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_RU T_ID(228) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_RU T_ID(229) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_RU T_ID(230) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_RU T_ID(231) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_RU T_ID(232) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_RU T_ID(233) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_RU T_ID(234) +#define T_VCD_VARIABLE_RUNTIME_TX_ENB T_ID(235) +#define T_VCD_VARIABLE_RUNTIME_RX_ENB T_ID(236) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_UE T_ID(237) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_UE T_ID(238) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_UE T_ID(239) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_UE T_ID(240) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_UE T_ID(241) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_UE T_ID(242) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_UE T_ID(243) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_UE T_ID(244) +#define T_VCD_VARIABLE_UE_RX_OFFSET T_ID(245) +#define T_VCD_VARIABLE_DIFF T_ID(246) +#define T_VCD_VARIABLE_HW_SUBFRAME T_ID(247) +#define T_VCD_VARIABLE_HW_FRAME T_ID(248) +#define T_VCD_VARIABLE_HW_SUBFRAME_RX T_ID(249) +#define T_VCD_VARIABLE_HW_FRAME_RX T_ID(250) +#define T_VCD_VARIABLE_TXCNT T_ID(251) +#define T_VCD_VARIABLE_RXCNT T_ID(252) +#define T_VCD_VARIABLE_TRX_TS T_ID(253) +#define T_VCD_VARIABLE_TRX_TST T_ID(254) +#define T_VCD_VARIABLE_TRX_TS_UE T_ID(255) +#define T_VCD_VARIABLE_TRX_TST_UE T_ID(256) +#define T_VCD_VARIABLE_TRX_WRITE_FLAGS T_ID(257) +#define T_VCD_VARIABLE_TX_TS T_ID(258) +#define T_VCD_VARIABLE_RX_TS T_ID(259) +#define T_VCD_VARIABLE_RX_HWCNT T_ID(260) +#define T_VCD_VARIABLE_RX_LHWCNT T_ID(261) +#define T_VCD_VARIABLE_TX_HWCNT T_ID(262) +#define T_VCD_VARIABLE_TX_LHWCNT T_ID(263) +#define T_VCD_VARIABLE_RX_PCK T_ID(264) +#define T_VCD_VARIABLE_TX_PCK T_ID(265) +#define T_VCD_VARIABLE_RX_SEQ_NUM T_ID(266) +#define T_VCD_VARIABLE_RX_SEQ_NUM_PRV T_ID(267) +#define T_VCD_VARIABLE_TX_SEQ_NUM T_ID(268) +#define T_VCD_VARIABLE_CNT T_ID(269) +#define T_VCD_VARIABLE_DUMMY_DUMP T_ID(270) +#define T_VCD_VARIABLE_ITTI_SEND_MSG T_ID(271) +#define T_VCD_VARIABLE_ITTI_POLL_MSG T_ID(272) +#define T_VCD_VARIABLE_ITTI_RECV_MSG T_ID(273) +#define T_VCD_VARIABLE_ITTI_ALLOC_MSG T_ID(274) +#define T_VCD_VARIABLE_MP_ALLOC T_ID(275) +#define T_VCD_VARIABLE_MP_FREE T_ID(276) +#define T_VCD_VARIABLE_UE_INST_CNT_RX T_ID(277) +#define T_VCD_VARIABLE_UE_INST_CNT_TX T_ID(278) +#define T_VCD_VARIABLE_DCI_INFO T_ID(279) +#define T_VCD_VARIABLE_UE0_BSR T_ID(280) +#define T_VCD_VARIABLE_UE0_BO T_ID(281) +#define T_VCD_VARIABLE_UE0_SCHEDULED T_ID(282) +#define T_VCD_VARIABLE_UE0_TIMING_ADVANCE T_ID(283) +#define T_VCD_VARIABLE_UE0_SR_ENERGY T_ID(284) +#define T_VCD_VARIABLE_UE0_SR_THRES T_ID(285) +#define T_VCD_VARIABLE_UE0_RSSI0 T_ID(286) +#define T_VCD_VARIABLE_UE0_RSSI1 T_ID(287) +#define T_VCD_VARIABLE_UE0_RSSI2 T_ID(288) +#define T_VCD_VARIABLE_UE0_RSSI3 T_ID(289) +#define T_VCD_VARIABLE_UE0_RSSI4 T_ID(290) +#define T_VCD_VARIABLE_UE0_RSSI5 T_ID(291) +#define T_VCD_VARIABLE_UE0_RSSI6 T_ID(292) +#define T_VCD_VARIABLE_UE0_RSSI7 T_ID(293) +#define T_VCD_VARIABLE_UE0_RES0 T_ID(294) +#define T_VCD_VARIABLE_UE0_RES1 T_ID(295) +#define T_VCD_VARIABLE_UE0_RES2 T_ID(296) +#define T_VCD_VARIABLE_UE0_RES3 T_ID(297) +#define T_VCD_VARIABLE_UE0_RES4 T_ID(298) +#define T_VCD_VARIABLE_UE0_RES5 T_ID(299) +#define T_VCD_VARIABLE_UE0_RES6 T_ID(300) +#define T_VCD_VARIABLE_UE0_RES7 T_ID(301) +#define T_VCD_VARIABLE_UE0_MCS0 T_ID(302) +#define T_VCD_VARIABLE_UE0_MCS1 T_ID(303) +#define T_VCD_VARIABLE_UE0_MCS2 T_ID(304) +#define T_VCD_VARIABLE_UE0_MCS3 T_ID(305) +#define T_VCD_VARIABLE_UE0_MCS4 T_ID(306) +#define T_VCD_VARIABLE_UE0_MCS5 T_ID(307) +#define T_VCD_VARIABLE_UE0_MCS6 T_ID(308) +#define T_VCD_VARIABLE_UE0_MCS7 T_ID(309) +#define T_VCD_VARIABLE_UE0_RB0 T_ID(310) +#define T_VCD_VARIABLE_UE0_RB1 T_ID(311) +#define T_VCD_VARIABLE_UE0_RB2 T_ID(312) +#define T_VCD_VARIABLE_UE0_RB3 T_ID(313) +#define T_VCD_VARIABLE_UE0_RB4 T_ID(314) +#define T_VCD_VARIABLE_UE0_RB5 T_ID(315) +#define T_VCD_VARIABLE_UE0_RB6 T_ID(316) +#define T_VCD_VARIABLE_UE0_RB7 T_ID(317) +#define T_VCD_VARIABLE_UE0_ROUND0 T_ID(318) +#define T_VCD_VARIABLE_UE0_ROUND1 T_ID(319) +#define T_VCD_VARIABLE_UE0_ROUND2 T_ID(320) +#define T_VCD_VARIABLE_UE0_ROUND3 T_ID(321) +#define T_VCD_VARIABLE_UE0_ROUND4 T_ID(322) +#define T_VCD_VARIABLE_UE0_ROUND5 T_ID(323) +#define T_VCD_VARIABLE_UE0_ROUND6 T_ID(324) +#define T_VCD_VARIABLE_UE0_ROUND7 T_ID(325) +#define T_VCD_VARIABLE_UE0_SFN0 T_ID(326) +#define T_VCD_VARIABLE_UE0_SFN1 T_ID(327) +#define T_VCD_VARIABLE_UE0_SFN2 T_ID(328) +#define T_VCD_VARIABLE_UE0_SFN3 T_ID(329) +#define T_VCD_VARIABLE_UE0_SFN4 T_ID(330) +#define T_VCD_VARIABLE_UE0_SFN5 T_ID(331) +#define T_VCD_VARIABLE_UE0_SFN6 T_ID(332) +#define T_VCD_VARIABLE_UE0_SFN7 T_ID(333) +#define T_VCD_VARIABLE_SEND_IF4_SYMBOL T_ID(334) +#define T_VCD_VARIABLE_RECV_IF4_SYMBOL T_ID(335) +#define T_VCD_VARIABLE_SEND_IF5_PKT_ID T_ID(336) +#define T_VCD_VARIABLE_RECV_IF5_PKT_ID T_ID(337) +#define T_VCD_VARIABLE_UE_PDCP_FLUSH_SIZE T_ID(338) +#define T_VCD_VARIABLE_UE_PDCP_FLUSH_ERR T_ID(339) +#define T_VCD_VARIABLE_UE0_TRX_READ_NS T_ID(340) +#define T_VCD_VARIABLE_UE0_TRX_WRITE_NS T_ID(341) +#define T_VCD_VARIABLE_UE0_TRX_READ_NS_MISSING T_ID(342) +#define T_VCD_VARIABLE_UE0_TRX_WRITE_NS_MISSING T_ID(343) +#define T_VCD_VARIABLE_CPUID_ENB_THREAD_RXTX T_ID(344) +#define T_VCD_VARIABLE_CPUID_RU_THREAD T_ID(345) +#define T_VCD_VARIABLE_CPUID_RU_THREAD_TX T_ID(346) +#define T_VCD_FUNCTION_RT_SLEEP T_ID(347) +#define T_VCD_FUNCTION_TRX_READ T_ID(348) +#define T_VCD_FUNCTION_TRX_WRITE T_ID(349) +#define T_VCD_FUNCTION_TRX_READ_UE T_ID(350) +#define T_VCD_FUNCTION_TRX_WRITE_UE T_ID(351) +#define T_VCD_FUNCTION_TRX_READ_IF T_ID(352) +#define T_VCD_FUNCTION_TRX_WRITE_IF T_ID(353) +#define T_VCD_FUNCTION_eNB_PROC_RXTX0 T_ID(354) +#define T_VCD_FUNCTION_eNB_PROC_RXTX1 T_ID(355) +#define T_VCD_FUNCTION_UE_THREAD_SYNCH T_ID(356) +#define T_VCD_FUNCTION_UE_THREAD_RXTX0 T_ID(357) +#define T_VCD_FUNCTION_UE_THREAD_RXTX1 T_ID(358) +#define T_VCD_FUNCTION_TRX_READ_SF9 T_ID(359) +#define T_VCD_FUNCTION_TRX_WRITE_SF9 T_ID(360) +#define T_VCD_FUNCTION_UE_SIGNAL_COND_RXTX0 T_ID(361) +#define T_VCD_FUNCTION_UE_SIGNAL_COND_RXTX1 T_ID(362) +#define T_VCD_FUNCTION_UE_WAIT_COND_RXTX0 T_ID(363) +#define T_VCD_FUNCTION_UE_WAIT_COND_RXTX1 T_ID(364) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0 T_ID(365) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1 T_ID(366) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0 T_ID(367) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1 T_ID(368) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0 T_ID(369) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1 T_ID(370) +#define T_VCD_FUNCTION_SIM_DO_DL_SIGNAL T_ID(371) +#define T_VCD_FUNCTION_SIM_DO_UL_SIGNAL T_ID(372) +#define T_VCD_FUNCTION_SIM_UE_TRX_READ T_ID(373) +#define T_VCD_FUNCTION_eNB_TX T_ID(374) +#define T_VCD_FUNCTION_eNB_RX T_ID(375) +#define T_VCD_FUNCTION_eNB_TRX T_ID(376) +#define T_VCD_FUNCTION_eNB_TM T_ID(377) +#define T_VCD_FUNCTION_eNB_RX_SLEEP T_ID(378) +#define T_VCD_FUNCTION_eNB_TX_SLEEP T_ID(379) +#define T_VCD_FUNCTION_eNB_PROC_SLEEP T_ID(380) +#define T_VCD_FUNCTION_TRX_READ_RF T_ID(381) +#define T_VCD_FUNCTION_TRX_WRITE_RF T_ID(382) +#define T_VCD_FUNCTION_UE_SYNCH T_ID(383) +#define T_VCD_FUNCTION_UE_SLOT_FEP T_ID(384) +#define T_VCD_FUNCTION_UE_RRC_MEASUREMENTS T_ID(385) +#define T_VCD_FUNCTION_UE_GAIN_CONTROL T_ID(386) +#define T_VCD_FUNCTION_UE_ADJUST_SYNCH T_ID(387) +#define T_VCD_FUNCTION_UE_MEASUREMENT_PROCEDURES T_ID(388) +#define T_VCD_FUNCTION_UE_PDCCH_PROCEDURES T_ID(389) +#define T_VCD_FUNCTION_UE_PBCH_PROCEDURES T_ID(390) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_TX T_ID(391) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_TX1 T_ID(392) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX T_ID(393) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX1 T_ID(394) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM T_ID(395) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM1 T_ID(396) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC T_ID(397) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC1 T_ID(398) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC T_ID(399) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC1 T_ID(400) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX T_ID(401) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_RX T_ID(402) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC T_ID(403) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PUCCH T_ID(404) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_COMMON T_ID(405) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PRACH T_ID(406) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_RAR T_ID(407) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_LTE T_ID(408) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_LTE T_ID(409) +#define T_VCD_FUNCTION_PDSCH_THREAD T_ID(410) +#define T_VCD_FUNCTION_DLSCH_THREAD0 T_ID(411) +#define T_VCD_FUNCTION_DLSCH_THREAD1 T_ID(412) +#define T_VCD_FUNCTION_DLSCH_THREAD2 T_ID(413) +#define T_VCD_FUNCTION_DLSCH_THREAD3 T_ID(414) +#define T_VCD_FUNCTION_DLSCH_THREAD4 T_ID(415) +#define T_VCD_FUNCTION_DLSCH_THREAD5 T_ID(416) +#define T_VCD_FUNCTION_DLSCH_THREAD6 T_ID(417) +#define T_VCD_FUNCTION_DLSCH_THREAD7 T_ID(418) +#define T_VCD_FUNCTION_DLSCH_DECODING0 T_ID(419) +#define T_VCD_FUNCTION_DLSCH_DECODING1 T_ID(420) +#define T_VCD_FUNCTION_DLSCH_DECODING2 T_ID(421) +#define T_VCD_FUNCTION_DLSCH_DECODING3 T_ID(422) +#define T_VCD_FUNCTION_DLSCH_DECODING4 T_ID(423) +#define T_VCD_FUNCTION_DLSCH_DECODING5 T_ID(424) +#define T_VCD_FUNCTION_DLSCH_DECODING6 T_ID(425) +#define T_VCD_FUNCTION_DLSCH_DECODING7 T_ID(426) +#define T_VCD_FUNCTION_RX_PDCCH T_ID(427) +#define T_VCD_FUNCTION_DCI_DECODING T_ID(428) +#define T_VCD_FUNCTION_RX_PHICH T_ID(429) +#define T_VCD_FUNCTION_PDSCH_PROC T_ID(430) +#define T_VCD_FUNCTION_PDSCH_PROC_SI T_ID(431) +#define T_VCD_FUNCTION_PDSCH_PROC_P T_ID(432) +#define T_VCD_FUNCTION_PDSCH_PROC_RA T_ID(433) +#define T_VCD_FUNCTION_PHY_UE_CONFIG_SIB2 T_ID(434) +#define T_VCD_FUNCTION_PHY_CONFIG_SIB1_ENB T_ID(435) +#define T_VCD_FUNCTION_PHY_CONFIG_SIB2_ENB T_ID(436) +#define T_VCD_FUNCTION_PHY_CONFIG_DEDICATED_ENB T_ID(437) +#define T_VCD_FUNCTION_PHY_UE_COMPUTE_PRACH T_ID(438) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_MSG3 T_ID(439) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING0 T_ID(440) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING1 T_ID(441) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING2 T_ID(442) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING3 T_ID(443) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING4 T_ID(444) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING5 T_ID(445) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING6 T_ID(446) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING7 T_ID(447) +#define T_VCD_FUNCTION_PHY_ENB_SFGEN T_ID(448) +#define T_VCD_FUNCTION_PHY_ENB_PRACH_RX T_ID(449) +#define T_VCD_FUNCTION_PHY_RU_PRACH_RX T_ID(450) +#define T_VCD_FUNCTION_PHY_ENB_PDCCH_TX T_ID(451) +#define T_VCD_FUNCTION_PHY_ENB_RS_TX T_ID(452) +#define T_VCD_FUNCTION_UE_GENERATE_PRACH T_ID(453) +#define T_VCD_FUNCTION_UE_ULSCH_MODULATION T_ID(454) +#define T_VCD_FUNCTION_UE_ULSCH_ENCODING T_ID(455) +#define T_VCD_FUNCTION_UE_ULSCH_ENCODING_FILL_CQI T_ID(456) +#define T_VCD_FUNCTION_UE_ULSCH_SCRAMBLING T_ID(457) +#define T_VCD_FUNCTION_ENB_DLSCH_MODULATION T_ID(458) +#define T_VCD_FUNCTION_ENB_DLSCH_ENCODING T_ID(459) +#define T_VCD_FUNCTION_ENB_DLSCH_ENCODING_W T_ID(460) +#define T_VCD_FUNCTION_ENB_DLSCH_SCRAMBLING T_ID(461) +#define T_VCD_FUNCTION_ENB_BEAM_PRECODING T_ID(462) +#define T_VCD_FUNCTION_ENB_OFDM_MODULATION T_ID(463) +#define T_VCD_FUNCTION_MACPHY_INIT T_ID(464) +#define T_VCD_FUNCTION_MACPHY_EXIT T_ID(465) +#define T_VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER T_ID(466) +#define T_VCD_FUNCTION_FILL_RAR T_ID(467) +#define T_VCD_FUNCTION_TERMINATE_RA_PROC T_ID(468) +#define T_VCD_FUNCTION_INITIATE_RA_PROC T_ID(469) +#define T_VCD_FUNCTION_CANCEL_RA_PROC T_ID(470) +#define T_VCD_FUNCTION_GET_DCI_SDU T_ID(471) +#define T_VCD_FUNCTION_GET_DLSCH_SDU T_ID(472) +#define T_VCD_FUNCTION_RX_SDU T_ID(473) +#define T_VCD_FUNCTION_MRBCH_PHY_SYNC_FAILURE T_ID(474) +#define T_VCD_FUNCTION_SR_INDICATION T_ID(475) +#define T_VCD_FUNCTION_DLSCH_PREPROCESSOR T_ID(476) +#define T_VCD_FUNCTION_SCHEDULE_DLSCH T_ID(477) +#define T_VCD_FUNCTION_FILL_DLSCH_DCI T_ID(478) +#define T_VCD_FUNCTION_OUT_OF_SYNC_IND T_ID(479) +#define T_VCD_FUNCTION_UE_DECODE_SI T_ID(480) +#define T_VCD_FUNCTION_UE_DECODE_PCCH T_ID(481) +#define T_VCD_FUNCTION_UE_DECODE_CCCH T_ID(482) +#define T_VCD_FUNCTION_UE_DECODE_BCCH T_ID(483) +#define T_VCD_FUNCTION_UE_SEND_SDU T_ID(484) +#define T_VCD_FUNCTION_UE_GET_SDU T_ID(485) +#define T_VCD_FUNCTION_UE_GET_RACH T_ID(486) +#define T_VCD_FUNCTION_UE_PROCESS_RAR T_ID(487) +#define T_VCD_FUNCTION_UE_SCHEDULER T_ID(488) +#define T_VCD_FUNCTION_UE_GET_SR T_ID(489) +#define T_VCD_FUNCTION_UE_SEND_MCH_SDU T_ID(490) +#define T_VCD_FUNCTION_RLC_DATA_REQ T_ID(491) +#define T_VCD_FUNCTION_MAC_RLC_STATUS_IND T_ID(492) +#define T_VCD_FUNCTION_MAC_RLC_DATA_REQ T_ID(493) +#define T_VCD_FUNCTION_MAC_RLC_DATA_IND T_ID(494) +#define T_VCD_FUNCTION_RLC_UM_TRY_REASSEMBLY T_ID(495) +#define T_VCD_FUNCTION_RLC_UM_CHECK_TIMER_DAR_TIME_OUT T_ID(496) +#define T_VCD_FUNCTION_RLC_UM_RECEIVE_PROCESS_DAR T_ID(497) +#define T_VCD_FUNCTION_PDCP_RUN T_ID(498) +#define T_VCD_FUNCTION_PDCP_DATA_REQ T_ID(499) +#define T_VCD_FUNCTION_PDCP_DATA_IND T_ID(500) +#define T_VCD_FUNCTION_PDCP_APPLY_SECURITY T_ID(501) +#define T_VCD_FUNCTION_PDCP_VALIDATE_SECURITY T_ID(502) +#define T_VCD_FUNCTION_PDCP_FIFO_READ T_ID(503) +#define T_VCD_FUNCTION_PDCP_FIFO_READ_BUFFER T_ID(504) +#define T_VCD_FUNCTION_PDCP_FIFO_FLUSH T_ID(505) +#define T_VCD_FUNCTION_PDCP_FIFO_FLUSH_BUFFER T_ID(506) +#define T_VCD_FUNCTION_RRC_RX_TX T_ID(507) +#define T_VCD_FUNCTION_RRC_MAC_CONFIG T_ID(508) +#define T_VCD_FUNCTION_RRC_UE_DECODE_SIB1 T_ID(509) +#define T_VCD_FUNCTION_RRC_UE_DECODE_SI T_ID(510) +#define T_VCD_FUNCTION_GTPV1U_ENB_TASK T_ID(511) +#define T_VCD_FUNCTION_GTPV1U_PROCESS_UDP_REQ T_ID(512) +#define T_VCD_FUNCTION_GTPV1U_PROCESS_TUNNEL_DATA_REQ T_ID(513) +#define T_VCD_FUNCTION_UDP_ENB_TASK T_ID(514) +#define T_VCD_FUNCTION_EMU_TRANSPORT T_ID(515) +#define T_VCD_FUNCTION_LOG_RECORD T_ID(516) +#define T_VCD_FUNCTION_ITTI_ENQUEUE_MESSAGE T_ID(517) +#define T_VCD_FUNCTION_ITTI_DUMP_ENQUEUE_MESSAGE T_ID(518) +#define T_VCD_FUNCTION_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC T_ID(519) +#define T_VCD_FUNCTION_ITTI_RELAY_THREAD T_ID(520) +#define T_VCD_FUNCTION_TEST T_ID(521) +#define T_VCD_FUNCTION_SEND_IF4 T_ID(522) +#define T_VCD_FUNCTION_RECV_IF4 T_ID(523) +#define T_VCD_FUNCTION_SEND_IF5 T_ID(524) +#define T_VCD_FUNCTION_RECV_IF5 T_ID(525) +#define T_VCD_FUNCTION_TRX_COMPR_IF T_ID(526) +#define T_VCD_FUNCTION_TRX_DECOMPR_IF T_ID(527) +#define T_VCD_FUNCTION_NFAPI T_ID(528) +#define T_VCD_FUNCTION_GENERATE_PCFICH T_ID(529) +#define T_VCD_FUNCTION_GENERATE_DCI0 T_ID(530) +#define T_VCD_FUNCTION_GENERATE_DLSCH T_ID(531) +#define T_VCD_FUNCTION_GENERATE_PHICH T_ID(532) +#define T_VCD_FUNCTION_PDCCH_SCRAMBLING T_ID(533) +#define T_VCD_FUNCTION_PDCCH_MODULATION T_ID(534) +#define T_VCD_FUNCTION_PDCCH_INTERLEAVING T_ID(535) +#define T_VCD_FUNCTION_PDCCH_TX T_ID(536) +#define T_NUMBER_OF_IDS 537 + +#define T_LEGACY_PROTO_AGENT_DEBUG T_ID(538) +#define T_LEGACY_PROTO_AGENT_INFO T_ID(539) +#define T_LEGACY_PROTO_AGENT_ERROR T_ID(540) +#define T_LEGACY_F1U_ERROR T_ID(541) +#define T_LEGACY_F1U_DEBUG T_ID(542) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h new file mode 100644 index 0000000000..d81bd87ed5 --- /dev/null +++ b/openair2/COMMON/f1ap_messages_def.h @@ -0,0 +1,77 @@ +/* + * 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 + */ + +/* Messages for S1AP logging */ +MESSAGE_DEF(S1AP_UPLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_uplink_nas_log) +MESSAGE_DEF(S1AP_UE_CAPABILITY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_capability_ind_log) +MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_initial_context_setup_log) +MESSAGE_DEF(S1AP_NAS_NON_DELIVERY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_nas_non_delivery_ind_log) +MESSAGE_DEF(S1AP_DOWNLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_downlink_nas_log) +MESSAGE_DEF(S1AP_S1_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_s1_setup_log) +MESSAGE_DEF(S1AP_INITIAL_UE_MESSAGE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_initial_ue_message_log) +MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_req_log) +MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_command_log) +MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_complete_log) +MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_log) +MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_setup_request_log) +MESSAGE_DEF(S1AP_E_RAB_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_setup_response_log) +MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_modify_request_log) +MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_modify_response_log) +MESSAGE_DEF(S1AP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_paging_log) +MESSAGE_DEF(S1AP_E_RAB_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_request_log) +MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_response_log) +MESSAGE_DEF(S1AP_E_RAB_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_error_indication_log) + +/* eNB application layer -> S1AP messages */ +MESSAGE_DEF(S1AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, s1ap_register_enb_req_t , s1ap_register_enb_req) + +/* S1AP -> eNB application layer messages */ +MESSAGE_DEF(S1AP_REGISTER_ENB_CNF , MESSAGE_PRIORITY_MED, s1ap_register_enb_cnf_t , s1ap_register_enb_cnf) +MESSAGE_DEF(S1AP_DEREGISTERED_ENB_IND , MESSAGE_PRIORITY_MED, s1ap_deregistered_enb_ind_t , s1ap_deregistered_enb_ind) + +/* RRC -> S1AP messages */ +MESSAGE_DEF(S1AP_NAS_FIRST_REQ , MESSAGE_PRIORITY_MED, s1ap_nas_first_req_t , s1ap_nas_first_req) +MESSAGE_DEF(S1AP_UPLINK_NAS , MESSAGE_PRIORITY_MED, s1ap_uplink_nas_t , s1ap_uplink_nas) +MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND , MESSAGE_PRIORITY_MED, s1ap_ue_cap_info_ind_t , s1ap_ue_cap_info_ind) +MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, s1ap_initial_context_setup_resp_t, s1ap_initial_context_setup_resp) +MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_FAIL, MESSAGE_PRIORITY_MED, s1ap_initial_context_setup_fail_t, s1ap_initial_context_setup_fail) +MESSAGE_DEF(S1AP_NAS_NON_DELIVERY_IND , MESSAGE_PRIORITY_MED, s1ap_nas_non_delivery_ind_t , s1ap_nas_non_delivery_ind) +MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_RESP , MESSAGE_PRIORITY_MED, s1ap_ue_release_resp_t , s1ap_ue_release_resp) +MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, s1ap_ue_release_complete_t , s1ap_ue_release_complete) +MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_resp_t , s1ap_ue_ctxt_modification_resp) +MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_fail_t , s1ap_ue_ctxt_modification_fail) +MESSAGE_DEF(S1AP_E_RAB_SETUP_RESP , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_resp_t , s1ap_e_rab_setup_resp) +MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_fail_t , s1ap_e_rab_setup_request_fail) +MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESP , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_resp_t , s1ap_e_rab_modify_resp) +MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_resp_t , s1ap_e_rab_release_resp) + +/* S1AP -> RRC messages */ +MESSAGE_DEF(S1AP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, s1ap_downlink_nas_t , s1ap_downlink_nas ) +MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_initial_context_setup_req_t , s1ap_initial_context_setup_req ) +MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_req_t , s1ap_ue_ctxt_modification_req) +MESSAGE_DEF(S1AP_PAGING_IND , MESSAGE_PRIORITY_MED, s1ap_paging_ind_t , s1ap_paging_ind ) +MESSAGE_DEF(S1AP_E_RAB_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_t , s1ap_e_rab_setup_req ) +MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQ , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_req_t , s1ap_e_rab_modify_req ) +MESSAGE_DEF(S1AP_E_RAB_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_command_t , s1ap_e_rab_release_command) +MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, s1ap_ue_release_command_t , s1ap_ue_release_command) + +/* S1AP <-> RRC messages (can be initiated either by MME or eNB) */ +MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ , MESSAGE_PRIORITY_MED, s1ap_ue_release_req_t , s1ap_ue_release_req) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h new file mode 100644 index 0000000000..4a5f492b0b --- /dev/null +++ b/openair2/COMMON/f1ap_messages_types.h @@ -0,0 +1,646 @@ +/* + * 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 + */ + +#ifndef S1AP_MESSAGES_TYPES_H_ +#define S1AP_MESSAGES_TYPES_H_ + +//-------------------------------------------------------------------------------------------// +// Defines to access message fields. + +#define S1AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_register_enb_req + +#define S1AP_REGISTER_ENB_CNF(mSGpTR) (mSGpTR)->ittiMsg.s1ap_register_enb_cnf +#define S1AP_DEREGISTERED_ENB_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_deregistered_enb_ind + +#define S1AP_NAS_FIRST_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_nas_first_req +#define S1AP_UPLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.s1ap_uplink_nas +#define S1AP_UE_CAPABILITIES_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_cap_info_ind +#define S1AP_INITIAL_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_initial_context_setup_resp +#define S1AP_INITIAL_CONTEXT_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_initial_context_setup_fail +#define S1AP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_resp +#define S1AP_NAS_NON_DELIVERY_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_nas_non_delivery_ind +#define S1AP_UE_CTXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_resp +#define S1AP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_fail +#define S1AP_E_RAB_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_resp +#define S1AP_E_RAB_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req_fail +#define S1AP_E_RAB_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_modify_resp + +#define S1AP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.s1ap_downlink_nas +#define S1AP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_initial_context_setup_req +#define S1AP_UE_CTXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_req +#define S1AP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_command +#define S1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_complete +#define S1AP_E_RAB_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req +#define S1AP_E_RAB_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_modify_req +#define S1AP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_paging_ind + +#define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_req +#define S1AP_E_RAB_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_release_command +#define S1AP_E_RAB_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_release_resp + +//-------------------------------------------------------------------------------------------// +/* Maximum number of e-rabs to be setup/deleted in a single message. + * Even if only one bearer will be modified by message. + */ +#define S1AP_MAX_E_RAB 11 + +/* Length of the transport layer address string + * 160 bits / 8 bits by char. + */ +#define S1AP_TRANSPORT_LAYER_ADDRESS_SIZE (160 / 8) + +#define S1AP_MAX_NB_MME_IP_ADDRESS 10 +#define S1AP_IMSI_LENGTH 16 + +/* Security key length used within eNB + * Even if only 16 bytes will be effectively used, + * the key length is 32 bytes (256 bits) + */ +#define SECURITY_KEY_LENGTH 32 +#ifndef OCP_FRAMEWORK +typedef enum cell_type_e { + CELL_MACRO_ENB, + CELL_HOME_ENB +} cell_type_t; + +typedef enum paging_drx_e { + PAGING_DRX_32 = 0x0, + PAGING_DRX_64 = 0x1, + PAGING_DRX_128 = 0x2, + PAGING_DRX_256 = 0x3 +} paging_drx_t; + +/* Lower value codepoint + * indicates higher priority. + */ +typedef enum paging_priority_s { + PAGING_PRIO_LEVEL1 = 0, + PAGING_PRIO_LEVEL2 = 1, + PAGING_PRIO_LEVEL3 = 2, + PAGING_PRIO_LEVEL4 = 3, + PAGING_PRIO_LEVEL5 = 4, + PAGING_PRIO_LEVEL6 = 5, + PAGING_PRIO_LEVEL7 = 6, + PAGING_PRIO_LEVEL8 = 7 +} paging_priority_t; + +typedef enum cn_domain_s { + CN_DOMAIN_PS = 1, + CN_DOMAIN_CS = 2 +} cn_domain_t; +#endif + +typedef struct net_ip_address_s { + unsigned ipv4:1; + unsigned ipv6:1; + char ipv4_address[16]; + char ipv6_address[46]; +} net_ip_address_t; + +typedef uint64_t bitrate_t; + +typedef struct ambr_s { + bitrate_t br_ul; + bitrate_t br_dl; +} ambr_t; + +#ifndef OCP_FRAMEWORK +typedef enum priority_level_s { + PRIORITY_LEVEL_SPARE = 0, + PRIORITY_LEVEL_HIGHEST = 1, + PRIORITY_LEVEL_LOWEST = 14, + PRIORITY_LEVEL_NO_PRIORITY = 15 +} priority_level_t; + +typedef enum pre_emp_capability_e { + PRE_EMPTION_CAPABILITY_ENABLED = 0, + PRE_EMPTION_CAPABILITY_DISABLED = 1, + PRE_EMPTION_CAPABILITY_MAX, +} pre_emp_capability_t; + +typedef enum pre_emp_vulnerability_e { + PRE_EMPTION_VULNERABILITY_ENABLED = 0, + PRE_EMPTION_VULNERABILITY_DISABLED = 1, + PRE_EMPTION_VULNERABILITY_MAX, +} pre_emp_vulnerability_t; +#endif + +typedef struct allocation_retention_priority_s { + priority_level_t priority_level; + pre_emp_capability_t pre_emp_capability; + pre_emp_vulnerability_t pre_emp_vulnerability; +} allocation_retention_priority_t; + +typedef struct security_capabilities_s { + uint16_t encryption_algorithms; + uint16_t integrity_algorithms; +} security_capabilities_t; + +/* Provides the establishment cause for the RRC connection request as provided + * by the upper layers. W.r.t. the cause value names: highPriorityAccess + * concerns AC11..AC15, ‘mt’ stands for ‘Mobile Terminating’ and ‘mo’ for + * 'Mobile Originating'. Defined in TS 36.331. + */ +typedef enum rrc_establishment_cause_e { + RRC_CAUSE_EMERGENCY = 0x0, + RRC_CAUSE_HIGH_PRIO_ACCESS = 0x1, + RRC_CAUSE_MT_ACCESS = 0x2, + RRC_CAUSE_MO_SIGNALLING = 0x3, + RRC_CAUSE_MO_DATA = 0x4, +#if defined(UPDATE_RELEASE_10) + RRC_CAUSE_DELAY_TOLERANT_ACCESS = 0x5, +#endif + RRC_CAUSE_LAST +} rrc_establishment_cause_t; + +typedef struct s1ap_gummei_s { + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_len; + uint8_t mme_code; + uint16_t mme_group_id; +} s1ap_gummei_t; + +typedef struct s1ap_imsi_s { + uint8_t buffer[S1AP_IMSI_LENGTH]; + uint8_t length; +} s1ap_imsi_t; + +typedef struct s_tmsi_s { + uint8_t mme_code; + uint32_t m_tmsi; +} s_tmsi_t; + +typedef enum ue_paging_identity_presenceMask_e { + UE_PAGING_IDENTITY_NONE = 0, + UE_PAGING_IDENTITY_imsi = (1 << 1), + UE_PAGING_IDENTITY_s_tmsi = (1 << 2), +} ue_paging_identity_presenceMask_t; + +typedef struct ue_paging_identity_s { + ue_paging_identity_presenceMask_t presenceMask; + union { + s1ap_imsi_t imsi; + s_tmsi_t s_tmsi; + } choice; +} ue_paging_identity_t; + +typedef enum ue_identities_presenceMask_e { + UE_IDENTITIES_NONE = 0, + UE_IDENTITIES_s_tmsi = 1 << 1, + UE_IDENTITIES_gummei = 1 << 2, +} ue_identities_presenceMask_t; + +typedef struct ue_identity_s { + ue_identities_presenceMask_t presenceMask; + s_tmsi_t s_tmsi; + s1ap_gummei_t gummei; +} ue_identity_t; + +typedef struct nas_pdu_s { + /* Octet string data */ + uint8_t *buffer; + /* Length of the octet string */ + uint32_t length; +} nas_pdu_t, ue_radio_cap_t; + +typedef struct transport_layer_addr_s { + /* Length of the transport layer address buffer in bits. S1AP layer received a + * bit string<1..160> containing one of the following addresses: ipv4, + * ipv6, or ipv4 and ipv6. The layer doesn't interpret the buffer but + * silently forward it to S1-U. + */ + uint8_t length; + uint8_t buffer[20]; // in network byte order +} transport_layer_addr_t; + +#define TRANSPORT_LAYER_ADDR_COPY(dEST,sOURCE) \ + do { \ + AssertFatal(sOURCE.len <= 20); \ + memcpy(dEST.buffer, sOURCE.buffer, sOURCE.len); \ + dEST.length = sOURCE.length; \ + } while (0) + +typedef struct e_rab_level_qos_parameter_s { + uint8_t qci; + + allocation_retention_priority_t allocation_retention_priority; +} e_rab_level_qos_parameter_t; + +typedef struct e_rab_s { + /* Unique e_rab_id for the UE. */ + uint8_t e_rab_id; + /* Quality of service for this e_rab */ + e_rab_level_qos_parameter_t qos; + /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */ + nas_pdu_t nas_pdu; + /* The transport layer address for the IP packets */ + transport_layer_addr_t sgw_addr; + /* S-GW Tunnel endpoint identifier */ + uint32_t gtp_teid; +} e_rab_t; + +typedef struct e_rab_setup_s { + /* Unique e_rab_id for the UE. */ + uint8_t e_rab_id; + + /* The transport layer address for the IP packets */ + transport_layer_addr_t eNB_addr; + + /* S-GW Tunnel endpoint identifier */ + uint32_t gtp_teid; +} e_rab_setup_t; + +typedef struct e_rab_modify_s { + /* Unique e_rab_id for the UE. */ + uint8_t e_rab_id; +} e_rab_modify_t; + +typedef enum S1ap_Cause_e { + S1AP_CAUSE_NOTHING, /* No components present */ + S1AP_CAUSE_RADIO_NETWORK, + S1AP_CAUSE_TRANSPORT, + S1AP_CAUSE_NAS, + S1AP_CAUSE_PROTOCOL, + S1AP_CAUSE_MISC, + /* Extensions may appear below */ + +} s1ap_Cause_t; + +typedef struct e_rab_failed_s { + /* Unique e_rab_id for the UE. */ + uint8_t e_rab_id; + /* Cause of the failure */ + // cause_t cause; + s1ap_Cause_t cause; + uint8_t cause_value; +} e_rab_failed_t; + +typedef enum s1ap_ue_ctxt_modification_present_s { + S1AP_UE_CONTEXT_MODIFICATION_SECURITY_KEY = (1 << 0), + S1AP_UE_CONTEXT_MODIFICATION_UE_AMBR = (1 << 1), + S1AP_UE_CONTEXT_MODIFICATION_UE_SECU_CAP = (1 << 2), +} s1ap_ue_ctxt_modification_present_t; + +typedef enum s1ap_paging_ind_present_s { + S1AP_PAGING_IND_PAGING_DRX = (1 << 0), + S1AP_PAGING_IND_PAGING_PRIORITY = (1 << 1), +} s1ap_paging_ind_present_t; + +//-------------------------------------------------------------------------------------------// +// eNB application layer -> S1AP messages +typedef struct s1ap_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; + + /* Default Paging DRX of the eNB as defined in TS 36.304 */ + paging_drx_t default_drx; + + /* The eNB IP address to bind */ + net_ip_address_t enb_ip_address; + + /* Nb of MME to connect to */ + uint8_t nb_mme; + /* List of MME to connect to */ + net_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS]; + + /* Number of SCTP streams used for a mme association */ + uint16_t sctp_in_streams; + uint16_t sctp_out_streams; +} s1ap_register_enb_req_t; + +//-------------------------------------------------------------------------------------------// +// S1AP -> eNB application layer messages +typedef struct s1ap_register_enb_cnf_s { + /* Nb of MME connected */ + uint8_t nb_mme; +} s1ap_register_enb_cnf_t; + +typedef struct s1ap_deregistered_enb_ind_s { + /* Nb of MME connected */ + uint8_t nb_mme; +} s1ap_deregistered_enb_ind_t; + +//-------------------------------------------------------------------------------------------// +// RRC -> S1AP messages + +/* The NAS First Req is the first message exchanged between RRC and S1AP + * for an UE. + * The rnti uniquely identifies an UE within a cell. Later the enb_ue_s1ap_id + * will be the unique identifier used between RRC and S1AP. + */ +typedef struct s1ap_nas_first_req_s { + /* UE id for initial connection to S1AP */ + uint16_t ue_initial_id; + + /* Establishment cause as sent by UE */ + rrc_establishment_cause_t establishment_cause; + + /* NAS PDU */ + nas_pdu_t nas_pdu; + + /* If this flag is set S1AP layer is expecting the GUMMEI. If = 0, + * the temporary s-tmsi is used. + */ + ue_identity_t ue_identity; +} s1ap_nas_first_req_t; + +typedef struct s1ap_uplink_nas_s { + /* Unique UE identifier within an eNB */ + unsigned eNB_ue_s1ap_id:24; + + /* NAS pdu */ + nas_pdu_t nas_pdu; +} s1ap_uplink_nas_t; + +typedef struct s1ap_ue_cap_info_ind_s { + unsigned eNB_ue_s1ap_id:24; + ue_radio_cap_t ue_radio_cap; +} s1ap_ue_cap_info_ind_t; + +typedef struct s1ap_initial_context_setup_resp_s { + unsigned eNB_ue_s1ap_id:24; + + /* Number of e_rab setup-ed in the list */ + uint8_t nb_of_e_rabs; + /* list of e_rab setup-ed by RRC layers */ + e_rab_setup_t e_rabs[S1AP_MAX_E_RAB]; + + /* Number of e_rab failed to be setup in list */ + uint8_t nb_of_e_rabs_failed; + /* list of e_rabs that failed to be setup */ + e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB]; +} s1ap_initial_context_setup_resp_t; + +typedef struct s1ap_initial_context_setup_fail_s { + unsigned eNB_ue_s1ap_id:24; + + /* TODO add cause */ +} s1ap_initial_context_setup_fail_t, s1ap_ue_ctxt_modification_fail_t, s1ap_e_rab_setup_req_fail_t; + +typedef struct s1ap_nas_non_delivery_ind_s { + unsigned eNB_ue_s1ap_id:24; + nas_pdu_t nas_pdu; + /* TODO: add cause */ +} s1ap_nas_non_delivery_ind_t; + +typedef struct s1ap_ue_ctxt_modification_req_s { + unsigned eNB_ue_s1ap_id:24; + + /* Bit-mask of possible present parameters */ + s1ap_ue_ctxt_modification_present_t present; + + /* Following fields are optionnaly present */ + + /* Security key */ + uint8_t security_key[SECURITY_KEY_LENGTH]; + + /* UE aggregate maximum bitrate */ + ambr_t ue_ambr; + + /* Security capabilities */ + security_capabilities_t security_capabilities; +} s1ap_ue_ctxt_modification_req_t; + +typedef struct s1ap_ue_ctxt_modification_resp_s { + unsigned eNB_ue_s1ap_id:24; +} s1ap_ue_ctxt_modification_resp_t; + +typedef struct s1ap_ue_release_complete_s { + + unsigned eNB_ue_s1ap_id:24; + +} s1ap_ue_release_complete_t; + +//-------------------------------------------------------------------------------------------// +// S1AP -> RRC messages +typedef struct s1ap_downlink_nas_s { + /* UE id for initial connection to S1AP */ + uint16_t ue_initial_id; + + /* Unique UE identifier within an eNB */ + unsigned eNB_ue_s1ap_id:24; + + /* NAS pdu */ + nas_pdu_t nas_pdu; +} s1ap_downlink_nas_t; + + +typedef struct s1ap_initial_context_setup_req_s { + /* UE id for initial connection to S1AP */ + uint16_t ue_initial_id; + + /* eNB ue s1ap id as initialized by S1AP layer */ + unsigned eNB_ue_s1ap_id:24; + + /* UE aggregate maximum bitrate */ + ambr_t ue_ambr; + + /* Security algorithms */ + security_capabilities_t security_capabilities; + + /* Security key */ + uint8_t security_key[SECURITY_KEY_LENGTH]; + + /* Number of e_rab to be setup in the list */ + uint8_t nb_of_e_rabs; + /* list of e_rab to be setup by RRC layers */ + e_rab_t e_rab_param[S1AP_MAX_E_RAB]; +} s1ap_initial_context_setup_req_t; + +typedef struct tai_plmn_identity_s { + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; +} plmn_identity_t; + +typedef struct s1ap_paging_ind_s { + /* UE identity index value. + * Specified in 3GPP TS 36.304 + */ + unsigned ue_index_value:10; + + /* UE paging identity */ + ue_paging_identity_t ue_paging_identity; + + /* Indicates origin of paging */ + cn_domain_t cn_domain; + + /* PLMN_identity in TAI of Paging*/ + plmn_identity_t plmn_identity[256]; + + /* TAC in TAIList of Paging*/ + int16_t tac[256]; + + /* size of TAIList*/ + int16_t tai_size; + + /* Optional fields */ + paging_drx_t paging_drx; + + paging_priority_t paging_priority; +} s1ap_paging_ind_t; + +typedef struct s1ap_e_rab_setup_req_s { + /* UE id for initial connection to S1AP */ + uint16_t ue_initial_id; + + /* MME UE id */ + uint16_t mme_ue_s1ap_id; + + /* eNB ue s1ap id as initialized by S1AP layer */ + unsigned eNB_ue_s1ap_id:24; + + /* Number of e_rab to be setup in the list */ + uint8_t nb_e_rabs_tosetup; + + /* E RAB setup request */ + e_rab_t e_rab_setup_params[S1AP_MAX_E_RAB]; + +} s1ap_e_rab_setup_req_t; + +typedef struct s1ap_e_rab_setup_resp_s { + unsigned eNB_ue_s1ap_id:24; + + /* Number of e_rab setup-ed in the list */ + uint8_t nb_of_e_rabs; + /* list of e_rab setup-ed by RRC layers */ + e_rab_setup_t e_rabs[S1AP_MAX_E_RAB]; + + /* Number of e_rab failed to be setup in list */ + uint8_t nb_of_e_rabs_failed; + /* list of e_rabs that failed to be setup */ + e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB]; +} s1ap_e_rab_setup_resp_t; + + +// S1AP --> RRC messages +typedef struct s1ap_ue_release_command_s { + + unsigned eNB_ue_s1ap_id:24; + +} s1ap_ue_release_command_t; + + +//-------------------------------------------------------------------------------------------// +// S1AP <-- RRC messages +typedef struct s1ap_ue_release_req_s { + unsigned eNB_ue_s1ap_id:24; + s1ap_Cause_t cause; + long cause_value; +} s1ap_ue_release_req_t, s1ap_ue_release_resp_t; + +typedef struct s1ap_e_rab_modify_req_s { + /* UE id for initial connection to S1AP */ + uint16_t ue_initial_id; + + /* MME UE id */ + uint16_t mme_ue_s1ap_id; + + /* eNB ue s1ap id as initialized by S1AP layer */ + unsigned eNB_ue_s1ap_id:24; + + /* Number of e_rab to be modify in the list */ + uint8_t nb_e_rabs_tomodify; + + /* E RAB modify request */ + e_rab_t e_rab_modify_params[S1AP_MAX_E_RAB]; +} s1ap_e_rab_modify_req_t; + +typedef struct s1ap_e_rab_modify_resp_s { + unsigned eNB_ue_s1ap_id:24; + + /* Number of e_rab modify-ed in the list */ + uint8_t nb_of_e_rabs; + /* list of e_rab modify-ed by RRC layers */ + e_rab_modify_t e_rabs[S1AP_MAX_E_RAB]; + + /* Number of e_rab failed to be modify in list */ + uint8_t nb_of_e_rabs_failed; + /* list of e_rabs that failed to be modify */ + e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB]; +} s1ap_e_rab_modify_resp_t; + +typedef struct e_rab_release_s { + /* Unique e_rab_id for the UE. */ + uint8_t e_rab_id; +} e_rab_release_t; + +typedef struct s1ap_e_rab_release_command_s { + /* MME UE id */ + uint16_t mme_ue_s1ap_id; + + /* eNB ue s1ap id as initialized by S1AP layer */ + unsigned eNB_ue_s1ap_id:24; + + /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */ + nas_pdu_t nas_pdu; + + /* Number of e_rab to be released in the list */ + uint8_t nb_e_rabs_torelease; + + /* E RAB release command */ + e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB]; + +} s1ap_e_rab_release_command_t; + +typedef struct s1ap_e_rab_release_resp_s { + /* MME UE id */ + uint16_t mme_ue_s1ap_id; + + /* eNB ue s1ap id as initialized by S1AP layer */ + unsigned eNB_ue_s1ap_id:24; + + /* Number of e_rab released in the list */ + uint8_t nb_of_e_rabs_released; + + /* list of e_rabs released */ + e_rab_release_t e_rab_release[S1AP_MAX_E_RAB]; + + /* Number of e_rab failed to be released in list */ + uint8_t nb_of_e_rabs_failed; + /* list of e_rabs that failed to be released */ + e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB]; + +} s1ap_e_rab_release_resp_t; + +#endif /* S1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c new file mode 100644 index 0000000000..e164dc99db --- /dev/null +++ b/openair2/F1AP/CU_F1AP.c @@ -0,0 +1,1494 @@ +/* + * 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 openair2/F1AP/CU_F1AP.c +* \brief data structures for F1 interface modules +* \author EURECOM/NTUST +* \date 2018 +* \version 0.1 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, bing-kai.hong@eurecom.fr +* \note +* \warning +*/ + +#include "conversions.h" +#include "f1ap_common.h" +#include "f1ap_messages_types.h" +#include "platform_types.h" +#include "log.h" + +#define MAX_F1AP_BUFFER_SIZE 4096 + +/* This structure describes association of a DU to a CU */ +typedef struct f1ap_info { + + module_id_t enb_mod_idP; + module_id_t cu_mod_idP; + + /* 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 GNB_DU_ID; + + /* This is the optional name provided by the MME */ + char *GNB_CU_Name; + net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets + + + /* Number of input/ouput streams */ + uint16_t in_streams; + uint16_t out_streams; + + /* Connexion id used between SCTP/S1AP */ + uint16_t cnx_id; + + /* SCTP association id */ + int32_t assoc_id; + + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + +} f1ap_info_t; + +// helper functions +#define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 +#define NUMBER_OF_eNB_MAX 3 + +uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP) { + static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; + transaction_identifier[enb_mod_idP+cu_mod_idP] = (transaction_identifier[enb_mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; + //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+cu_mod_idP]); + return transaction_identifier[enb_mod_idP+cu_mod_idP]; +} + +// ============================================================================== + +void F1AP_CU_task() { + printf("Start F1AP CU task!\n"); + + sctp_cu_init(); + + // while (1) { + + // switch () { + + // case F1AP_ProcedureCode_id_F1Setup: + //CU_send_F1_SETUP_RESPONSE(); + //CU_send_DL_RRC_MESSAGE_TRANSFER(); // L436 + //CU_send_UE_CONTEXT_SETUP_REQUEST(); // god + //CU_send_UE_CONTEXT_MODIFICATION_REQUEST(); // oh my + // break; + + // default: + + // } // switch + + // } // while + + return NULL; +} + + +// ============================================================================== +//void CU_handle_F1_SETUP_REQUEST(struct F1AP_F1AP_PDU_t *message_p) { +void CU_handle_F1_SETUP_REQUEST() { + F1AP_F1AP_PDU_t pdu; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + /* Receiver */ + //f1ap_receiver(&buffer); + + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } + /* decode */ + //CU_F1AP_decode(args_p); + + /* handle */ + + // send successful callback + //CU_send_F1_SETUP_RESPONSE(); + // or failure callback + //CU_send_F1_SETUP_FAILURE(); + +} + +void CU_send_F1_SETUP_RESPONSE() { +//void CU_send_F1_SETUP_RESPONSE(F1AP_F1SetupResponse_t *F1SetupResponse) { + //AssertFatal(1==0,"Not implemented yet\n"); + + module_id_t enb_mod_idP; + module_id_t cu_mod_idP; + + enb_mod_idP = (module_id_t)12; + cu_mod_idP = (module_id_t)34; + + F1AP_F1AP_PDU_t pdu; + F1AP_F1SetupResponse_t *out; + F1AP_F1SetupResponseIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + f1ap_info_t f1ap_info; + f1ap_info.GNB_CU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); + pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; + pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_F1SetupResponse; + out = &pdu.choice.successfulOutcome->value.choice.F1SetupResponse; + + /* response_present_val */ + //F1AP_F1SetupResponseIEs__value_PR_TransactionID + //F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name + //F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List + + /* mandatory */ + /* c1. Transaction ID (integer value)*/ + ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c2. GNB_CU_Name */ + if (f1ap_info.GNB_CU_Name != NULL) { + ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_Name; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name; + OCTET_STRING_fromBuf(&ie->value.choice.GNB_CU_Name, f1ap_info.GNB_CU_Name, + strlen(f1ap_info.GNB_CU_Name)); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c3. cells to be Activated list */ + ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; + + + for (i=0; + i<1; + i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; + cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); + cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + + /* 3.1 cells to be Activated list item */ + F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; + memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_activated_list_item.nRCGI = nRCGI; + + /* optional */ + /* - nRPCI */ + if (0) { + cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 + } + + /* optional */ + /* - gNB-CU System Information */ + //if (1) { + + //} + /* ADD */ + cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, + cells_to_be_activated_list_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + // printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } + //printf("F1 setup response present = %d\n", out->value.present); + //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); + +} + +int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { + DevAssert(pdu != NULL); + DevAssert(buffer != NULL); + DevAssert(length != NULL); + + + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + + + ssize_t encoded; + + // asn_DEF_F1AP_F1SetupRequest + // asn_DEF_F1AP_F1AP_PDU + + /* We can safely free list of IE from sptr */ + //ASN_STRUCT_FREE_CONTENTS_ONLY(&asn_DEF_F1AP_F1SetupRequest, pdu); + + + if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, + pdu, + + (void **)buffer)) < 0) { + printf("\nencoded len = %ld\n", encoded); + return -1; + } + + printf("encoded len = %ld\n", encoded); + printf("buffer = \n"); + + int i_ret; + for (i_ret = 0; i_ret < encoded; i_ret++) { + printf("%x ", *((*buffer)+i_ret)); + } + printf("\n"); + *length = encoded; + // ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu); + return encoded; +} + + +int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { + + //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); + F1AP_F1AP_PDU_t pdu; + F1AP_F1AP_PDU_t *pdu_p = &pdu; + asn_dec_rval_t dec_ret; + + DevAssert(buffer != NULL); + + printf("buffer = \n"); + int i_ret; + for (i_ret = 0; i_ret < length; i_ret++) { + printf("%x ", *(buffer+i_ret)); + } + printf("\n"); + + memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t)); + + + dec_ret = aper_decode(NULL, + &asn_DEF_F1AP_F1AP_PDU, + (void **)&pdu_p, + buffer, + length, + 0, + 0); + + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); + + printf("\n"); + + printf("dec_ret.code = %d \n", dec_ret.code); + + AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n"); + + // switch(pdu_p->present) { + // case F1AP_F1AP_PDU_PR_initiatingpdu: + // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu); + + // case F1AP_F1AP_PDU_PR_successfulOutcome: + // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome); + + // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: + // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome); + + // default: + // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/ + // break; + // } + + //AssertFatal(1==0,"Shouldn't get here\n"); + return -1; +} + +void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure) { + AssertFatal(1==0,"Not implemented yet\n"); + //AssertFatal(1==0,"Not implemented yet\n"); + //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); +} + + +void CU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_send_RESET(F1AP_Reset_t *Reset) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_RESET(F1AP_Reset_t *Reset) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_handle_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +//void CU_send_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { +void CU_send_DL_RRC_MESSAGE_TRANSFER() { + F1AP_F1AP_PDU_t pdu; + F1AP_DLRRCMessageTransfer_t *out; + F1AP_DLRRCMessageTransferIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_DLRRCMessageTransfer; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer; + out = &pdu.choice.initiatingMessage->value.choice.DLRRCMessageTransfer; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. oldgNB_DU_UE_F1AP_ID */ + if (0) { + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + //ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING; + //ie->value.choice. = 1; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c4. SRBID */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID; + ie->value.choice.SRBID = 1L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c5. ExecuteDuplication */ + if (0) { + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ExecuteDuplication; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_ExecuteDuplication; + ie->value.choice.ExecuteDuplication = F1AP_ExecuteDuplication_true; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + // issue in here + /* mandatory */ + /* c6. RRCContainer */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1", strlen("asdsa1")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c7. RAT_FrequencyPriorityInformation */ + if (0) { + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation; + + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 123L; + + //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; + //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return -1; + } + + printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } + //AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_handle_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +//void CU_send_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { +void CU_send_UE_CONTEXT_SETUP_REQUEST() { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextSetupRequest_t *out; + F1AP_UEContextSetupRequestIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + f1ap_info_t f1ap_info; + f1ap_info.GNB_CU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextSetupRequest; + out = &pdu.choice.initiatingMessage->value.choice.UEContextSetupRequest; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c2. GNB_DU_UE_F1AP_ID */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c3. SpCell_ID */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI; + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + ie->value.choice.NRCGI = nRCGI; + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c4. ServCellIndex */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; + ie->value.choice.ServCellIndex = 2; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c5. CellULConfigured */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SpCellULConfigured; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CellULConfigured; + ie->value.choice.CellULConfigured = F1AP_CellULConfigured_ul; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c6. CUtoDURRCInformation */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; + ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); + /* optional */ + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); + /* optional */ + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c7. Candidate_SpCell_List */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; + + for (i=0; + i<1; + i++) { + + F1AP_Candidate_SpCell_ItemIEs_t *candidate_spCell_item_ies; + candidate_spCell_item_ies = (F1AP_Candidate_SpCell_ItemIEs_t *)calloc(1, sizeof(F1AP_Candidate_SpCell_ItemIEs_t)); + candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 + candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; + candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; + + /* 5.1 Candidate_SpCell_Item */ + F1AP_Candidate_SpCell_Item_t candidate_spCell_item; + memset((void *)&candidate_spCell_item, 0, sizeof(F1AP_Candidate_SpCell_Item_t)); + + /* - candidate_SpCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + candidate_spCell_item.candidate_SpCell_ID = nRCGI; + + /* ADD */ + candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item = candidate_spCell_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Candidate_SpCell_List.list, + candidate_spCell_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c8. DRXCycle */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRXCycle; + ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + if (0) { + ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); + *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum + } + if (0) { + ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); + *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c9. ResourceCoordinationTransferContainer */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ResourceCoordinationTransferContainer; + + ie->value.choice.ResourceCoordinationTransferContainer.buf = malloc(4); + ie->value.choice.ResourceCoordinationTransferContainer.size = 4; + *ie->value.choice.ResourceCoordinationTransferContainer.buf = "123"; + + + OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c10. SCell_ToBeSetup_List */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_ToBeSetup_ItemIEs_t *scell_toBeSetup_item_ies; + scell_toBeSetup_item_ies = (F1AP_SCell_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeSetup_ItemIEs_t)); + scell_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_Item; //53 + scell_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeSetup_item_ies->value.present = F1AP_SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; + + /* 8.1 SCell_ToBeSetup_Item */ + F1AP_SCell_ToBeSetup_Item_t scell_toBeSetup_item; + memset((void *)&scell_toBeSetup_item, 0, sizeof(F1AP_SCell_ToBeSetup_Item_t)); + + // /* - sCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + scell_toBeSetup_item.sCell_ID = nRCGI; + + /* sCellIndex */ + scell_toBeSetup_item.sCellIndex = 3; // issue here + // /* ADD */ + scell_toBeSetup_item_ies->value.choice.SCell_ToBeSetup_Item = scell_toBeSetup_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetup_List.list, + scell_toBeSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* mandatory */ + /* c11. SRBs_ToBeSetup_List */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List; + ie->criticality = F1AP_Criticality_reject; // ? + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_ToBeSetup_ItemIEs_t *srbs_toBeSetup_item_ies; + srbs_toBeSetup_item_ies = (F1AP_SRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeSetup_ItemIEs_t)); + srbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_Item; // 73 + srbs_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + srbs_toBeSetup_item_ies->value.present = F1AP_SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; + + /* 9.1 SRBs_ToBeSetup_Item */ + F1AP_SRBs_ToBeSetup_Item_t srbs_toBeSetup_item; + memset((void *)&srbs_toBeSetup_item, 0, sizeof(F1AP_SRBs_ToBeSetup_Item_t)); + + /* - sRBID */ + srbs_toBeSetup_item.sRBID = 50L; + + /* ADD */ + srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item = srbs_toBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetup_List.list, + srbs_toBeSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c12. DRBs_ToBeSetup_List */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_ToBeSetup_ItemIEs_t *drbs_toBeSetup_item_ies; + drbs_toBeSetup_item_ies = (F1AP_DRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetup_ItemIEs_t)); + drbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_Item; + drbs_toBeSetup_item_ies->criticality = F1AP_Criticality_reject; + drbs_toBeSetup_item_ies->value.present = F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; + + /* 10.1 SRBs_ToBeSetup_Item */ + F1AP_DRBs_ToBeSetup_Item_t drbs_toBeSetup_item; + memset((void *)&drbs_toBeSetup_item, 0, sizeof(F1AP_DRBs_ToBeSetup_Item_t)); + + /* dRBID */ + drbs_toBeSetup_item.dRBID = 30L; + + /* qoSInformation */ + drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 789L; + + /* ULTunnels_ToBeSetup_List */ + int maxnoofULTunnels = 1; // 2; + for (i=0; + i<maxnoofULTunnels; + i++) { + /* ULTunnels_ToBeSetup_Item */ + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; + uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1234", + strlen("1234")); + + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, &uLUPTNLInformation_ToBeSetup_Item); + } + + /* rLCMode */ + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; // enum + + /* OPTIONAL */ + /* ULConfiguration */ + if (0) { + drbs_toBeSetup_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + } + + /* ADD */ + drbs_toBeSetup_item_ies->value.choice.DRBs_ToBeSetup_Item = drbs_toBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeSetup_List.list, + drbs_toBeSetup_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* OPTIONAL */ + if (0) { + F1AP_InactivityMonitoringRequest_t InactivityMonitoringRequest; + F1AP_RAT_FrequencyPriorityInformation_t RAT_FrequencyPriorityInformation; + F1AP_RRCContainer_t RRCContainer; + F1AP_MaskedIMEISV_t MaskedIMEISV; + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return -1; + } + + printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } + //AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_handle_UE_CONTEXT_RELEASE_REQUEST(F1AP_UEContextReleaseRequest_t *UEContextReleaseRequest) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_send_UE_CONTEXT_RELEASE_COMMAND(F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_handle_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UEContextReleaseComplete) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +//void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { +void CU_send_UE_CONTEXT_MODIFICATION_REQUEST() { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextModificationRequest_t *out; + F1AP_UEContextModificationRequestIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + f1ap_info_t f1ap_info; + f1ap_info.GNB_CU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextModification; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextModificationRequest; + out = &pdu.choice.initiatingMessage->value.choice.UEContextModificationRequest; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. NRCGI */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_NRCGI; + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + ie->value.choice.NRCGI = nRCGI; + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c4. ServCellIndex */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex; + ie->value.choice.ServCellIndex = 5L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c5. DRXCycle */ + if (0) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRXCycle; + ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + if (0) { + ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); + *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum + } + if (0) { + ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); + *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c5. CUtoDURRCInformation */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_CUtoDURRCInformation; + ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); + /* optional */ + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); + /* optional */ + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c6. TransmissionStopIndicator */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransmissionStopIndicator; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionStopIndicator; + ie->value.choice.TransmissionStopIndicator = F1AP_TransmissionStopIndicator_true; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c7. ResourceCoordinationTransferContainer */ + if (0) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c7. RRCRconfigurationCompleteIndicator */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCRconfigurationCompleteIndicator; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCRconfigurationCompleteIndicator; + ie->value.choice.RRCRconfigurationCompleteIndicator = F1AP_RRCRconfigurationCompleteIndicator_true; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c8. RRCContainer */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c9. SCell_ToBeSetupMod_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_ToBeSetupMod_ItemIEs_t *scell_toBeSetupMod_item_ies; + scell_toBeSetupMod_item_ies = (F1AP_SCell_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeSetupMod_ItemIEs_t)); + //memset((void *)&scell_toBeSetupMod_item_ies, 0, sizeof(F1AP_SCell_ToBeSetupMod_ItemIEs_t)); + scell_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_Item; + scell_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeSetupMod_item_ies->value.present = F1AP_SCell_ToBeSetupMod_ItemIEs__value_PR_SCell_ToBeSetupMod_Item; + + /* 8.1 SCell_ToBeSetup_Item */ + F1AP_SCell_ToBeSetupMod_Item_t scell_toBeSetupMod_item; + memset((void *)&scell_toBeSetupMod_item, 0, sizeof(F1AP_SCell_ToBeSetupMod_Item_t)); + + // /* - sCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + scell_toBeSetupMod_item.sCell_ID = nRCGI; + + /* sCellIndex */ + scell_toBeSetupMod_item.sCellIndex = 6; // issue here + + // /* ADD */ + scell_toBeSetupMod_item_ies->value.choice.SCell_ToBeSetupMod_Item = scell_toBeSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetupMod_List.list, + scell_toBeSetupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c10. SCell_ToBeRemoved_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeRemoved_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_ToBeRemoved_ItemIEs_t *scell_toBeRemoved_item_ies; + scell_toBeRemoved_item_ies = (F1AP_SCell_ToBeRemoved_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); + //memset((void *)&scell_toBeRemoved_item_ies, 0, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); + scell_toBeRemoved_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_Item; + scell_toBeRemoved_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeRemoved_item_ies->value.present = F1AP_SCell_ToBeRemoved_ItemIEs__value_PR_SCell_ToBeRemoved_Item; + + /* 10.1 SCell_ToBeRemoved_Item */ + F1AP_SCell_ToBeRemoved_Item_t scell_toBeRemoved_item; + memset((void *)&scell_toBeRemoved_item, 0, sizeof(F1AP_SCell_ToBeRemoved_Item_t)); + + /* - sCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + scell_toBeRemoved_item.sCell_ID = nRCGI; + + /* ADD */ + scell_toBeRemoved_item_ies->value.choice.SCell_ToBeRemoved_Item = scell_toBeRemoved_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeRemoved_List.list, + scell_toBeRemoved_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c11. SRBs_ToBeSetupMod_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_ToBeSetupMod_ItemIEs_t *srbs_toBeSetupMod_item_ies; + srbs_toBeSetupMod_item_ies = (F1AP_SRBs_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeSetupMod_ItemIEs_t)); + //memset((void *)&srbs_toBeSetupMod_item_ies, 0, sizeof(F1AP_SRBs_ToBeSetupMod_ItemIEs_t)); + srbs_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_Item; + srbs_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + srbs_toBeSetupMod_item_ies->value.present = F1AP_SRBs_ToBeSetupMod_ItemIEs__value_PR_SRBs_ToBeSetupMod_Item; + + /* 9.1 SRBs_ToBeSetupMod_Item */ + F1AP_SRBs_ToBeSetupMod_Item_t srbs_toBeSetupMod_item; + memset((void *)&srbs_toBeSetupMod_item, 0, sizeof(F1AP_SRBs_ToBeSetupMod_Item_t)); + + /* - sRBID */ + srbs_toBeSetupMod_item.sRBID = 50L; + + /* ADD */ + srbs_toBeSetupMod_item_ies->value.choice.SRBs_ToBeSetupMod_Item = srbs_toBeSetupMod_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetupMod_List.list, + srbs_toBeSetupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c12. DRBs_ToBeSetupMod_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_ToBeSetupMod_ItemIEs_t *drbs_toBeSetupMod_item_ies; + drbs_toBeSetupMod_item_ies = (F1AP_DRBs_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetupMod_ItemIEs_t)); + drbs_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item; + drbs_toBeSetupMod_item_ies->criticality = F1AP_Criticality_reject; + drbs_toBeSetupMod_item_ies->value.present = F1AP_DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item; + + /* 12.1 DRBs_ToBeSetupMod_Item */ + F1AP_DRBs_ToBeSetupMod_Item_t drbs_toBeSetupMod_item; + memset((void *)&drbs_toBeSetupMod_item, 0, sizeof(F1AP_DRBs_ToBeSetupMod_Item_t)); + + /* dRBID */ + drbs_toBeSetupMod_item.dRBID = 30L; + + /* qoSInformation */ + drbs_toBeSetupMod_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS->qCI = 789L; + + /* ULTunnels_ToBeSetupMod_List */ + int j = 0; + int maxnoofULTunnels = 1; // 2; + for (j=0; + j<maxnoofULTunnels; + j++) { + /* ULTunnels_ToBeSetup_Item */ + + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; + uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "4567", + strlen("4567")); + + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_toBeSetupMod_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); + } + + /* rLCMode */ + drbs_toBeSetupMod_item.rLCMode = F1AP_RLCMode_rlc_um; // enum + + /* OPTIONAL */ + /* ULConfiguration */ + if (0) { + drbs_toBeSetupMod_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + } + + /* ADD */ + drbs_toBeSetupMod_item_ies->value.choice.DRBs_ToBeSetupMod_Item = drbs_toBeSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeSetupMod_List.list, + drbs_toBeSetupMod_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c13. DRBs_ToBeModified_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_ToBeModified_ItemIEs_t *drbs_toBeModified_item_ies; + drbs_toBeModified_item_ies = (F1AP_DRBs_ToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeModified_ItemIEs_t)); + drbs_toBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_Item; + drbs_toBeModified_item_ies->criticality = F1AP_Criticality_reject; + drbs_toBeModified_item_ies->value.present = F1AP_DRBs_ToBeModified_ItemIEs__value_PR_DRBs_ToBeModified_Item; + + /* 13.1 SRBs_ToBeModified_Item */ + F1AP_DRBs_ToBeModified_Item_t drbs_toBeModified_item; + memset((void *)&drbs_toBeModified_item, 0, sizeof(F1AP_DRBs_ToBeModified_Item_t)); + + /* dRBID */ + drbs_toBeModified_item.dRBID = 30L; + + /* qoSInformation */ + drbs_toBeModified_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS->qCI = 789L; + + /* ULTunnels_ToBeModified_List */ + int j = 0; + int maxnoofULTunnels = 1; // 2; + for (j=0; + j<maxnoofULTunnels; + j++) { + /* ULTunnels_ToBeModified_Item */ + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; + uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_toBeModified_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); + } + + /* OPTIONAL */ + /* ULConfiguration */ + if (0) { + drbs_toBeModified_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + } + + /* ADD */ + drbs_toBeModified_item_ies->value.choice.DRBs_ToBeModified_Item = drbs_toBeModified_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeModified_List.list, + drbs_toBeModified_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c14. SRBs_ToBeReleased_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeReleased_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_ToBeReleased_ItemIEs_t *srbs_toBeReleased_item_ies; + srbs_toBeReleased_item_ies = (F1AP_SRBs_ToBeReleased_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeReleased_ItemIEs_t)); + //memset((void *)&srbs_toBeReleased_item_ies, 0, sizeof(F1AP_SRBs_ToBeReleased_ItemIEs_t)); + srbs_toBeReleased_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_Item; + srbs_toBeReleased_item_ies->criticality = F1AP_Criticality_ignore; + srbs_toBeReleased_item_ies->value.present = F1AP_SRBs_ToBeReleased_ItemIEs__value_PR_SRBs_ToBeReleased_Item; + + /* 9.1 SRBs_ToBeReleased_Item */ + F1AP_SRBs_ToBeReleased_Item_t srbs_toBeReleased_item; + memset((void *)&srbs_toBeReleased_item, 0, sizeof(F1AP_SRBs_ToBeReleased_Item_t)); + + /* - sRBID */ + srbs_toBeReleased_item.sRBID = 50L; + + /* ADD */ + srbs_toBeReleased_item_ies->value.choice.SRBs_ToBeReleased_Item = srbs_toBeReleased_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeReleased_List.list, + srbs_toBeReleased_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c15. DRBs_ToBeReleased_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_ToBeReleased_ItemIEs_t *drbs_toBeReleased_item_ies; + drbs_toBeReleased_item_ies = (F1AP_DRBs_ToBeReleased_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeReleased_ItemIEs_t)); + drbs_toBeReleased_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_Item; + drbs_toBeReleased_item_ies->criticality = F1AP_Criticality_reject; + drbs_toBeReleased_item_ies->value.present = F1AP_DRBs_ToBeReleased_ItemIEs__value_PR_DRBs_ToBeReleased_Item; + + /* 14.1 SRBs_ToBeReleased_Item */ + F1AP_DRBs_ToBeReleased_Item_t drbs_toBeReleased_item; + memset((void *)&drbs_toBeReleased_item, 0, sizeof(F1AP_DRBs_ToBeReleased_Item_t)); + + /* dRBID */ + drbs_toBeReleased_item.dRBID = 30L; + + /* ADD */ + drbs_toBeReleased_item_ies->value.choice.DRBs_ToBeReleased_Item = drbs_toBeReleased_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeReleased_List.list, + drbs_toBeReleased_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return -1; + } + + printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } + +} + +void CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(F1AP_UEContextModificationFailure_t EContextModificationFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(F1AP_UEContextModificationRequired_t *UEContextModificationRequired) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +static int F1AP_CU_decode_initiating_message(F1AP_InitiatingMessage_t *initiating_p) { + + switch (initiating_p->value.present) { + + case F1AP_InitiatingMessage__value_PR_NOTHING: /* No components present */ + AssertFatal(1==0,"Should not receive NOTHING on CU\n"); + break; + + case F1AP_InitiatingMessage__value_PR_Reset: + CU_send_RESET(&initiating_p->value.choice.Reset); + break; + case F1AP_InitiatingMessage__value_PR_F1SetupRequest: + CU_handle_F1_SETUP_REQUEST(&initiating_p->value.choice.F1SetupRequest); + break; + case F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate: + AssertFatal(1==0,"Should not receive GNBDUConfigurationUpdate on CU\n"); + break; + case F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate: + CU_handle_gNB_CU_CONFIGURATION_UPDATE(&initiating_p->value.choice.GNBCUConfigurationUpdate); + break; + case F1AP_InitiatingMessage__value_PR_UEContextSetupRequest: + CU_handle_UE_CONTEXT_SETUP_REQUEST(&initiating_p->value.choice.UEContextSetupRequest); + break; + case F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand: + CU_handle_UE_CONTEXT_SETUP_RELEASE_COMMAND(&initiating_p->value.choice.UEContextReleaseCommand); + break; + case F1AP_InitiatingMessage__value_PR_UEContextModificationRequest: + CU_handle_UE_CONTEXT_MODIFICATION_REQUEST(&initiating_p->value.choice.UEContextModificationRequest); + break; + case F1AP_InitiatingMessage__value_PR_UEContextModificationRequired: + AssertFatal(1==0,"Should not receive UECONTEXTMODIFICATIONREQUIRED on CU\n"); + break; + case F1AP_InitiatingMessage__value_PR_ErrorIndication: + AssertFatal(1==0,"Should not receive ErrorIndication on CU\n"); + break; + case F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest: + AssertFatal(1==0,"Should not receive UECONTEXTRELEASEREQUEST on CU\n"); + break; + case F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer: + CU_handle_DL_RRC_MESSAGE_TRANSFER(&initiating_p->value.choice.DLRRCMessageTransfer); + break; + case F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer: + AssertFatal(1==0,"Should not receive ULRRCMESSAGETRANSFER on CU\n"); + break; + case F1AP_InitiatingMessage__value_PR_PrivateMessage: + AssertFatal(1==0,"Should not receive PRIVATEMESSAGE on CU\n"); + break; + default: + AssertFatal(1==0,"Shouldn't get here\n"); + } + +} + +static int F1AP_CU_decode_successful_outcome(F1AP_SuccessfulOutcome_t *successfulOutcome_p) +{ + + switch (successfulOutcome_p->value.present) { + + case F1AP_SuccessfulOutcome__value_PR_NOTHING: /* No components present */ + AssertFatal(1==0,"Should not received NOTHING!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_ResetAcknowledge: + AssertFatal(1==0,"CU Should not receive ResetAcknowled!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_F1SetupResponse: + AssertFatal(1==0,"CU Should not receive F1SetupResponse!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: + CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(successfulOutcome_p->value.choice.GNBDUConfigurationUpdateAcknowledge); + break; + case F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge: + AssertFatal(1==0,"CU Should not receive GNBCUConfigurationUpdateAcknowledge!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse: + AssertFatal(1==0,"CU Should not receive UEContextSetupResponse!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete: + AssertFatal(1==0,"CU Should not receive UEContextReleaseComplete!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse: + AssertFatal(1==0,"CU Should not receive UEContextModificationResponse!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_UEContextModificationConfirm: + CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(successfulOutcome_p->value.choice.UEContextModificationConfirm); + break; + } +} + +static int F1AP_CU_decode_unsuccessful_outcome(F1AP_UnsuccessfulOutcome_t *unSuccessfulOutcome_p) +{ + + switch (unSuccessfulOutcome_p->value.present) { + + case F1AP_UnsuccessfulOutcome__value_PR_NOTHING: + AssertFatal(1==0,"Should not receive NOTHING!\n"); + break; /* No components present */ + case F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure: + AssertFatal(1==0,"Should not receive F1SetupFailure\n"); + break; + case F1AP_UnsuccessfulOutcome__value_PR_GNBDUConfigurationUpdateFailure: + CU_handle_gNB_CU_CONFIGURATION_FAILURE(unSuccessfulOutcome_p->value.choice.GNBDUConfigurationUpdateFailure); + break; + case F1AP_UnsuccessfulOutcome__value_PR_GNBCUConfigurationUpdateFailure: + AssertFatal(1==0,"Should not receive GNBCUConfigurationUpdateFailure\n"); + break; + case F1AP_UnsuccessfulOutcome__value_PR_UEContextSetupFailure: + CU_handle_UE_CONTEXT_SETUP_FAILURE(unSuccessfulOutcome_p->value.choice.UEContextSetupFailure); + break; + case F1AP_UnsuccessfulOutcome__value_PR_UEContextModificationFailure: + CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(unSuccessfulOutcome_p->value.choice.UEContextModificationFailure); + break; + } + +} diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c new file mode 100644 index 0000000000..4d9f0cc5f8 --- /dev/null +++ b/openair2/F1AP/DU_F1AP.c @@ -0,0 +1,1506 @@ +/* + * 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 openair2/F1AP/DU_F1AP.c +* \brief data structures for F1 interface modules +* \author EURECOM/NTUST +* \date 2018 +* \version 0.1 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, bing-kai.hong@eurecom.fr +* \note +* \warning +*/ + +#include "conversions.h" +#include "f1ap_common.h" +#include "f1ap_messages_types.h" +#include "platform_types.h" +#include "log.h" + +/* This structure describes association of a DU to a CU */ +typedef struct f1ap_info { + + module_id_t enb_mod_idP; + module_id_t du_mod_idP; + + /* 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 GNB_DU_ID; + + /* This is the optional name provided by the MME */ + char *GNB_DU_Name; + net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets + + + /* Number of input/ouput streams */ + uint16_t in_streams; + uint16_t out_streams; + + /* Connexion id used between SCTP/S1AP */ + uint16_t cnx_id; + + /* SCTP association id */ + int32_t assoc_id; + + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + +} f1ap_info_t; + +// helper functions +#define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 +#define NUMBER_OF_eNB_MAX 3 + +uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t du_mod_idP) { + static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; + transaction_identifier[enb_mod_idP+du_mod_idP] = (transaction_identifier[enb_mod_idP+du_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; + //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]); + return transaction_identifier[enb_mod_idP+du_mod_idP]; +} + +// ============================================================================== + +void F1AP_DU_task() { + printf("Start F1AP DU task!\n"); + + sctp_du_init(); + + // while (1) { + + // switch () { + + // case F1AP_ProcedureCode_id_F1Setup: + //DU_send_F1_SETUP_REQUEST((module_id_t)1, (module_id_t)2); + // break; + //DU_send_UL_RRC_MESSAGE_TRANSFER(); // OK + //DU_send_UE_CONTEXT_SETUP_RESPONSE(); // OK + DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(); // OK + // default: + + // } // switch + + // } // while + + return NULL; +} + + +// ============================================================================== + + +// SETUP REQUEST +void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP) { +//void DU_send_F1_SETUP_REQUEST(F1SetupRequest_t *F1SetupRequest) { + F1AP_F1AP_PDU_t pdu; + F1AP_F1SetupRequest_t *out; + F1AP_F1SetupRequestIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + // for test + f1ap_info_t f1ap_info; + f1ap_info.GNB_DU_ID = 789; + f1ap_info.GNB_DU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 3; + + /* Create */ + /* 0. pdu Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_F1Setup; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_F1SetupRequest; + out = &pdu.choice.initiatingMessage->value.choice.F1SetupRequest; + + /* mandatory */ + /* c1. Transaction ID (integer value) */ + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_ID (integrer value) */ + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID; + asn_int642INTEGER(&ie->value.choice.GNB_DU_ID, f1ap_info.GNB_DU_ID); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. GNB_DU_Name */ + if (f1ap_info.GNB_DU_Name != NULL) { + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name; + OCTET_STRING_fromBuf(&ie->value.choice.GNB_DU_Name, f1ap_info.GNB_DU_Name, + strlen(f1ap_info.GNB_DU_Name)); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c4. serverd cells list */ + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; + + for (i=0; + i<1; + i++) { + /* mandatory */ + /* 4.1 serverd cells item */ + + F1AP_GNB_DU_Served_Cells_ItemIEs_t *gnb_du_served_cell_list_item_ies; + gnb_du_served_cell_list_item_ies = (F1AP_GNB_DU_Served_Cells_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_DU_Served_Cells_ItemIEs_t)); + gnb_du_served_cell_list_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_DU_Served_Cells_Item; + gnb_du_served_cell_list_item_ies->criticality = F1AP_Criticality_reject; + gnb_du_served_cell_list_item_ies->value.present = F1AP_GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item; + + + F1AP_GNB_DU_Served_Cells_Item_t gnb_du_served_cells_item; + memset((void *)&gnb_du_served_cells_item, 0, sizeof(F1AP_GNB_DU_Served_Cells_Item_t)); + + /* 4.1.1 serverd cell Information */ + F1AP_Served_Cell_Information_t served_cell_information; + + memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &nRCGI.pLMN_Identity); + + + //INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); + nRCGI.nRCellIdentity.buf = malloc((36+7)/8); + + nRCGI.nRCellIdentity.size = (36+7)/8; + nRCGI.nRCellIdentity.bits_unused = 4; + + nRCGI.nRCellIdentity.buf[0] = 123; + + //nRCGI.nRCellIdentity = 15; + served_cell_information.nRCGI = nRCGI; + + /* - nRPCI */ + served_cell_information.nRPCI = 321; // int 0..1007 + + /* - fiveGS_TAC */ + OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + "10", + 3); + + /* - Configured_EPS_TAC */ + if(1){ + served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + "2", + 2); + } + + /* - broadcast PLMNs */ + int maxnoofBPLMNS = 1; + for (i=0; + i<maxnoofBPLMNS; + i++) { + /* > PLMN BroadcastPLMNs Item */ + F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); + //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &broadcastPLMNs_Item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); + } + + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t nR_Mode_Info; + + if ("FDD") { + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + /* > FDD >> FDD Info */ + F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* >>> UL NRFreqInfo */ + fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; + + F1AP_FreqBandNrItem_t ul_freqBandNrItem; + memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + ul_freqBandNrItem.freqBandIndicatorNr = 888L; + + F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; + memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + + /* >>> DL NRFreqInfo */ + fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; + + F1AP_FreqBandNrItem_t dl_freqBandNrItem; + memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + dl_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; + memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + + /* >>> UL Transmission Bandwidth */ + fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + /* >>> DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.fDD = fDD_Info; + } else { // TDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + + /* > TDD >> TDD Info */ + F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + /* >>> ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + nr_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + + tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; + tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.tDD = tDD_Info; + } + + served_cell_information.nR_Mode_Info = nR_Mode_Info; + + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = "0"; // sept. 2018 + + OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + gnb_du_served_cells_item.served_Cell_Information = served_cell_information; // + + /* 4.1.2 gNB-DU System Information */ + F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + "1", + sizeof("1")); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + "1", + sizeof("1")); + gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; // + + /* ADD */ + gnb_du_served_cell_list_item_ies->value.choice.GNB_DU_Served_Cells_Item = gnb_du_served_cells_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.GNB_DU_Served_Cells_List.list, + gnb_du_served_cell_list_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + //printf("F1 setup request present = %d\n", ie.value.present); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + f1ap_du_send_message(buffer, len); + // printf("\n"); + + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + // int req; + // req = s1ap_eNB_encode_s1_setup_request(&ie, &buffer, &len); + + //printf("encode F1 setup request, req = %d \n", req); + + //f1ap_eNB_itti_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); + /* send Not Use ITTI */ + //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); + +} + +// ============================================================================== + +int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { + DevAssert(pdu != NULL); + DevAssert(buffer != NULL); + DevAssert(length != NULL); + + + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + + + ssize_t encoded; + + // asn_DEF_F1AP_F1SetupRequest + // asn_DEF_F1AP_F1AP_PDU + + /* We can safely free list of IE from sptr */ + //ASN_STRUCT_FREE_CONTENTS_ONLY(&asn_DEF_F1AP_F1SetupRequest, pdu); + + + if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, + pdu, + (void **)buffer)) < 0) { + printf("encoded len = %ld\n", encoded); + return -1; + } + + printf("encoded len = %ld\n", encoded); + printf("buffer = \n"); + + int i_ret; + for (i_ret = 0; i_ret < encoded; i_ret++) { + printf("%x ", *((*buffer)+i_ret)); + } + printf("\n"); + *length = encoded; + //ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu); + return encoded; +} + + +int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { + + //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); + F1AP_F1AP_PDU_t pdu; + F1AP_F1AP_PDU_t *pdu_p = &pdu; + asn_dec_rval_t dec_ret; + + DevAssert(buffer != NULL); + + printf("buffer = \n"); + int i_ret; + for (i_ret = 0; i_ret < length; i_ret++) { + printf("%x ", *(buffer+i_ret)); + } + printf("\n"); + + memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t)); + + + dec_ret = aper_decode(NULL, + &asn_DEF_F1AP_F1AP_PDU, + (void **)&pdu_p, + buffer, + length, + 0, + 0); + + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); + + printf("\n"); + + printf("dec_ret.code = %d \n", dec_ret.code); + + AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n"); + + // switch(pdu_p->present) { + // case F1AP_F1AP_PDU_PR_initiatingpdu: + // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu); + + // case F1AP_F1AP_PDU_PR_successfulOutcome: + // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome); + + // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: + // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome); + + // default: + // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/ + // break; + // } + + //AssertFatal(1==0,"Shouldn't get here\n"); + return -1; +} + + +// ssize_t s1ap_generate_initiating_pdu( +// uint8_t **buffer, +// uint32_t *length, +// F1AP_ProcedureCode_t procedureCode, +// F1AP_Criticality_t criticality, +// asn_TYPE_descriptor_t *td, +// void *sptr) +// { +// F1AP_F1AP_PDU_t pdu; +// ssize_t encoded; + +// memset(&pdu, 0, sizeof(F1AP_F1AP_PDU_t)); + +// pdu.present = F1AP_F1AP_PDU_PR_initiatingpdu; +// pdu.choice.initiatingpdu = (F1AP_Initiatingpdu_t *)calloc(1, sizeof(F1AP_Initiatingpdu_t)); +// pdu.choice.initiatingpdu->procedureCode = procedureCode; +// pdu.choice.initiatingpdu->criticality = criticality; +// //ANY_fromType_aper(&pdu.choice.initiatingpdu->value, td, sptr); + +// //if (asn1_xer_print) { +// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, (void *)&pdu); +// //} + +// /* We can safely free list of IE from sptr */ +// ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); + +// if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, &pdu, +// (void **)buffer)) < 0) { +// return -1; +// } + +// *length = encoded; +// return encoded; +// } + +// int s1ap_eNB_encode_s1_setup_request( +// F1AP_F1SetupRequestIEs_t *s1SetupRequestIEs, +// uint8_t **buffer, +// uint32_t *length) +// { +// F1AP_F1SetupRequestIEs_t s1SetupRequest; +// F1AP_F1SetupRequestIEs_t *s1SetupRequest_p = &s1SetupRequest; + +// memset((void *)s1SetupRequest_p, 0, sizeof(s1SetupRequest)); + +// if (s1ap_encode_s1ap_s1setuprequesties(s1SetupRequest_p, s1SetupRequestIEs) < 0) { +// return -1; +// } + +// return s1ap_generate_initiating_pdu(buffer, +// length, +// F1AP_ProcedureCode_id_F1Setup, +// F1AP_Criticality_reject, +// &asn_DEF_F1AP_F1SetupRequest, +// s1SetupRequest_p); +// } + + + + +// SETUP SUCCESSFUL +void DU_handle_F1_SETUP_RESPONSE(struct F1AP_F1AP_PDU_t *pdu_p) { + + /* decode */ + //DU_F1AP_decode(args_p); + + /* handle */ + + /* save state */ +} + +// ============================================================================== + +// SETUP FAILURE +void DU_handle_F1_SETUP_FAILURE(struct F1AP_F1AP_PDU_t *pdu_p) { + //AssertFatal(1==0,"Not implemented yet\n"); + + //F1AP_F1SetupFailureIEs_t *f1_setup_failure_p; + //f1_setup_failure_p = &pdu_p.choice.unsuccessfulOutcome.value.choice.F1SetupFailureIEs.protocolIEs; + +} + + + +void DU_send_ERROR_INDICATION(struct F1AP_F1AP_PDU_t *pdu_p) { + //AssertFatal(1==0,"Not implemented yet\n"); + + //F1AP_F1ErrorIndicationIEs_t *f1_error_indication_p; + //f1_error_indication_p = &pdu_p.choice.successfulOutcome.value.choice.F1ErrorIndicationIEs.protocolIEs; +} + + +void DU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_handle_RESET(F1AP_Reset_t *Reset) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_RESET(F1AP_Reset_t *Reset) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +//void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { +void DU_send_UL_RRC_MESSAGE_TRANSFER() { + F1AP_F1AP_PDU_t pdu; + F1AP_ULRRCMessageTransfer_t *out; + F1AP_ULRRCMessageTransferIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_ULRRCMessageTransfer; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer; + out = &pdu.choice.initiatingMessage->value.choice.ULRRCMessageTransfer; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. SRBID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; + ie->value.choice.SRBID = 1; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // issue in here + /* mandatory */ + /* c4. RRCContainer */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + printf("\n"); + + f1ap_du_send_message(buffer, len); + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + //AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpdateAcknowledge_t GNBDUConfigurationUpdateAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_handle_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_handle_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +//void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { +void DU_send_UE_CONTEXT_SETUP_RESPONSE() { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextSetupResponse_t *out; + F1AP_UEContextSetupResponseIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + f1ap_info_t f1ap_info; + f1ap_info.GNB_DU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); + pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse; + out = &pdu.choice.successfulOutcome->value.choice.UEContextSetupResponse; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. DUtoCURRCInformation */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; + + OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", + strlen("asdsa")); + /* OPTIONAL */ + if (0) { + ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); + OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa", + strlen("asdsa")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c4. ResourceCoordinationTransferContainer */ + if (0) { + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa", + strlen("asdsa")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + // /* */ + /* c5. DRBs_Setup_List */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_Setup_ItemIEs_t *drbs_setup_item_ies; + drbs_setup_item_ies = (F1AP_DRBs_Setup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_Setup_ItemIEs_t)); + drbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_Item; + drbs_setup_item_ies->criticality = F1AP_Criticality_ignore; + drbs_setup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; + + /* 5.1 DRBs_Setup_Item */ + F1AP_DRBs_Setup_Item_t drbs_setup_item; + memset((void *)&drbs_setup_item, 0, sizeof(F1AP_DRBs_Setup_Item_t)); + + drbs_setup_item.dRBID = 12; + + int j; + for (j=0; + j<1; + j++) { + + F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; + dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + // F1AP_TransportLayerAddress_t transportLayerAddress; + // transportLayerAddress.buf = malloc((36+7)/8); + // transportLayerAddress.size = (36+7)/8; + // transportLayerAddress.bits_unused = 4; + // *transportLayerAddress.buf = 123; + // dLUPTNLInformation_ToBeSetup_Item.dL_GTP_Tunnel_EndPoint.transportLayerAddress = transportLayerAddress; + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_setup_item.dLUPTNLInformation_ToBeSetup_List.list, + dLUPTNLInformation_ToBeSetup_Item); + } + + // /* ADD */ + drbs_setup_item_ies->value.choice.DRBs_Setup_Item = drbs_setup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Setup_List.list, + drbs_setup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c6. SRBs_FailedToBeSetup_List */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_FailedToBeSetup_ItemIEs_t *srbs_failedToBeSetup_item_ies; + srbs_failedToBeSetup_item_ies = (F1AP_SRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetup_ItemIEs_t)); + srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; + srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; + + /* 6.1 SRBs_Setup_Item */ + F1AP_SRBs_FailedToBeSetup_Item_t srbs_failedToBeSetup_item; + memset((void *)&srbs_failedToBeSetup_item, 0, sizeof(F1AP_SRBs_FailedToBeSetup_Item_t)); + + srbs_failedToBeSetup_item.sRBID = 13; + srbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + srbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + srbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; + + // /* ADD */ + srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item = srbs_failedToBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetup_List.list, + srbs_failedToBeSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c7. DRBs_FailedToBeSetup_List */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_FailedToBeSetup_ItemIEs_t *drbs_failedToBeSetup_item_ies; + drbs_failedToBeSetup_item_ies = (F1AP_DRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetup_ItemIEs_t)); + drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; + drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; + + /* 7.1 DRBs_Setup_Item */ + F1AP_DRBs_FailedToBeSetup_Item_t drbs_failedToBeSetup_item; + memset((void *)&drbs_failedToBeSetup_item, 0, sizeof(F1AP_DRBs_FailedToBeSetup_Item_t)); + + drbs_failedToBeSetup_item.dRBID = 14; + drbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + drbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + drbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; + + // /* ADD */ + drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item = drbs_failedToBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetup_List.list, + drbs_failedToBeSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c8. SCell_FailedtoSetup_List */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_FailedtoSetup_ItemIEs_t *sCell_FailedtoSetup_item_ies; + sCell_FailedtoSetup_item_ies = (F1AP_SCell_FailedtoSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetup_ItemIEs_t)); + sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; + sCell_FailedtoSetup_item_ies->criticality = F1AP_Criticality_ignore; + sCell_FailedtoSetup_item_ies->value.present = F1AP_SCell_FailedtoSetup_ItemIEs__value_PR_SCell_FailedtoSetup_Item; + + /* 8.1 DRBs_Setup_Item */ + F1AP_SCell_FailedtoSetup_Item_t sCell_FailedtoSetup_item; + memset((void *)&sCell_FailedtoSetup_item, 0, sizeof(F1AP_SCell_FailedtoSetup_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; // issue here + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &nRCGI.pLMN_Identity); +// + // INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); + // nRCGI.nRCellIdentity.buf = malloc((36+7)/8); + + // nRCGI.nRCellIdentity.size = (36+7)/8; + // nRCGI.nRCellIdentity.bits_unused = 4; + + // nRCGI.nRCellIdentity.buf[0] = 123; + + //nRCGI.nRCellIdentity = 15; + + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + sCell_FailedtoSetup_item.sCell_ID = nRCGI; + + sCell_FailedtoSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + sCell_FailedtoSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + sCell_FailedtoSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; + + // /* ADD */ + sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item = sCell_FailedtoSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetup_List.list, + sCell_FailedtoSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c9. CriticalityDiagnostics */ + if (0) { + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_CriticalityDiagnostics; + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + *ie->value.choice.CriticalityDiagnostics.transactionID = 0; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return -1; + } + + printf("\n"); + + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + f1ap_du_send_message(buffer, len); +} + +void DU_send_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_send_UE_CONTEXT_RELEASE_REQUEST(F1AP_UEContextReleaseRequest_t *UEContextReleaseRequest) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_handle_UE_CONTEXT_RELEASE_COMMAND(F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_send_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UEContextReleaseComplete) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +//void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { +void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE() { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextModificationResponse_t *out; + F1AP_UEContextModificationResponseIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + f1ap_info_t f1ap_info; + f1ap_info.GNB_DU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); + pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextModification; + pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse; + out = &pdu.choice.successfulOutcome->value.choice.UEContextModificationResponse; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. ResourceCoordinationTransferContainer */ + if (0) { + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c4. DUtoCURRCInformation */ + if (0) { + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation; + + OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + /* OPTIONAL */ + if (1) { + ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); + OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + } + + + /* mandatory */ + /* c5. DRBs_SetupMod_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_SetupMod_ItemIEs_t *drbs_setupMod_item_ies; + drbs_setupMod_item_ies = (F1AP_DRBs_SetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_SetupMod_ItemIEs_t)); + drbs_setupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_Item; + drbs_setupMod_item_ies->criticality = F1AP_Criticality_reject; + drbs_setupMod_item_ies->value.present = F1AP_DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item; + + /* 10.1 DRBs_SetupMod_Item */ + F1AP_DRBs_SetupMod_Item_t drbs_setupMod_item; + memset((void *)&drbs_setupMod_item, 0, sizeof(F1AP_DRBs_SetupMod_Item_t)); + + /* dRBID */ + drbs_setupMod_item.dRBID = 30L; + + /* DLTunnels_SetupMod_List */ + int j = 0; + int maxnoofDLUPTNLInformation = 1; // 2; + for (j=0; + j<maxnoofDLUPTNLInformation; + j++) { + /* DLTunnels_ToBeSetup_Item */ + F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; + dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_setupMod_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); + } + + /* ADD */ + drbs_setupMod_item_ies->value.choice.DRBs_SetupMod_Item = drbs_setupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_SetupMod_List.list, + drbs_setupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c6. DRBs_Modified_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_Modified_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_Modified_ItemIEs_t *drbs_modified_item_ies; + drbs_modified_item_ies = (F1AP_DRBs_Modified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_Modified_ItemIEs_t)); + drbs_modified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_Item; + drbs_modified_item_ies->criticality = F1AP_Criticality_reject; + drbs_modified_item_ies->value.present = F1AP_DRBs_Modified_ItemIEs__value_PR_DRBs_Modified_Item; + + /* 13.1 SRBs_modified_Item */ + F1AP_DRBs_Modified_Item_t drbs_modified_item; + memset((void *)&drbs_modified_item, 0, sizeof(F1AP_DRBs_Modified_Item_t)); + + /* dRBID */ + drbs_modified_item.dRBID = 25L; + + /* ULTunnels_Modified_List */ + int maxnoofULTunnels = 1; // 2; + int j = 0; + for (j=0; + j<maxnoofULTunnels; + j++) { + /* DLTunnels_Modified_Item */ + F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; + dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_modified_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); + } + + /* ADD */ + drbs_modified_item_ies->value.choice.DRBs_Modified_Item = drbs_modified_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Modified_List.list, + drbs_modified_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c7. SRBs_FailedToBeSetupMod_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SRBs_FailedToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *srbs_failedToBeSetupMod_item_ies; + srbs_failedToBeSetupMod_item_ies = (F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t)); + srbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_Item; + srbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + srbs_failedToBeSetupMod_item_ies->value.present = F1AP_SRBs_FailedToBeSetupMod_ItemIEs__value_PR_SRBs_FailedToBeSetupMod_Item; + + /* 9.1 SRBs_FailedToBeSetupMod_Item */ + F1AP_SRBs_FailedToBeSetupMod_Item_t srbs_failedToBeSetupMod_item; + memset((void *)&srbs_failedToBeSetupMod_item, 0, sizeof(F1AP_SRBs_FailedToBeSetupMod_Item_t)); + + /* - sRBID */ + srbs_failedToBeSetupMod_item.sRBID = 50L; + + srbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + srbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; + srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + + /* ADD */ + srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item = srbs_failedToBeSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetupMod_List.list, + srbs_failedToBeSetupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c8. DRBs_FailedToBeSetupMod_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *drbs_failedToBeSetupMod_item_ies; + drbs_failedToBeSetupMod_item_ies = (F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t)); + drbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_Item; + drbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_reject; + drbs_failedToBeSetupMod_item_ies->value.present = F1AP_DRBs_FailedToBeSetupMod_ItemIEs__value_PR_DRBs_FailedToBeSetupMod_Item; + + /* 10.1 DRBs_ToBeSetupMod_Item */ + F1AP_DRBs_FailedToBeSetupMod_Item_t drbs_failedToBeSetupMod_item; + memset((void *)&drbs_failedToBeSetupMod_item, 0, sizeof(F1AP_DRBs_FailedToBeSetupMod_Item_t)); + + /* dRBID */ + drbs_failedToBeSetupMod_item.dRBID = 30L; + + drbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + drbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; + drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + + /* ADD */ + drbs_failedToBeSetupMod_item_ies->value.choice.DRBs_FailedToBeSetupMod_Item = drbs_failedToBeSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetupMod_List.list, + drbs_failedToBeSetupMod_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c9. SCell_FailedtoSetupMod_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SCell_FailedtoSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_FailedtoSetupMod_ItemIEs_t *scell_failedtoSetupMod_item_ies; + scell_failedtoSetupMod_item_ies = (F1AP_SCell_FailedtoSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetupMod_ItemIEs_t)); + scell_failedtoSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_Item; + scell_failedtoSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + scell_failedtoSetupMod_item_ies->value.present = F1AP_SCell_FailedtoSetupMod_ItemIEs__value_PR_SCell_FailedtoSetupMod_Item; + + /* 8.1 SCell_ToBeSetup_Item */ + F1AP_SCell_FailedtoSetupMod_Item_t scell_failedtoSetupMod_item; + memset((void *)&scell_failedtoSetupMod_item, 0, sizeof(F1AP_SCell_FailedtoSetupMod_Item_t)); + + /* - sCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + scell_failedtoSetupMod_item.sCell_ID = nRCGI; + + scell_failedtoSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + scell_failedtoSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; + scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + + /* ADD */ + scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item = scell_failedtoSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetupMod_List.list, + scell_failedtoSetupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c10. DRBs_FailedToBeModified_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeModified_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_FailedToBeModified_ItemIEs_t *drbs_failedToBeModified_item_ies; + drbs_failedToBeModified_item_ies = (F1AP_DRBs_FailedToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeModified_ItemIEs_t)); + drbs_failedToBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_Item; + drbs_failedToBeModified_item_ies->criticality = F1AP_Criticality_reject; + drbs_failedToBeModified_item_ies->value.present = F1AP_DRBs_FailedToBeModified_ItemIEs__value_PR_DRBs_FailedToBeModified_Item; + + /* 13.1 DRBs_FailedToBeModified_Item */ + F1AP_DRBs_FailedToBeModified_Item_t drbs_failedToBeModified_item; + memset((void *)&drbs_failedToBeModified_item, 0, sizeof(F1AP_DRBs_FailedToBeModified_Item_t)); + + /* dRBID */ + drbs_failedToBeModified_item.dRBID = 30L; + + drbs_failedToBeModified_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + drbs_failedToBeModified_item.cause->present = F1AP_Cause_PR_radioNetwork; + drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + + /* ADD */ + drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item = drbs_failedToBeModified_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeModified_List.list, + drbs_failedToBeModified_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c11. CriticalityDiagnostics */ + if (0) { + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_CriticalityDiagnostics; + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextModification; + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + *ie->value.choice.CriticalityDiagnostics.transactionID = 0; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return -1; + } + + printf("\n"); + + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + f1ap_du_send_message(buffer, len); + +} + +void DU_send_UE_CONTEXT_MODIFICATION_FAILURE(F1AP_UEContextModificationFailure_t UEContextModificationFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(F1AP_UEContextModificationRequired_t *UEContextModificationRequired) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +static int F1AP_DU_decode_initiating_message(F1AP_InitiatingMessage_t *initiating_p) { + + switch (initiating_p->value.present) { + + case F1AP_InitiatingMessage__value_PR_NOTHING: /* No components present */ + AssertFatal(1==0,"Should not receive NOTHING on DU\n"); + break; + + case F1AP_InitiatingMessage__value_PR_Reset: + DU_handle_RESET(&initiating_p->value.choice.Reset); + break; + /*case F1AP_Initiatingpdu__value_PR_F1SetupRequest: + DU_send_F1_SETUP_REQUEST(&initiating_p->value.choice.F1SetupRequest); + break;*/ + case F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate: + AssertFatal(1==0,"Should not receive GNBDUConfigurationUpdate on DU\n"); + break; + case F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate: + DU_handle_gNB_CU_CONFIGURATION_UPDATE(&initiating_p->value.choice.GNBCUConfigurationUpdate); + break; + case F1AP_InitiatingMessage__value_PR_UEContextSetupRequest: + DU_handle_UE_CONTEXT_SETUP_REQUEST(&initiating_p->value.choice.UEContextSetupRequest); + break; + case F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand: + DU_handle_UE_CONTEXT_RELEASE_COMMAND(&initiating_p->value.choice.UEContextReleaseCommand); + break; + case F1AP_InitiatingMessage__value_PR_UEContextModificationRequest: + DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(&initiating_p->value.choice.UEContextModificationRequest); + break; + case F1AP_InitiatingMessage__value_PR_UEContextModificationRequired: + AssertFatal(1==0,"Should not receive UECONTEXTMODIFICATIONREQUIRED on DU\n"); + break; + case F1AP_InitiatingMessage__value_PR_ErrorIndication: + AssertFatal(1==0,"Should not receive ErrorIndication on DU\n"); + break; + case F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest: + AssertFatal(1==0,"Should not receive UECONTEXTRELEASEREQUEST on DU\n"); + break; + case F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer: + DU_handle_DL_RRC_Message_TRANSFER(&initiating_p->value.choice.DLRRCMessageTransfer); + break; + case F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer: + AssertFatal(1==0,"Should not receive ULRRCmessageTRANSFER on DU\n"); + break; + case F1AP_InitiatingMessage__value_PR_PrivateMessage: + AssertFatal(1==0,"Should not receive PRIVATEmessage on DU\n"); + break; + default: + AssertFatal(1==0,"Shouldn't get here\n"); + } + +} + +static int F1AP_DU_decode_successful_outcome(F1AP_SuccessfulOutcome_t *successfulOutcome_p) { + + switch (successfulOutcome_p->value.present) { + + case F1AP_SuccessfulOutcome__value_PR_NOTHING: /* No components present */ + AssertFatal(1==0,"Should not received NOTHING!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_ResetAcknowledge: + AssertFatal(1==0,"DU Should not receive ResetAcknowled!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_F1SetupResponse: + AssertFatal(1==0,"DU Should not receive F1SetupResponse!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: + DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(successfulOutcome_p->value.choice.GNBDUConfigurationUpdateAcknowledge); + break; + case F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge: + AssertFatal(1==0,"DU Should not receive GNBCUConfigurationUpdateAcknowledge!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse: + AssertFatal(1==0,"DU Should not receive UEContextSetupResponse!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete: + AssertFatal(1==0,"DU Should not receive UEContextReleaseComplete!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse: + AssertFatal(1==0,"DU Should not receive UEContextModificationResponse!\n"); + break; + case F1AP_SuccessfulOutcome__value_PR_UEContextModificationConfirm: + DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(successfulOutcome_p->value.choice.UEContextModificationConfirm); + break; + } +} + +static int F1AP_DU_decode_unsuccessful_outcome(F1AP_UnsuccessfulOutcome_t *unSuccessfulOutcome_p) { + + switch (unSuccessfulOutcome_p->value.present) { + + case F1AP_UnsuccessfulOutcome__value_PR_NOTHING: + AssertFatal(1==0,"Should not receive NOTHING!\n"); + break; /* No components present */ + case F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure: + AssertFatal(1==0,"Should not receive F1SetupFailure\n"); + break; + case F1AP_UnsuccessfulOutcome__value_PR_GNBDUConfigurationUpdateFailure: + DU_handle_gNB_DU_CONFIGURATION_FAILURE(unSuccessfulOutcome_p->value.choice.GNBDUConfigurationUpdateFailure); + break; + case F1AP_UnsuccessfulOutcome__value_PR_GNBCUConfigurationUpdateFailure: + AssertFatal(1==0,"Should not receive GNBCUConfigurationUpdateFailure\n"); + break; + case F1AP_UnsuccessfulOutcome__value_PR_UEContextSetupFailure: + DU_send_UE_CONTEXT_SETUP_FAILURE(unSuccessfulOutcome_p->value.choice.UEContextSetupFailure); + break; + case F1AP_UnsuccessfulOutcome__value_PR_UEContextModificationFailure: + DU_send_UE_CONTEXT_MODIFICATION_FAILURE(unSuccessfulOutcome_p->value.choice.UEContextModificationFailure); + break; + } + +} + +static int F1AP_DU_encode_initiating_message(F1AP_InitiatingMessage_t *initiating_p) { + return -1; +} + +static int F1AP_DU_encode_successful_outcome(F1AP_SuccessfulOutcome_t *successfulOutcome_p) +{ + return -1; +} + +static int F1AP_DU_encode_unsuccessful_outcome(F1AP_UnsuccessfulOutcome_t *unSuccessfulOutcome_p) +{ + return -1; +} + +#define MAX_F1AP_BUFFER_SIZE 4096 + + +// or init function + +void DU_F1AP_init(void* args_p ) { + +} diff --git a/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-CommonDataTypes.asn b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-CommonDataTypes.asn new file mode 100644 index 0000000000..12dfbd12ff --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-CommonDataTypes.asn @@ -0,0 +1,32 @@ +-- ************************************************************** +-- +-- Common definitions +-- +-- ************************************************************** + +F1AP-CommonDataTypes { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-CommonDataTypes (3) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +Criticality ::= ENUMERATED { reject, ignore, notify } + +Presence ::= ENUMERATED { optional, conditional, mandatory } + +PrivateIE-ID ::= CHOICE { + local INTEGER (0..65535), + global OBJECT IDENTIFIER +} + +ProcedureCode ::= INTEGER (0..255) + +ProtocolExtensionID ::= INTEGER (0..65535) + +ProtocolIE-ID ::= INTEGER (0..65535) + +TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessfull-outcome } + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-Constants.asn b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-Constants.asn new file mode 100644 index 0000000000..de34aa8f43 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-Constants.asn @@ -0,0 +1,256 @@ +-- ************************************************************** +-- +-- Constant definitions +-- +-- ************************************************************** + +F1AP-Constants { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Constants (4) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + ProcedureCode, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes; + + +-- ************************************************************** +-- +-- Elementary Procedures +-- +-- ************************************************************** + +id-Reset ProcedureCode ::= 0 +id-F1Setup ProcedureCode ::= 1 +id-ErrorIndication ProcedureCode ::= 2 +id-gNBDUConfigurationUpdate ProcedureCode ::= 3 +id-gNBCUConfigurationUpdate ProcedureCode ::= 4 +id-UEContextSetup ProcedureCode ::= 5 +id-UEContextRelease ProcedureCode ::= 6 +id-UEContextModification ProcedureCode ::= 7 +id-UEContextModificationRequired ProcedureCode ::= 8 +id-UEMobilityCommand ProcedureCode ::= 9 +id-UEContextReleaseRequest ProcedureCode ::= 10 +id-InitialULRRCMessageTransfer ProcedureCode ::= 11 +id-DLRRCMessageTransfer ProcedureCode ::= 12 +id-ULRRCMessageTransfer ProcedureCode ::= 13 +id-privateMessage ProcedureCode ::= 14 +id-UEInactivityNotification ProcedureCode ::= 15 +id-GNBDUResourceCoordination ProcedureCode ::= 16 +id-SystemInformationDeliveryCommand ProcedureCode ::= 17 +id-Paging ProcedureCode ::= 18 +id-Notify ProcedureCode ::= 19 +id-WriteReplaceWarning ProcedureCode ::= 20 +id-PWSCancel ProcedureCode ::= 21 +id-PWSRestartIndication ProcedureCode ::= 22 +id-PWSFailureIndication ProcedureCode ::= 23 + +-- ************************************************************** +-- +-- Extension constants +-- +-- ************************************************************** + +maxPrivateIEs INTEGER ::= 65535 +maxProtocolExtensions INTEGER ::= 65535 +maxProtocolIEs INTEGER ::= 65535 +-- ************************************************************** +-- +-- Lists +-- +-- ************************************************************** + +maxNRARFCN INTEGER ::= 3279165 +maxnoofErrors INTEGER ::= 256 +maxnoofIndividualF1ConnectionsToReset INTEGER ::= 65536 +maxCellingNBDU INTEGER ::= 512 +maxnoofSCells INTEGER ::= 32 +maxnoofSRBs INTEGER ::= 8 +maxnoofDRBs INTEGER ::= 64 +maxnoofULUPTNLInformation INTEGER ::= 2 +maxnoofDLUPTNLInformation INTEGER ::= 2 +maxnoofBPLMNs INTEGER ::= 6 +maxnoofCandidateSpCells INTEGER ::= 64 +maxnoofPotentialSpCells INTEGER ::= 64 +maxnoofNrCellBands INTEGER ::= 32 +maxnoofSIBTypes INTEGER ::= 16 +maxnoofPagingCells INTEGER ::= 512 +maxnoofTNLAssociations INTEGER ::= 32 +maxnoofQoSFlows INTEGER ::= 64 +maxnoofSliceItems INTEGER ::= 1024 +maxCellineNB INTEGER ::= 256 + + +-- ************************************************************** +-- +-- IEs +-- +-- ************************************************************** + +id-Cause ProtocolIE-ID ::= 0 +id-Cells-Failed-to-be-Activated-List ProtocolIE-ID ::= 1 +id-Cells-Failed-to-be-Activated-List-Item ProtocolIE-ID ::= 2 +id-Cells-to-be-Activated-List ProtocolIE-ID ::= 3 +id-Cells-to-be-Activated-List-Item ProtocolIE-ID ::= 4 +id-Cells-to-be-Deactivated-List ProtocolIE-ID ::= 5 +id-Cells-to-be-Deactivated-List-Item ProtocolIE-ID ::= 6 +id-CriticalityDiagnostics ProtocolIE-ID ::= 7 +id-CUtoDURRCInformation ProtocolIE-ID ::= 9 +id-DRBs-FailedToBeModified-Item ProtocolIE-ID ::= 12 +id-DRBs-FailedToBeModified-List ProtocolIE-ID ::= 13 +id-DRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 14 +id-DRBs-FailedToBeSetup-List ProtocolIE-ID ::= 15 +id-DRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 16 +id-DRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 17 +id-DRBs-ModifiedConf-Item ProtocolIE-ID ::= 18 +id-DRBs-ModifiedConf-List ProtocolIE-ID ::= 19 +id-DRBs-Modified-Item ProtocolIE-ID ::= 20 +id-DRBs-Modified-List ProtocolIE-ID ::= 21 +id-DRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 22 +id-DRBs-Required-ToBeModified-List ProtocolIE-ID ::= 23 +id-DRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 24 +id-DRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 25 +id-DRBs-Setup-Item ProtocolIE-ID ::= 26 +id-DRBs-Setup-List ProtocolIE-ID ::= 27 +id-DRBs-SetupMod-Item ProtocolIE-ID ::= 28 +id-DRBs-SetupMod-List ProtocolIE-ID ::= 29 +id-DRBs-ToBeModified-Item ProtocolIE-ID ::= 30 +id-DRBs-ToBeModified-List ProtocolIE-ID ::= 31 +id-DRBs-ToBeReleased-Item ProtocolIE-ID ::= 32 +id-DRBs-ToBeReleased-List ProtocolIE-ID ::= 33 +id-DRBs-ToBeSetup-Item ProtocolIE-ID ::= 34 +id-DRBs-ToBeSetup-List ProtocolIE-ID ::= 35 +id-DRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 36 +id-DRBs-ToBeSetupMod-List ProtocolIE-ID ::= 37 +id-DRXCycle ProtocolIE-ID ::= 38 +id-DUtoCURRCInformation ProtocolIE-ID ::= 39 +id-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 40 +id-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 41 +id-gNB-DU-ID ProtocolIE-ID ::= 42 +id-GNB-DU-Served-Cells-Item ProtocolIE-ID ::= 43 +id-gNB-DU-Served-Cells-List ProtocolIE-ID ::= 44 +id-gNB-DU-Name ProtocolIE-ID ::= 45 +id-NRCellID ProtocolIE-ID ::= 46 +id-oldgNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 47 +id-ResetType ProtocolIE-ID ::= 48 +id-ResourceCoordinationTransferContainer ProtocolIE-ID ::= 49 +id-RRCContainer ProtocolIE-ID ::= 50 +id-SCell-ToBeRemoved-Item ProtocolIE-ID ::= 51 +id-SCell-ToBeRemoved-List ProtocolIE-ID ::= 52 +id-SCell-ToBeSetup-Item ProtocolIE-ID ::= 53 +id-SCell-ToBeSetup-List ProtocolIE-ID ::= 54 +id-SCell-ToBeSetupMod-Item ProtocolIE-ID ::= 55 +id-SCell-ToBeSetupMod-List ProtocolIE-ID ::= 56 +id-Served-Cells-To-Add-Item ProtocolIE-ID ::= 57 +id-Served-Cells-To-Add-List ProtocolIE-ID ::= 58 +id-Served-Cells-To-Delete-Item ProtocolIE-ID ::= 59 +id-Served-Cells-To-Delete-List ProtocolIE-ID ::= 60 +id-Served-Cells-To-Modify-Item ProtocolIE-ID ::= 61 +id-Served-Cells-To-Modify-List ProtocolIE-ID ::= 62 +id-SpCell-ID ProtocolIE-ID ::= 63 +id-SRBID ProtocolIE-ID ::= 64 +id-SRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 65 +id-SRBs-FailedToBeSetup-List ProtocolIE-ID ::= 66 +id-SRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 67 +id-SRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 68 +id-SRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 69 +id-SRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 70 +id-SRBs-ToBeReleased-Item ProtocolIE-ID ::= 71 +id-SRBs-ToBeReleased-List ProtocolIE-ID ::= 72 +id-SRBs-ToBeSetup-Item ProtocolIE-ID ::= 73 +id-SRBs-ToBeSetup-List ProtocolIE-ID ::= 74 +id-SRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 75 +id-SRBs-ToBeSetupMod-List ProtocolIE-ID ::= 76 +id-TimeToWait ProtocolIE-ID ::= 77 +id-TransactionID ProtocolIE-ID ::= 78 +id-TransmissionStopIndicator ProtocolIE-ID ::= 79 +id-UE-associatedLogicalF1-ConnectionItem ProtocolIE-ID ::= 80 +id-UE-associatedLogicalF1-ConnectionListResAck ProtocolIE-ID ::= 81 +id-gNB-CU-Name ProtocolIE-ID ::= 82 +id-SCell-FailedtoSetup-List ProtocolIE-ID ::= 83 +id-SCell-FailedtoSetup-Item ProtocolIE-ID ::= 84 +id-SCell-FailedtoSetupMod-List ProtocolIE-ID ::= 85 +id-SCell-FailedtoSetupMod-Item ProtocolIE-ID ::= 86 +id-RRCRconfigurationCompleteIndicator ProtocolIE-ID ::= 87 +id-Active-Cells-Item ProtocolIE-ID ::= 88 +id-Active-Cells-List ProtocolIE-ID ::= 89 +id-Candidate-SpCell-List ProtocolIE-ID ::= 90 +id-Candidate-SpCell-Item ProtocolIE-ID ::= 91 +id-Potential-SpCell-List ProtocolIE-ID ::= 92 +id-Potential-SpCell-Item ProtocolIE-ID ::= 93 +id-FullConfiguration ProtocolIE-ID ::= 94 +id-C-RNTI ProtocolIE-ID ::= 95 +id-SpCellULConfigured ProtocolIE-ID ::= 96 +id-InactivityMonitoringRequest ProtocolIE-ID ::= 97 +id-InactivityMonitoringResponse ProtocolIE-ID ::= 98 +id-DRB-Activity-Item ProtocolIE-ID ::= 99 +id-DRB-Activity-List ProtocolIE-ID ::= 100 +id-EUTRA-NR-CellResourceCoordinationReq-Container ProtocolIE-ID ::= 101 +id-EUTRA-NR-CellResourceCoordinationReqAck-Container ProtocolIE-ID ::= 102 +id-SpectrumSharingGroupID ProtocolIE-ID ::= 103 +id-ListofEUTRACellsinGNBDUCoordination ProtocolIE-ID ::= 104 +id-Protected-EUTRA-Resources-List ProtocolIE-ID ::= 105 +id-RequestType ProtocolIE-ID ::= 106 +id-ServCellndex ProtocolIE-ID ::= 107 +id-RAT-FrequencyPriorityInformation ProtocolIE-ID ::= 108 +id-ExecuteDuplication ProtocolIE-ID ::= 109 +id-NRCGI ProtocolIE-ID ::= 111 +id-PagingCell-Item ProtocolIE-ID ::= 112 +id-PagingCell-List ProtocolIE-ID ::= 113 +id-PagingDRX ProtocolIE-ID ::= 114 +id-PagingPriority ProtocolIE-ID ::= 115 +id-SIBtype-List ProtocolIE-ID ::= 116 +id-UEIdentityIndexValue ProtocolIE-ID ::= 117 +id-gNB-CUSystemInformation ProtocolIE-ID ::= 118 +id-HandoverPreparationInformation ProtocolIE-ID ::= 119 +id-GNB-CU-TNL-Association-To-Add-Item ProtocolIE-ID ::= 120 +id-GNB-CU-TNL-Association-To-Add-List ProtocolIE-ID ::= 121 +id-GNB-CU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 122 +id-GNB-CU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 123 +id-GNB-CU-TNL-Association-To-Update-Item ProtocolIE-ID ::= 124 +id-GNB-CU-TNL-Association-To-Update-List ProtocolIE-ID ::= 125 +id-MaskedIMEISV ProtocolIE-ID ::= 126 +id-PagingIdentity ProtocolIE-ID ::= 127 +id-DUtoCURRCContainer ProtocolIE-ID ::= 128 +id-Cells-to-be-Barred-List ProtocolIE-ID ::= 129 +id-Cells-to-be-Barred-Item ProtocolIE-ID ::= 130 +id-TAISliceSupportList ProtocolIE-ID ::= 131 +id-GNB-CU-TNL-Association-Setup-List ProtocolIE-ID ::= 132 +id-GNB-CU-TNL-Association-Setup-Item ProtocolIE-ID ::= 133 +id-GNB-CU-TNL-Association-Failed-To-Setup-List ProtocolIE-ID ::= 134 +id-GNB-CU-TNL-Association-Failed-To-Setup-Item ProtocolIE-ID ::= 135 +id-DRB-Notify-Item ProtocolIE-ID ::= 136 +id-DRB-Notify-List ProtocolIE-ID ::= 137 +id-NotficationControl ProtocolIE-ID ::= 138 +id-RANAC ProtocolIE-ID ::= 139 +id-PWSSystemInformation ProtocolIE-ID ::= 140 +id-RepetitionPeriod ProtocolIE-ID ::= 141 +id-NumberofBroadcastRequest ProtocolIE-ID ::= 142 +id-ConcurrentWarningMessageIndicator ProtocolIE-ID ::= 143 +id-Cells-To-Be-Broadcast-List ProtocolIE-ID ::= 144 +id-Cells-To-Be-Broadcast-Item ProtocolIE-ID ::= 145 +id-Cells-Broadcast-Completed-List ProtocolIE-ID ::= 146 +id-Cells-Broadcast-Completed-Item ProtocolIE-ID ::= 147 +id-Broadcast-To-Be-Cancelled-List ProtocolIE-ID ::= 148 +id-Broadcast-To-Be-Cancelled-Item ProtocolIE-ID ::= 149 +id-Cells-Broadcast-Cancelled-List ProtocolIE-ID ::= 150 +id-Cells-Broadcast-Cancelled-Item ProtocolIE-ID ::= 151 +id-NR-CGI-List-For-Restart-List ProtocolIE-ID ::= 152 +id-NR-CGI-List-For-Restart-Item ProtocolIE-ID ::= 153 +id-PWS-Failed-NR-CGI-List ProtocolIE-ID ::= 154 +id-PWS-Failed-NR-CGI-Item ProtocolIE-ID ::= 155 +id-ConfirmedUEID ProtocolIE-ID ::= 156 +id-Cancel-all-Warning-Messages-Indicator ProtocolIE-ID ::= 157 + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-Containers.asn b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-Containers.asn new file mode 100644 index 0000000000..ed5dfba961 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-Containers.asn @@ -0,0 +1,184 @@ +-- ************************************************************** +-- +-- Container definitions +-- +-- ************************************************************** + +F1AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + Presence, + PrivateIE-ID, + ProtocolExtensionID, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs + +FROM F1AP-Constants; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +F1AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolExtensionID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +F1AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {F1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-SingleContainer {F1AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {F1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality F1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality F1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue F1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality F1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue F1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality F1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue F1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {F1AP-PRIVATE-IES : IEsSetParam } ::= + SEQUENCE (SIZE (1.. maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {F1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality F1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-IEs.asn b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-IEs.asn new file mode 100644 index 0000000000..aa92b8d3f8 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-IEs.asn @@ -0,0 +1,1441 @@ +-- ************************************************************** +-- +-- Information Element Definitions +-- +-- ************************************************************** + +F1AP-IEs { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-IEs (2) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + id-gNB-CUSystemInformation, + id-HandoverPreparationInformation, + id-TAISliceSupportList, + id-RANAC, + maxNRARFCN, + maxnoofErrors, + maxnoofBPLMNs, + maxnoofDLUPTNLInformation, + maxnoofNrCellBands, + maxnoofULUPTNLInformation, + maxnoofQoSFlows, + maxnoofSliceItems, + maxnoofSIBTypes, + maxCellineNB + +FROM F1AP-Constants + + Criticality, + ProcedureCode, + ProtocolIE-ID, + TriggeringMessage + +FROM F1AP-CommonDataTypes + + ProtocolExtensionContainer{}, + F1AP-PROTOCOL-EXTENSION, + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + +-- A + +Active-Cells-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Active-Cells-ItemExtIEs } } OPTIONAL, + ... +} + +Active-Cells-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL, + ... +} + +AllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +AveragingWindow ::= INTEGER (0..63) -- this IE may need to be refined + +-- B + +BitRate ::= INTEGER (0..4000000000000,...) + +BroadcastPLMNs-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF BroadcastPLMNs-Item + +BroadcastPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { BroadcastPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { +{ ID id-TAISliceSupportList CRITICALITY ignore EXTENSION SliceSupportList PRESENCE optional }, + ... +} + + +-- C + +Cancel-all-Warning-Messages-Indicator ::= ENUMERATED {true, ...} + +Candidate-SpCell-Item ::= SEQUENCE { + candidate-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Candidate-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Candidate-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cause ::= CHOICE { + radioNetwork CauseRadioNetwork, + transport CauseTransport, + protocol CauseProtocol, + misc CauseMisc, + ... +} + +CauseMisc ::= ENUMERATED { + control-processing-overload, + not-enough-user-plane-processing-resources, + hardware-failure, + om-intervention, + unspecified, +... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + abstract-syntax-error-falsely-constructed-message, + unspecified, + ... +} + +CauseRadioNetwork ::= ENUMERATED { + unspecified, + rl-failure, + unknown-or-already-allocated-gnb-cu-ue-f1ap-id, + unknown-or-already-allocated-gnd-du-ue-f1ap-id, + unknown-or-inconsistent-pair-of-ue-f1ap-id, + interaction-with-other-procedure, + not-supported-qci-Value, + action-desirable-for-radio-reasons, + no-radio-resources-available, + procedure-cancelled, + normal-release, + ... +} + +CauseTransport ::= ENUMERATED { + unspecified, + transport-resource-unavailable, + ... +} + + + +CellGroupConfig ::= OCTET STRING + +Cells-Failed-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { Cells-Failed-to-be-Activated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Failed-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-To-Be-Broadcast-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-To-Be-Broadcast-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-To-Be-Broadcast-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Broadcast-Completed-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Completed-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Completed-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Broadcast-To-Be-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Broadcast-To-Be-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Broadcast-To-Be-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Cells-Broadcast-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Activated-List-ItemExtIEs} } OPTIONAL, + ... +} + +Cells-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { +{ ID id-gNB-CUSystemInformation CRITICALITY reject EXTENSION GNB-CUSystemInformation PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Deactivated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-to-be-Deactivated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Barred-Item::= SEQUENCE { + nRCGI NRCGI , + cellBarred CellBarred, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Barred-Item-ExtIEs } } OPTIONAL +} + +Cells-to-be-Barred-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellBarred ::= ENUMERATED {barred, not-barred, ...} + +CellULConfigured ::= ENUMERATED {none, ul, sul, ul-and-sul, ...} + +CNUEPagingIdentity ::= CHOICE { + fiveG-S-TMSI BIT STRING (SIZE(48)), + choice-extension ProtocolExtensionContainer { { CNUEPagingIdentity-ExtIEs } }, + ... +} + +CNUEPagingIdentity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +ConcurrentWarningMessageIndicator ::= ENUMERATED {true, ...} + +CP-TransportLayerAddress ::= CHOICE { + endpoint-IP-address TransportLayerAddress, + endpoint-IP-address-and-port Endpoint-IP-address-and-port, + choice-extension ProtocolExtensionContainer { { CP-TransportLayerAddress-ExtIEs } }, + ... +} + +CP-TransportLayerAddress-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics ::= SEQUENCE { + procedureCode ProcedureCode OPTIONAL, + triggeringMessage TriggeringMessage OPTIONAL, + procedureCriticality Criticality OPTIONAL, + transactionID TransactionID OPTIONAL, + iEsCriticalityDiagnostics CriticalityDiagnostics-IE-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1.. maxnoofErrors)) OF CriticalityDiagnostics-IE-Item + +CriticalityDiagnostics-IE-Item ::= SEQUENCE { + iECriticality Criticality, + iE-ID ProtocolIE-ID, + typeOfError TypeOfError, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-IE-Item-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-IE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +C-RNTI ::= BIT STRING (SIZE (16)) + +CUtoDURRCInformation ::= SEQUENCE { + cG-ConfigInfo CG-ConfigInfo OPTIONAL, + uE-CapabilityRAT-ContainerList UE-CapabilityRAT-ContainerList OPTIONAL, + measConfig MeasConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CUtoDURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +CUtoDURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { +{ ID id-HandoverPreparationInformation CRITICALITY ignore EXTENSION HandoverPreparationInformation PRESENCE optional }, + ... +} + +-- D + +DLUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDLUPTNLInformation)) OF DLUPTNLInformation-ToBeSetup-Item + +DLUPTNLInformation-ToBeSetup-Item ::= SEQUENCE { + dLUPTNLInformation UPTransportLayerInformation , + iE-Extensions ProtocolExtensionContainer { { DLUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DLUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity-Item ::= SEQUENCE { + dRBID DRBID, + dRB-Activity DRB-Activity OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRB-Activity-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Activity-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity ::= ENUMERATED {active, not-active} + +DRBID ::= INTEGER (1..32, ...) + +DRBs-FailedToBeModified-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-FailedToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Information ::= SEQUENCE { + dRB-QoS QoSFlowLevelQoSParameters, + sNSSAI SNSSAI, + notificationControl NotificationControl OPTIONAL, + flows-Mapped-To-DRB-List Flows-Mapped-To-DRB-List, + iE-Extensions ProtocolExtensionContainer { { DRB-Information-ItemExtIEs } } OPTIONAL +} + +DRB-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Modified-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List, + iE-Extensions ProtocolExtensionContainer { { DRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ModifiedConf-Item ::= SEQUENCE { + dRBID DRBID, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-ModifiedConf-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Notify-Item ::= SEQUENCE { + dRBID DRBID, + notification-Cause Notification-Cause, + iE-Extensions ProtocolExtensionContainer { { DRB-Notify-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Notify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Required-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Required-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Setup-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-SetupMod-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + uLConfiguration ULConfiguration OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-ToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List, + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRXCycle ::= SEQUENCE { + longDRXCycleLength LongDRXCycleLength, + shortDRXCycleLength ShortDRXCycleLength OPTIONAL, + shortDRXCycleTimer ShortDRXCycleTimer OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRXCycle-ExtIEs} } OPTIONAL, + ... +} + +DRXCycle-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DUtoCURRCContainer ::= OCTET STRING + +DUtoCURRCInformation ::= SEQUENCE { + cellGroupConfig CellGroupConfig, + measGapConfig MeasGapConfig OPTIONAL, + requestedP-MaxFR1 OCTET STRING OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DUtoCURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +DUtoCURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DuplicationActivation ::= ENUMERATED{active,inactive,... } + +DuplicationIndication ::= ENUMERATED {true, ...} + +Dynamic5QIDescriptor ::= SEQUENCE { + qoSPriorityLevel INTEGER (1..127), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + delayCritical ENUMERATED {delay-critical, non-delay-critical} OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Dynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +Dynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- E + +Endpoint-IP-address-and-port ::=SEQUENCE { + endpointIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { Endpoint-IP-address-and-port-ExtIEs} } OPTIONAL +} + +Endpoint-IP-address-and-port-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRANQoS ::= SEQUENCE { + qCI QCI, + allocationAndRetentionPriority AllocationAndRetentionPriority, + gbrQosInformation GBR-QosInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { EUTRANQoS-ExtIEs} } OPTIONAL, + ... +} + +EUTRANQoS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExecuteDuplication ::= ENUMERATED{true,...} + +EUTRA-Mode-Info ::= CHOICE { + eUTRAFDD EUTRA-FDD-Info, + eUTRATDD EUTRA-TDD-Info, + ... +} + +EUTRA-NR-CellResourceCoordinationReq-Container ::= OCTET STRING + +EUTRA-NR-CellResourceCoordinationReqAck-Container ::= OCTET STRING + +EUTRA-FDD-Info ::= SEQUENCE { + uL-offsetToPointA OffsetToPointA, + dL-offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-TDD-Info ::= SEQUENCE { + offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- F + +FDD-Info ::= SEQUENCE { + uL-NRFreqInfo NRFreqInfo, + dL-NRFreqInfo NRFreqInfo, + uL-Transmission-Bandwidth Transmission-Bandwidth, + dL-Transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Flows-Mapped-To-DRB-List ::= SEQUENCE (SIZE(1.. maxnoofQoSFlows)) OF Flows-Mapped-To-DRB-Item + +Flows-Mapped-To-DRB-Item ::= SEQUENCE { + qoSFlowIndicator QoSFlowIndicator, + qoSFlowLevelQoSParameters QoSFlowLevelQoSParameters, + iE-Extensions ProtocolExtensionContainer { { Flows-Mapped-To-DRB-ItemExtIEs} } OPTIONAL +} + +Flows-Mapped-To-DRB-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +FreqBandNrItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + supportedSULBandList SEQUENCE (SIZE(0..maxnoofNrCellBands)) OF SupportedSULFreqBandItem, + iE-Extensions ProtocolExtensionContainer { {FreqBandNrItem-ExtIEs} } OPTIONAL, + ... +} + +FreqBandNrItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +FullConfiguration ::= ENUMERATED {full, ...} + +-- G + + +GBR-QosInformation ::= SEQUENCE { + e-RAB-MaximumBitrateDL BitRate, + e-RAB-MaximumBitrateUL BitRate, + e-RAB-GuaranteedBitrateDL BitRate, + e-RAB-GuaranteedBitrateUL BitRate, + iE-Extensions ProtocolExtensionContainer { { GBR-QosInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GBR-QoSFlowInformation::= SEQUENCE { + maxFlowBitRateDownlink BitRate, + maxFlowBitRateUplink BitRate, + guaranteedFlowBitRateDownlink BitRate, + guaranteedFlowBitRateUplink BitRate, + maxPacketLossRateDownlink MaxPacketLossRate OPTIONAL, + maxPacketLossRateUplink MaxPacketLossRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GBR-QosFlowInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosFlowInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GNB-CUSystemInformation::= SEQUENCE { + sImessage OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { GNB-CUSystemInformation-ExtIEs} } OPTIONAL, + ... +} + +GNB-CUSystemInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-Setup-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + cause Cause, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GNB-CU-TNL-Association-To-Add-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Add-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Add-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GNB-CU-TNL-Association-To-Update-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Update-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Update-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-ID ::= INTEGER (0..68719476735) + +GNB-CU-Name ::= PrintableString(SIZE(1..150,...)) + +GNB-DU-Name ::= PrintableString(SIZE(1..150,...)) + +GNB-DU-Served-Cells-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Served-Cells-ItemExtIEs} } OPTIONAL, + ... +} + +GNB-DU-Served-Cells-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-System-Information ::= SEQUENCE { + mIB-message MIB-message, + sIB1-message SIB1-message, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-System-Information-ExtIEs } } OPTIONAL, + ... +} + +GNB-DU-System-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GTP-TEID ::= OCTET STRING (SIZE (4)) + +GTPTunnel ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { GTPTunnel-ExtIEs } } OPTIONAL, + ... +} + +GTPTunnel-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- H + +HandoverPreparationInformation ::= OCTET STRING + +-- I +InactivityMonitoringRequest ::= ENUMERATED { true,...} +InactivityMonitoringResponse ::= ENUMERATED { not-supported,...} + +-- J + +-- K + +-- L + +LCID ::= INTEGER (1..32, ...) + +ListofEUTRACellsinGNBDUCoordination ::= SEQUENCE (SIZE (0.. maxCellineNB)) OF Served-EUTRA-Cells-Information + +LongDRXCycleLength ::= ENUMERATED +{ms10, ms20, ms32, ms40, ms60, ms64, ms70, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ms1024, ms1280, ms2048, ms2560, ms5120, ms10240, ...} + +-- M + +MaskedIMEISV ::= BIT STRING (SIZE (64)) + +MaxDataBurstVolume ::= INTEGER (0..63) -- this IE may need to be refined +MaxPacketLossRate ::= INTEGER (0..1000) + +MIB-message ::= OCTET STRING + +MeasConfig ::= OCTET STRING + +MeasGapConfig ::= OCTET STRING + +-- N + +NGRANAllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {NGRANAllocationAndRetentionPriority-ExtIEs} } OPTIONAL +} + +NGRANAllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-CGI-List-For-Restart-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { NR-CGI-List-For-Restart-ItemExtIEs } } OPTIONAL, + ... +} + +NR-CGI-List-For-Restart-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonDynamic5QIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255), + qoSPriorityLevel INTEGER (1..127) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Notification-Cause ::= ENUMERATED {fulfilled, not-fulfilled, ...} + +NotificationControl ::= ENUMERATED {active, not-active, ...} + +NRFreqInfo ::= SEQUENCE { + nRARFCN INTEGER (0..maxNRARFCN), + sul-Information SUL-Information OPTIONAL, + freqBandListNr SEQUENCE (SIZE(1..maxnoofNrCellBands)) OF FreqBandNrItem, + iE-Extensions ProtocolExtensionContainer { { NRFreqInfoExtIEs} } OPTIONAL, + ... +} + +NRFreqInfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRCGI ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + nRCellIdentity NRCellIdentity, + iE-Extensions ProtocolExtensionContainer { {NRCGI-ExtIEs} } OPTIONAL, + ... +} + +NRCGI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-Mode-Info ::= CHOICE { + fDD FDD-Info, + tDD TDD-Info, + choice-extension ProtocolExtensionContainer { { NR-Mode-Info-ExtIEs} }, + ... +} + +NR-Mode-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { ... +} + + +NRCellIdentity ::= BIT STRING (SIZE(36)) + +NRNRB ::= ENUMERATED { nrb11, nrb18, nrb24, nrb25, nrb31, nrb32, nrb38, nrb51, nrb52, nrb65, nrb66, nrb78, nrb79, nrb93, nrb106, nrb107, nrb121, nrb132, nrb133, nrb135, nrb160, nrb162, nrb189, nrb216, nrb217, nrb245, nrb264, nrb270, nrb273, ...} + +NRPCI ::= INTEGER(0..1007) + +NRSCS ::= ENUMERATED { scs15, scs30, scs60, scs120, ...} + +NumberOfBroadcasts ::= INTEGER (0..65535) + +NumberofBroadcastRequest ::= INTEGER (0..65535) + +-- O + +OffsetToPointA ::= INTEGER (0..2199,...) + +-- P + +PacketDelayBudget ::= INTEGER (0..63) -- this IE may need to be refined + +PacketErrorRate ::= INTEGER (0..63) -- this IE may need to be refined + +PagingCell-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { PagingCell-ItemExtIEs } } OPTIONAL +} + +PagingCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PagingDRX ::= INTEGER (0..63) -- this IE may need to be refined + +PagingIdentity ::= CHOICE { + rANUEPagingIdentity RANUEPagingIdentity, + cNUEPagingIdentity CNUEPagingIdentity, + choice-extension ProtocolExtensionContainer { { PagingIdentity-ExtIEs } }, + ... +} + +PagingIdentity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PagingPriority ::= ENUMERATED { priolevel1, priolevel2, priolevel3, priolevel4, priolevel5, priolevel6, priolevel7, priolevel8,...} + +PLMN-Identity ::= OCTET STRING (SIZE(3)) + +Pre-emptionCapability ::= ENUMERATED { + shall-not-trigger-pre-emption, + may-trigger-pre-emption +} + +Pre-emptionVulnerability ::= ENUMERATED { + not-pre-emptable, + pre-emptable +} + +PriorityLevel ::= INTEGER { spare (0), highest (1), lowest (14), no-priority (15) } (0..15) + +ProtectedEUTRAResourceIndication ::= OCTET STRING + +Potential-SpCell-Item ::= SEQUENCE { + potential-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Potential-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Potential-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWS-Failed-NR-CGI-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { PWS-Failed-NR-CGI-ItemExtIEs } } OPTIONAL, + ... +} + +PWS-Failed-NR-CGI-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWSSystemInformation ::= OCTET STRING + +-- Q + +QCI ::= INTEGER (0..255) + +QoS-Characteristics ::= CHOICE { + non-Dynamic-5QI NonDynamic5QIDescriptor, + dynamic-5QI Dynamic5QIDescriptor, + choice-extension ProtocolExtensionContainer { { QoS-Characteristics-ExtIEs } }, + ... +} + +QoS-Characteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +QoSFlowIndicator ::= INTEGER (0..63) + +QoSFlowLevelQoSParameters ::= SEQUENCE { + qoS-Characteristics QoS-Characteristics, + nGRANallocationRetentionPriority NGRANAllocationAndRetentionPriority, + gBR-QoS-Flow-Information GBR-QoSFlowInformation OPTIONAL, + reflective-QoS-Attribute ENUMERATED {subject-to, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { QoSFlowLevelQoSParameters-ExtIEs } } OPTIONAL +} + +QoSFlowLevelQoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +QoSInformation ::= CHOICE { + eUTRANQoS EUTRANQoS, + dRB-Information DRB-Information, + choice-extension ProtocolExtensionContainer { { QoSInformation-ExtIEs} }, + ... +} + +QoSInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- R + +RANAC ::= INTEGER (0..64) + +RANUEPagingIdentity ::= SEQUENCE { + iRNTI BIT STRING (SIZE(40)), + iE-Extensions ProtocolExtensionContainer { { RANUEPagingIdentity-ExtIEs } } OPTIONAL} + +RANUEPagingIdentity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RAT-FrequencyPriorityInformation::= CHOICE { + subscriberProfileIDforRFP SubscriberProfileIDforRFP, + rAT-FrequencySelectionPriority RAT-FrequencySelectionPriority, + choice-extension ProtocolExtensionContainer { { RAT-FrequencyPriorityInformation-ExtIEs} }, + ... +} + +RAT-FrequencyPriorityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RAT-FrequencySelectionPriority::= INTEGER (1.. 256, ...) + +RequestType ::= ENUMERATED {offer, execution, ...} + +ResourceCoordinationTransferContainer ::= OCTET STRING + +RepetitionPeriod ::= INTEGER (0..131071, ...) +RLCMode ::= ENUMERATED { + rlc-am, + rlc-um +} + +RRCContainer ::= OCTET STRING + +RRCRconfigurationCompleteIndicator ::= ENUMERATED {true, ...} + +-- S + +SCell-FailedtoSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-FailedtoSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeRemoved-Item ::= SEQUENCE { + sCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeRemoved-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeRemoved-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCellIndex ::=INTEGER (1..31, ...) + +CG-ConfigInfo ::= OCTET STRING + +ServCellIndex ::= INTEGER (0..31, ...) + +Served-Cell-Information ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI, + fiveGS-TAC FiveGS-TAC, + configured-EPS-TAC Configured-EPS-TAC OPTIONAL, + servedPLMNs BroadcastPLMNs-List, + nR-Mode-Info NR-Mode-Info, + measurementTimingConfiguration OCTET STRING, + iE-Extensions ProtocolExtensionContainer { {Served-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { +{ ID id-RANAC CRITICALITY ignore EXTENSION RANAC PRESENCE optional}, + ... +} + +Served-Cells-To-Add-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Add-ItemExtIEs} } OPTIONAL, + ... +} + +Served-Cells-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Delete-Item ::= SEQUENCE { + oldNRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Delete-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Delete-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Modify-Item ::= SEQUENCE { + oldNRCGI NRCGI , + served-Cell-Information Served-Cell-Information , + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Modify-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Modify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-EUTRA-Cells-Information::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Mode-Info, + protectedEUTRAResourceIndication ProtectedEUTRAResourceIndication, + iE-Extensions ProtocolExtensionContainer { {Served-EUTRA-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-EUTRA-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ShortDRXCycleLength ::= ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ...} + +ShortDRXCycleTimer ::= INTEGER (1..16) + +SIB1-message ::= OCTET STRING + +SIBtype ::= ENUMERATED { + sibtype2,sibtype3, sibtype4, sibtype5, sibtype6, sibtype7, sibtype8, sibtype9, + ... +} + +SIBtype-List ::= SEQUENCE (SIZE(1.. maxnoofSIBTypes)) OF SIBtype-Item + +SIBtype-Item ::= SEQUENCE { + sIBtype SIBtype , + iE-Extensions ProtocolExtensionContainer { { SIBtype-ItemExtIEs } } OPTIONAL +} + +SIBtype-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SliceSupportItem + +SliceSupportItem ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SliceSupportItem-ExtIEs } } OPTIONAL +} + +SliceSupportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SNSSAI ::= SEQUENCE { + sST OCTET STRING (SIZE(1)), + sD OCTET STRING (SIZE(3)) OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SNSSAI-ExtIEs } } OPTIONAL +} + +SNSSAI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpectrumSharingGroupID ::= INTEGER (1..maxCellineNB) + +SRBID ::= INTEGER (0..3, ...) + +SRBs-FailedToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID, + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SUL-Information ::= SEQUENCE { + sUL-NRARFCN INTEGER (0..maxNRARFCN), + sUL-transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { { SUL-InformationExtIEs} } OPTIONAL, + ... +} + +SUL-InformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SubscriberProfileIDforRFP ::= INTEGER (1..256, ...) + +SupportedSULFreqBandItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + iE-Extensions ProtocolExtensionContainer { { SupportedSULFreqBandItem-ExtIEs} } OPTIONAL, + ... +} + +SupportedSULFreqBandItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- T + +FiveGS-TAC ::= OCTET STRING (SIZE(3)) + +Configured-EPS-TAC ::= OCTET STRING (SIZE(2)) + +TDD-Info ::= SEQUENCE { + nRFreqInfo NRFreqInfo, + transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeToWait ::= ENUMERATED {v1s, v2s, v5s, v10s, v20s, v60s, ...} + +TNLAssociationUsage ::= ENUMERATED { + ue, + non-ue, + both, +... +} + +TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...)) + +TransactionID ::= INTEGER (0..255, ...) + +Transmission-Bandwidth ::= SEQUENCE { + nRSCS NRSCS, + nRNRB NRNRB, + iE-Extensions ProtocolExtensionContainer { { Transmission-Bandwidth-ExtIEs} } OPTIONAL, + ... +} + +Transmission-Bandwidth-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionStopIndicator ::= ENUMERATED {true, ...} + +TypeOfError ::= ENUMERATED { + not-understood, + missing, + ... +} + +-- U + +UE-associatedLogicalF1-ConnectionItem ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID OPTIONAL, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UE-associatedLogicalF1-ConnectionItemExtIEs} } OPTIONAL, + ... +} + +UE-associatedLogicalF1-ConnectionItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-CapabilityRAT-ContainerList::= OCTET STRING + +UEIdentityIndexValue ::= INTEGER (0..63) -- This IE may need to be refined. + +ULConfiguration ::= SEQUENCE { + uLUEConfiguration ULUEConfiguration, + iE-Extensions ProtocolExtensionContainer { { ULConfigurationExtIEs } } OPTIONAL, + ... +} +ULConfigurationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULUEConfiguration ::= ENUMERATED {no-data, shared, only, ...} + + +ULUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofULUPTNLInformation)) OF ULUPTNLInformation-ToBeSetup-Item + +ULUPTNLInformation-ToBeSetup-Item ::=SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { ULUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +ULUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UPTransportLayerInformation ::= CHOICE { + gTPTunnel GTPTunnel, + choice-extension ProtocolExtensionContainer { { UPTransportLayerInformation-ExtIEs} }, + ... +} + +UPTransportLayerInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... + } +-- V + +-- W + +-- X + +-- Y + +-- Z + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-PDU-Contents.asn b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-PDU-Contents.asn new file mode 100644 index 0000000000..ec6e3733b1 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-PDU-Contents.asn @@ -0,0 +1,1578 @@ +-- ************************************************************** +-- +-- PDU definitions for F1AP. +-- +-- ************************************************************** + +F1AP-PDU-Contents { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Contents (1) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Active-Cells-Item, + Candidate-SpCell-Item, + Cause, + Cells-Failed-to-be-Activated-List-Item, + Cells-to-be-Activated-List-Item, + Cells-to-be-Deactivated-List-Item, + CellULConfigured, + CriticalityDiagnostics, + C-RNTI, + CUtoDURRCInformation, + DRB-Activity-Item, + DRBID, + DRBs-FailedToBeModified-Item, + DRBs-FailedToBeSetup-Item, + DRBs-FailedToBeSetupMod-Item, + DRB-Notify-Item, + DRBs-ModifiedConf-Item, + DRBs-Modified-Item, + DRBs-Required-ToBeModified-Item, + DRBs-Required-ToBeReleased-Item, + DRBs-Setup-Item, + DRBs-SetupMod-Item, + DRBs-ToBeModified-Item, + DRBs-ToBeReleased-Item, + DRBs-ToBeSetup-Item, + DRBs-ToBeSetupMod-Item, + DRXCycle, + DUtoCURRCInformation, + EUTRANQoS, + ExecuteDuplication, + FullConfiguration, + GNB-CU-UE-F1AP-ID, + GNB-DU-UE-F1AP-ID, + GNB-DU-ID, + GNB-DU-Served-Cells-Item, + GNB-DU-System-Information, + GNB-CU-Name, + GNB-DU-Name, + InactivityMonitoringRequest, + InactivityMonitoringResponse, + NotificationControl, + NRCGI, + NRPCI, + Potential-SpCell-Item, + RAT-FrequencyPriorityInformation, + ResourceCoordinationTransferContainer, + RRCContainer, + RRCRconfigurationCompleteIndicator, + SCellIndex, + SCell-ToBeRemoved-Item, + SCell-ToBeSetup-Item, + SCell-ToBeSetupMod-Item, + SCell-FailedtoSetup-Item, + SCell-FailedtoSetupMod-Item, + ServCellIndex, + Served-Cell-Information, + Served-Cells-To-Add-Item, + Served-Cells-To-Delete-Item, + Served-Cells-To-Modify-Item, + SRBID, + SRBs-FailedToBeSetup-Item, + SRBs-FailedToBeSetupMod-Item, + SRBs-Required-ToBeReleased-Item, + SRBs-ToBeReleased-Item, + SRBs-ToBeSetup-Item, + SRBs-ToBeSetupMod-Item, + TimeToWait, + TransactionID, + TransmissionStopIndicator, + UE-associatedLogicalF1-ConnectionItem, + DUtoCURRCContainer, + PagingCell-Item, + SIBtype-List, + UEIdentityIndexValue, + GNB-CU-TNL-Association-Setup-Item, + GNB-CU-TNL-Association-Failed-To-Setup-Item, + GNB-CU-TNL-Association-To-Add-Item, + GNB-CU-TNL-Association-To-Remove-Item, + GNB-CU-TNL-Association-To-Update-Item, + MaskedIMEISV, + PagingDRX, + PagingPriority, + PagingIdentity, + Cells-to-be-Barred-Item, + PWSSystemInformation, + Broadcast-To-Be-Cancelled-Item, + Cells-Broadcast-Cancelled-Item, + ConcurrentWarningMessageIndicator, + NR-CGI-List-For-Restart-Item, + PWS-Failed-NR-CGI-Item, + RepetitionPeriod, + NumberofBroadcastRequest, + Cells-To-Be-Broadcast-Item, + Cells-Broadcast-Completed-Item, + Cancel-all-Warning-Messages-Indicator, + EUTRA-NR-CellResourceCoordinationReq-Container, + EUTRA-NR-CellResourceCoordinationReqAck-Container, + ListofEUTRACellsinGNBDUCoordination, + SpectrumSharingGroupID, + RequestType + +FROM F1AP-IEs + + PrivateIE-Container{}, + ProtocolExtensionContainer{}, + ProtocolIE-Container{}, + ProtocolIE-ContainerPair{}, + ProtocolIE-SingleContainer{}, + F1AP-PRIVATE-IES, + F1AP-PROTOCOL-EXTENSION, + F1AP-PROTOCOL-IES, + F1AP-PROTOCOL-IES-PAIR + +FROM F1AP-Containers + + id-Active-Cells-Item, + id-Active-Cells-List, + id-Candidate-SpCell-Item, + id-Candidate-SpCell-List, + id-Cause, + id-Cancel-all-Warning-Messages-Indicator, + id-Cells-Failed-to-be-Activated-List, + id-Cells-Failed-to-be-Activated-List-Item, + id-Cells-to-be-Activated-List, + id-Cells-to-be-Activated-List-Item, + id-Cells-to-be-Deactivated-List, + id-Cells-to-be-Deactivated-List-Item, + id-ConfirmedUEID, + id-CriticalityDiagnostics, + id-C-RNTI, + id-CUtoDURRCInformation, + id-DRB-Activity-Item, + id-DRB-Activity-List, + id-DRBs-FailedToBeModified-Item, + id-DRBs-FailedToBeModified-List, + id-DRBs-FailedToBeSetup-Item, + id-DRBs-FailedToBeSetup-List, + id-DRBs-FailedToBeSetupMod-Item, + id-DRBs-FailedToBeSetupMod-List, + id-DRBs-ModifiedConf-Item, + id-DRBs-ModifiedConf-List, + id-DRBs-Modified-Item, + id-DRBs-Modified-List, + id-DRB-Notify-Item, + id-DRB-Notify-List, + id-DRBs-Required-ToBeModified-Item, + id-DRBs-Required-ToBeModified-List, + id-DRBs-Required-ToBeReleased-Item, + id-DRBs-Required-ToBeReleased-List, + id-DRBs-Setup-Item, + id-DRBs-Setup-List, + id-DRBs-SetupMod-Item, + id-DRBs-SetupMod-List, + id-DRBs-ToBeModified-Item, + id-DRBs-ToBeModified-List, + id-DRBs-ToBeReleased-Item, + id-DRBs-ToBeReleased-List, + id-DRBs-ToBeSetup-Item, + id-DRBs-ToBeSetup-List, + id-DRBs-ToBeSetupMod-Item, + id-DRBs-ToBeSetupMod-List, + id-DRXCycle, + id-DUtoCURRCInformation, + id-ExecuteDuplication, + id-FullConfiguration, + id-gNB-CU-UE-F1AP-ID, + id-gNB-DU-UE-F1AP-ID, + id-gNB-DU-ID, + id-GNB-DU-Served-Cells-Item, + id-gNB-DU-Served-Cells-List, + id-gNB-CU-Name, + id-gNB-DU-Name, + id-InactivityMonitoringRequest, + id-InactivityMonitoringResponse, + id-oldgNB-DU-UE-F1AP-ID, + id-Potential-SpCell-Item, + id-Potential-SpCell-List, + id-RAT-FrequencyPriorityInformation, + id-ResetType, + id-ResourceCoordinationTransferContainer, + id-RRCContainer, + id-RRCRconfigurationCompleteIndicator, + id-SCell-FailedtoSetup-List, + id-SCell-FailedtoSetup-Item, + id-SCell-FailedtoSetupMod-List, + id-SCell-FailedtoSetupMod-Item, + id-SCell-ToBeRemoved-Item, + id-SCell-ToBeRemoved-List, + id-SCell-ToBeSetup-Item, + id-SCell-ToBeSetup-List, + id-SCell-ToBeSetupMod-Item, + id-SCell-ToBeSetupMod-List, + id-Served-Cells-To-Add-Item, + id-Served-Cells-To-Add-List, + id-Served-Cells-To-Delete-Item, + id-Served-Cells-To-Delete-List, + id-Served-Cells-To-Modify-Item, + id-Served-Cells-To-Modify-List, + id-ServCellndex, + id-SpCell-ID, + id-SpCellULConfigured, + id-SRBID, + id-SRBs-FailedToBeSetup-Item, + id-SRBs-FailedToBeSetup-List, + id-SRBs-FailedToBeSetupMod-Item, + id-SRBs-FailedToBeSetupMod-List, + id-SRBs-Required-ToBeReleased-Item, + id-SRBs-Required-ToBeReleased-List, + id-SRBs-ToBeReleased-Item, + id-SRBs-ToBeReleased-List, + id-SRBs-ToBeSetup-Item, + id-SRBs-ToBeSetup-List, + id-SRBs-ToBeSetupMod-Item, + id-SRBs-ToBeSetupMod-List, + id-TimeToWait, + id-TransactionID, + id-TransmissionStopIndicator, + id-UE-associatedLogicalF1-ConnectionItem, + id-UE-associatedLogicalF1-ConnectionListResAck, + id-DUtoCURRCContainer, + id-NRCGI, + id-PagingCell-Item, + id-PagingCell-List, + id-PagingDRX, + id-PagingPriority, + id-SIBtype-List, + id-UEIdentityIndexValue, + id-GNB-CU-TNL-Association-Setup-List, + id-GNB-CU-TNL-Association-Setup-Item, + id-GNB-CU-TNL-Association-Failed-To-Setup-List, + id-GNB-CU-TNL-Association-Failed-To-Setup-Item, + id-GNB-CU-TNL-Association-To-Add-Item, + id-GNB-CU-TNL-Association-To-Add-List, + id-GNB-CU-TNL-Association-To-Remove-Item, + id-GNB-CU-TNL-Association-To-Remove-List, + id-GNB-CU-TNL-Association-To-Update-Item, + id-GNB-CU-TNL-Association-To-Update-List, + id-MaskedIMEISV, + id-PagingIdentity, + id-Cells-to-be-Barred-List, + id-Cells-to-be-Barred-Item, + id-PWSSystemInformation, + id-RepetitionPeriod, + id-NumberofBroadcastRequest, + id-ConcurrentWarningMessageIndicator, + id-Cells-To-Be-Broadcast-List, + id-Cells-To-Be-Broadcast-Item, + id-Cells-Broadcast-Completed-List, + id-Cells-Broadcast-Completed-Item, + id-Broadcast-To-Be-Cancelled-List, + id-Broadcast-To-Be-Cancelled-Item, + id-Cells-Broadcast-Cancelled-List, + id-Cells-Broadcast-Cancelled-Item, + id-NR-CGI-List-For-Restart-List, + id-NR-CGI-List-For-Restart-Item, + id-PWS-Failed-NR-CGI-List, + id-PWS-Failed-NR-CGI-Item, + id-EUTRA-NR-CellResourceCoordinationReq-Container, + id-EUTRA-NR-CellResourceCoordinationReqAck-Container, + id-SpectrumSharingGroupID, + id-ListofEUTRACellsinGNBDUCoordination, + id-Protected-EUTRA-Resources-List, + id-RequestType, + maxCellingNBDU, + maxnoofCandidateSpCells, + maxnoofDRBs, + maxnoofErrors, + maxnoofIndividualF1ConnectionsToReset, + maxnoofPotentialSpCells, + maxnoofSCells, + maxnoofSRBs, + maxnoofPagingCells, + maxnoofTNLAssociations, + maxCellineNB + +FROM F1AP-Constants; + + +-- ************************************************************** +-- +-- RESET ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Reset +-- +-- ************************************************************** + +Reset ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetIEs} }, + ... +} + +ResetIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-ResetType CRITICALITY reject TYPE ResetType PRESENCE mandatory }, + ... +} + +ResetType ::= CHOICE { + f1-Interface ResetAll, + partOfF1-Interface UE-associatedLogicalF1-ConnectionListRes, + ... +} + + +ResetAll ::= ENUMERATED { + reset-all, + ... +} + +UE-associatedLogicalF1-ConnectionListRes ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemRes } } + +UE-associatedLogicalF1-ConnectionItemRes F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY reject TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- Reset Acknowledge +-- +-- ************************************************************** + +ResetAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetAcknowledgeIEs} }, + ... +} + +ResetAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UE-associatedLogicalF1-ConnectionListResAck CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionListResAck PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +UE-associatedLogicalF1-ConnectionListResAck ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemResAck } } + +UE-associatedLogicalF1-ConnectionItemResAck F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- ERROR INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Error Indication +-- +-- ************************************************************** + +ErrorIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ErrorIndicationIEs}}, + ... +} + +ErrorIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- F1 SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Setup Request +-- +-- ************************************************************** + +F1SetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupRequestIEs} }, + ... +} + +F1SetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE mandatory }| + { ID id-gNB-DU-Name CRITICALITY ignore TYPE GNB-DU-Name PRESENCE optional }| + { ID id-gNB-DU-Served-Cells-List CRITICALITY reject TYPE GNB-DU-Served-Cells-List PRESENCE mandatory }, + ... +} + + +GNB-DU-Served-Cells-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { GNB-DU-Served-Cells-ItemIEs } } + +GNB-DU-Served-Cells-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-Served-Cells-Item CRITICALITY reject TYPE GNB-DU-Served-Cells-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- F1 Setup Response +-- +-- ************************************************************** + +F1SetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupResponseIEs} }, + ... +} + + +F1SetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-CU-Name CRITICALITY ignore TYPE GNB-CU-Name PRESENCE optional }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }, + ... +} + + +Cells-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Activated-List-ItemIEs } } + +Cells-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-Cells-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-to-be-Activated-List-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- F1 Setup Failure +-- +-- ************************************************************** + +F1SetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupFailureIEs} }, + ... +} + +F1SetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBDUConfigurationUpdate::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateIEs} }, + ... +} + +GNBDUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Served-Cells-To-Add-List CRITICALITY reject TYPE Served-Cells-To-Add-List PRESENCE optional }| + { ID id-Served-Cells-To-Modify-List CRITICALITY reject TYPE Served-Cells-To-Modify-List PRESENCE optional }| + { ID id-Served-Cells-To-Delete-List CRITICALITY reject TYPE Served-Cells-To-Delete-List PRESENCE optional }| + { ID id-Active-Cells-List CRITICALITY reject TYPE Active-Cells-List PRESENCE optional }, + ... +} +Served-Cells-To-Add-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Add-ItemIEs } } +Served-Cells-To-Modify-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Modify-ItemIEs } } +Served-Cells-To-Delete-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Delete-ItemIEs } } +Active-Cells-List ::= SEQUENCE (SIZE(0.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Active-Cells-ItemIEs } } + +Served-Cells-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Add-Item CRITICALITY reject TYPE Served-Cells-To-Add-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Modify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Modify-Item CRITICALITY reject TYPE Served-Cells-To-Modify-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Delete-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Delete-Item CRITICALITY reject TYPE Served-Cells-To-Delete-Item PRESENCE mandatory }, +... +} + +Active-Cells-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Active-Cells-Item CRITICALITY reject TYPE Active-Cells-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBDUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateFailureIEs} }, + ... +} + +GNBDUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBCUConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateIEs} }, + ... +} + +GNBCUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Add-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Remove-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Update-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-List PRESENCE optional }| + { ID id-Cells-to-be-Barred-List CRITICALITY ignore TYPE Cells-to-be-Barred-List PRESENCE optional }| + { ID id-Protected-EUTRA-Resources-List CRITICALITY reject TYPE Protected-EUTRA-Resources-List PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Deactivated-List-ItemIEs } } +GNB-CU-TNL-Association-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Add-ItemIEs } } +GNB-CU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Remove-ItemIEs } } +GNB-CU-TNL-Association-To-Update-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Update-ItemIEs } } +Cells-to-be-Barred-List ::= SEQUENCE(SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Barred-ItemIEs } } + + +Cells-to-be-Deactivated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Deactivated-List-Item CRITICALITY reject TYPE Cells-to-be-Deactivated-List-Item PRESENCE mandatory }, +...} + + +GNB-CU-TNL-Association-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Add-Item CRITICALITY reject TYPE GNB-CU-TNL-Association-To-Add-Item PRESENCE mandatory }, +...} + +GNB-CU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Remove-Item CRITICALITY reject TYPE GNB-CU-TNL-Association-To-Remove-Item PRESENCE mandatory }, +...} + +GNB-CU-TNL-Association-To-Update-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Update-Item CRITICALITY reject TYPE GNB-CU-TNL-Association-To-Update-Item PRESENCE mandatory }, +...} + +Cells-to-be-Barred-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Barred-Item CRITICALITY ignore TYPE Cells-to-be-Barred-Item PRESENCE mandatory }, + ... +} + +Protected-EUTRA-Resources-List ::= SEQUENCE (SIZE(1.. maxCellineNB)) OF ProtocolIE-SingleContainer { { Protected-EUTRA-Resources-ItemIEs } } +Protected-EUTRA-Resources-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SpectrumSharingGroupID CRITICALITY reject TYPE SpectrumSharingGroupID PRESENCE mandatory}| + { ID id-ListofEUTRACellsinGNBDUCoordination CRITICALITY reject TYPE ListofEUTRACellsinGNBDUCoordination PRESENCE mandatory }, +...} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBCUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Failed-to-be-Activated-List CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-List PRESENCE optional }, + ... +} + +Cells-Failed-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Failed-to-be-Activated-List-ItemIEs } } +GNB-CU-TNL-Association-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Setup-ItemIEs } } +GNB-CU-TNL-Association-Failed-To-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs } } + +Cells-Failed-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Failed-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Setup-Item CRITICALITY reject TYPE GNB-CU-TNL-Association-Setup-Item PRESENCE mandatory }, +...} + + +GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-Item CRITICALITY reject TYPE GNB-CU-TNL-Association-Failed-To-Setup-Item PRESENCE mandatory }, +...} + + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateFailureIEs} }, + ... +} + +GNBCUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION REQUEST +-- +-- ************************************************************** + +GNBDUResourceCoordinationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationRequest-IEs}}, + ... +} + +GNBDUResourceCoordinationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RequestType CRITICALITY reject TYPE RequestType PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReq-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReq-Container PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION RESPONSE +-- +-- ************************************************************** + +GNBDUResourceCoordinationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationResponse-IEs}}, + ... +} + +GNBDUResourceCoordinationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReqAck-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReqAck-Container PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE Context Setup ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT SETUP REQUEST +-- +-- ************************************************************** + +UEContextSetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupRequestIEs} }, + ... +} + +UEContextSetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SpCell-ID CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-ServCellndex CRITICALITY reject TYPE ServCellIndex PRESENCE mandatory }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE mandatory}| + { ID id-Candidate-SpCell-List CRITICALITY ignore TYPE Candidate-SpCell-List PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-SCell-ToBeSetup-List CRITICALITY ignore TYPE SCell-ToBeSetup-List PRESENCE optional }| + { ID id-SRBs-ToBeSetup-List CRITICALITY reject TYPE SRBs-ToBeSetup-List PRESENCE optional }| + { ID id-DRBs-ToBeSetup-List CRITICALITY reject TYPE DRBs-ToBeSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-MaskedIMEISV CRITICALITY ignore TYPE MaskedIMEISV PRESENCE optional }, + ... +} + +Candidate-SpCell-List::= SEQUENCE (SIZE(1..maxnoofCandidateSpCells)) OF ProtocolIE-SingleContainer { { Candidate-SpCell-ItemIEs} } +SCell-ToBeSetup-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetup-ItemIEs} } +SRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetup-ItemIEs} } +DRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetup-ItemIEs} } + + +Candidate-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Candidate-SpCell-Item CRITICALITY ignore TYPE Candidate-SpCell-Item PRESENCE mandatory }, + ... +} + + +SCell-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetup-Item CRITICALITY ignore TYPE SCell-ToBeSetup-Item PRESENCE mandatory }, + ... +} + +SRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetup-Item CRITICALITY reject TYPE SRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetup-Item CRITICALITY reject TYPE DRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- UE CONTEXT SETUP RESPONSE +-- +-- ************************************************************** + +UEContextSetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupResponseIEs} }, + ... +} + + +UEContextSetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-DRBs-Setup-List CRITICALITY ignore TYPE DRBs-Setup-List PRESENCE optional }| + { ID id-SRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetup-List CRITICALITY ignore TYPE DRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-SCell-FailedtoSetup-List CRITICALITY ignore TYPE SCell-FailedtoSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +DRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Setup-ItemIEs} } +SRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetup-ItemIEs} } +DRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetup-ItemIEs} } +SCell-FailedtoSetup-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetup-ItemIEs} } + +DRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Setup-Item CRITICALITY ignore TYPE DRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetup-Item CRITICALITY ignore TYPE SCell-FailedtoSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP FAILURE +-- +-- ************************************************************** + +UEContextSetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupFailureIEs} }, + ... +} + +UEContextSetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Potential-SpCell-List CRITICALITY ignore TYPE Potential-SpCell-List PRESENCE optional }, + ... +} + +Potential-SpCell-List::= SEQUENCE (SIZE(0..maxnoofPotentialSpCells)) OF ProtocolIE-SingleContainer { { Potential-SpCell-ItemIEs} } + +Potential-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Potential-SpCell-Item CRITICALITY ignore TYPE Potential-SpCell-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Context Release Request ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Release Request +-- +-- ************************************************************** + +UEContextReleaseRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEContextReleaseRequestIEs}}, + ... +} + +UEContextReleaseRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- UE Context Release (gNB-CU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMMAND +-- +-- ************************************************************** + +UEContextReleaseCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCommandIEs} }, + ... +} + +UEContextReleaseCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMPLETE +-- +-- ************************************************************** + +UEContextReleaseComplete ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCompleteIEs} }, + ... +} + + +UEContextReleaseCompleteIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, ... +} + +-- ************************************************************** +-- +-- UE Context Modification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUEST +-- +-- ************************************************************** + +UEContextModificationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequestIEs} }, + ... +} + +UEContextModificationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SpCell-ID CRITICALITY ignore TYPE NRCGI PRESENCE optional }| + { ID id-ServCellndex CRITICALITY reject TYPE ServCellIndex PRESENCE mandatory }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE optional }| + { ID id-TransmissionStopIndicator CRITICALITY ignore TYPE TransmissionStopIndicator PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-RRCRconfigurationCompleteIndicator CRITICALITY ignore TYPE RRCRconfigurationCompleteIndicator PRESENCE optional }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE optional }| + { ID id-SCell-ToBeSetupMod-List CRITICALITY ignore TYPE SCell-ToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-ToBeRemoved-List CRITICALITY ignore TYPE SCell-ToBeRemoved-List PRESENCE optional }| + { ID id-SRBs-ToBeSetupMod-List CRITICALITY reject TYPE SRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeSetupMod-List CRITICALITY reject TYPE DRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeModified-List CRITICALITY reject TYPE DRBs-ToBeModified-List PRESENCE optional }| + { ID id-SRBs-ToBeReleased-List CRITICALITY reject TYPE SRBs-ToBeReleased-List PRESENCE optional }| + { ID id-DRBs-ToBeReleased-List CRITICALITY reject TYPE DRBs-ToBeReleased-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }, + ... +} + +SCell-ToBeSetupMod-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetupMod-ItemIEs} } +SCell-ToBeRemoved-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeRemoved-ItemIEs} } +SRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetupMod-ItemIEs} } +DRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetupMod-ItemIEs} } + +DRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeModified-ItemIEs} } +SRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeReleased-ItemIEs} } +DRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeReleased-ItemIEs} } + +SCell-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetupMod-Item CRITICALITY ignore TYPE SCell-ToBeSetupMod-Item PRESENCE mandatory }, + ... +} + +SCell-ToBeRemoved-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeRemoved-Item CRITICALITY ignore TYPE SCell-ToBeRemoved-Item PRESENCE mandatory }, + ... +} + + +SRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetupMod-Item CRITICALITY reject TYPE DRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeModified-Item CRITICALITY reject TYPE DRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + + +SRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeReleased-Item CRITICALITY reject TYPE SRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeReleased-Item CRITICALITY reject TYPE DRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION RESPONSE +-- +-- ************************************************************** + +UEContextModificationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationResponseIEs} }, + ... +} + + +UEContextModificationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-SetupMod-List CRITICALITY ignore TYPE DRBs-SetupMod-List PRESENCE optional}| + { ID id-DRBs-Modified-List CRITICALITY ignore TYPE DRBs-Modified-List PRESENCE optional}| + { ID id-SRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-FailedtoSetupMod-List CRITICALITY ignore TYPE SCell-FailedtoSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeModified-List CRITICALITY ignore TYPE DRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +DRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-SetupMod-ItemIEs} } +DRBs-Modified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Modified-ItemIEs } } +DRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeModified-ItemIEs} } +SRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetupMod-ItemIEs} } +DRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetupMod-ItemIEs} } +SCell-FailedtoSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetupMod-ItemIEs} } + +DRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-SetupMod-Item CRITICALITY ignore TYPE DRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Modified-Item CRITICALITY ignore TYPE DRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + + +DRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeModified-Item CRITICALITY ignore TYPE DRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetupMod-Item CRITICALITY ignore TYPE SCell-FailedtoSetupMod-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION FAILURE +-- +-- ************************************************************** + +UEContextModificationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationFailureIEs} }, + ... +} + +UEContextModificationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- UE Context Modification Required (gNB-DU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUIRED +-- +-- ************************************************************** + +UEContextModificationRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequiredIEs} }, + ... +} + +UEContextModificationRequiredIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-Required-ToBeModified-List CRITICALITY reject TYPE DRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-DRBs-Required-ToBeReleased-List CRITICALITY reject TYPE DRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +DRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeModified-ItemIEs } } +DRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeReleased-ItemIEs } } + +SRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Required-ToBeReleased-ItemIEs } } + +DRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeModified-Item CRITICALITY reject TYPE DRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +DRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE DRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION CONFIRM +-- +-- ************************************************************** + +UEContextModificationConfirm::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationConfirmIEs} }, + ... +} + + +UEContextModificationConfirmIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DRBs-ModifiedConf-List CRITICALITY ignore TYPE DRBs-ModifiedConf-List PRESENCE optional}| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +DRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ModifiedConf-ItemIEs } } + +DRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ModifiedConf-Item CRITICALITY ignore TYPE DRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- WRITE-REPLACE WARNING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Write-Replace Warning Request +-- +-- ************************************************************** + +WriteReplaceWarningRequest ::= SEQUENCE { +protocolIEs ProtocolIE-Container { {WriteReplaceWarningRequestIEs} }, +... +} +WriteReplaceWarningRequestIEs F1AP-PROTOCOL-IES ::= { +{ ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| +{ ID id-PWSSystemInformation CRITICALITY reject TYPE PWSSystemInformation PRESENCE mandatory }| +{ ID id-RepetitionPeriod CRITICALITY reject TYPE RepetitionPeriod PRESENCE mandatory }| +{ ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| +{ ID id-ConcurrentWarningMessageIndicator CRITICALITY reject TYPE ConcurrentWarningMessageIndicator PRESENCE optional }| +{ ID id-Cells-To-Be-Broadcast-List CRITICALITY reject TYPE Cells-To-Be-Broadcast-List PRESENCE optional }, +... +} +Cells-To-Be-Broadcast-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-To-Be-Broadcast-List-ItemIEs } } + +Cells-To-Be-Broadcast-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-To-Be-Broadcast-Item CRITICALITY reject TYPE Cells-To-Be-Broadcast-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Write-Replace Warning Response +-- +-- ************************************************************** + +WriteReplaceWarningResponse ::= SEQUENCE { +protocolIEs ProtocolIE-Container { {WriteReplaceWarningResponseIEs} }, +... +} +WriteReplaceWarningResponseIEs F1AP-PROTOCOL-IES ::= { +{ ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| +{ ID id-Cells-Broadcast-Completed-List CRITICALITY reject TYPE Cells-Broadcast-Completed-List PRESENCE optional }| +{ ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, +... +} +Cells-Broadcast-Completed-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Completed-List-ItemIEs } } + +Cells-Broadcast-Completed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Completed-Item CRITICALITY reject TYPE Cells-Broadcast-Completed-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- PWS CANCEL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Cancel Request +-- +-- ************************************************************** + +PWSCancelRequest ::= SEQUENCE { +protocolIEs ProtocolIE-Container { {PWSCancelRequestIEs} }, +... +} +PWSCancelRequestIEs F1AP-PROTOCOL-IES ::= { +{ ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| +{ ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| +{ ID id-Broadcast-To-Be-Cancelled-List CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-List PRESENCE optional }| +{ ID id-Cancel-all-Warning-Messages-Indicator CRITICALITY reject TYPE Cancel-all-Warning-Messages-Indicator PRESENCE optional } +, +... +} +Broadcast-To-Be-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Broadcast-To-Be-Cancelled-List-ItemIEs } } + +Broadcast-To-Be-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Broadcast-To-Be-Cancelled-Item CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS Cancel Response +-- +-- ************************************************************** + +PWSCancelResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelResponseIEs} }, +... +} + +PWSCancelResponseIEs F1AP-PROTOCOL-IES ::= { +{ ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| +{ ID id-Cells-Broadcast-Cancelled-List CRITICALITY reject TYPE Cells-Broadcast-Cancelled-List PRESENCE optional }| +{ ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, +... +} +Cells-Broadcast-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Cancelled-List-ItemIEs } } + +Cells-Broadcast-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Cancelled-Item CRITICALITY reject TYPE Cells-Broadcast-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Inactivity Notification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Inactivity Notification +-- +-- ************************************************************** + +UEInactivityNotification ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEInactivityNotificationIEs}}, + ... +} + +UEInactivityNotificationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Activity-List CRITICALITY reject TYPE DRB-Activity-List PRESENCE mandatory } , + ... +} + +DRB-Activity-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Activity-ItemIEs } } + +DRB-Activity-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Activity-Item CRITICALITY reject TYPE DRB-Activity-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- Initial UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- INITIAL UL RRC Message Transfer +-- +-- ************************************************************** + +InitialULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ InitialULRRCMessageTransferIEs}}, + ... +} + +InitialULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY reject TYPE C-RNTI PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-DUtoCURRCContainer CRITICALITY reject TYPE DUtoCURRCContainer PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- DL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DL RRC Message Transfer +-- +-- ************************************************************** + +DLRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DLRRCMessageTransferIEs}}, + ... +} + +DLRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UL RRC Message Transfer +-- +-- ************************************************************** + +ULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ULRRCMessageTransferIEs}}, + ... +} + +ULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PRIVATE MESSAGE +-- +-- ************************************************************** + +PrivateMessage ::= SEQUENCE { + privateIEs PrivateIE-Container {{PrivateMessage-IEs}}, + ... +} + +PrivateMessage-IEs F1AP-PRIVATE-IES ::= { + ... +} + + +-- ************************************************************** +-- +-- System Information ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- System information Delivery Command +-- +-- ************************************************************** + +SystemInformationDeliveryCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ SystemInformationDeliveryCommandIEs}}, + ... +} + +SystemInformationDeliveryCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-SIBtype-List CRITICALITY reject TYPE SIBtype-List PRESENCE mandatory }| + { ID id-ConfirmedUEID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Paging PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Paging +-- +-- ************************************************************** + +Paging ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PagingIEs}}, + ... +} + +PagingIEs F1AP-PROTOCOL-IES ::= { + { ID id-UEIdentityIndexValue CRITICALITY reject TYPE UEIdentityIndexValue PRESENCE mandatory }| + { ID id-PagingIdentity CRITICALITY reject TYPE PagingIdentity PRESENCE optional }| + { ID id-PagingDRX CRITICALITY ignore TYPE PagingDRX PRESENCE optional }| + { ID id-PagingPriority CRITICALITY ignore TYPE PagingPriority PRESENCE optional }| + { ID id-PagingCell-List CRITICALITY ignore TYPE PagingCell-list PRESENCE optional }, + ... +} + +PagingCell-list::= SEQUENCE (SIZE(1.. maxnoofPagingCells)) OF ProtocolIE-SingleContainer { { PagingCell-ItemIEs } } + +PagingCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PagingCell-Item CRITICALITY ignore TYPE PagingCell-Item PRESENCE mandatory} , + ... +} + + + +-- ************************************************************** +-- +-- Notify +-- +-- ************************************************************** + +Notify ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NotifyIEs}}, + ... +} + +NotifyIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Notify-List CRITICALITY reject TYPE DRB-Notify-List PRESENCE mandatory }, + ... +} + +DRB-Notify-List::= SEQUENCE (SIZE(1)) OF ProtocolIE-SingleContainer { { DRB-Notify-ItemIEs } } + +DRB-Notify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Notify-Item CRITICALITY reject TYPE DRB-Notify-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- PWS RESTART INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Restart Indication +-- +-- ************************************************************** + +PWSRestartIndication ::= SEQUENCE { +protocolIEs ProtocolIE-Container { { PWSRestartIndicationIEs} }, +... +} +PWSRestartIndicationIEs F1AP-PROTOCOL-IES ::= { +{ ID id-NR-CGI-List-For-Restart-List CRITICALITY reject TYPE NR-CGI-List-For-Restart-List PRESENCE optional }, +... +} +NR-CGI-List-For-Restart-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { NR-CGI-List-For-Restart-List-ItemIEs } } + +NR-CGI-List-For-Restart-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-NR-CGI-List-For-Restart-Item CRITICALITY reject TYPE NR-CGI-List-For-Restart-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Failure Indication +-- +-- ************************************************************** + +PWSFailureIndication ::= SEQUENCE { +protocolIEs ProtocolIE-Container { { PWSFailureIndicationIEs} }, +... +} +PWSFailureIndicationIEs F1AP-PROTOCOL-IES ::= { +{ ID id-PWS-Failed-NR-CGI-List CRITICALITY reject TYPE PWS-Failed-NR-CGI-List PRESENCE optional }, +... +} +PWS-Failed-NR-CGI-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { PWS-Failed-NR-CGI-List-ItemIEs } } + +PWS-Failed-NR-CGI-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PWS-Failed-NR-CGI-Item CRITICALITY reject TYPE PWS-Failed-NR-CGI-Item PRESENCE mandatory }, + ... +} + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-PDU-Descriptions.asn b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-PDU-Descriptions.asn new file mode 100644 index 0000000000..6ca80a706c --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R15.2.1/F1AP-PDU-Descriptions.asn @@ -0,0 +1,353 @@ +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +F1AP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Descriptions (0)} + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureCode + +FROM F1AP-CommonDataTypes + Reset, + ResetAcknowledge, + F1SetupRequest, + F1SetupResponse, + F1SetupFailure, + GNBDUConfigurationUpdate, + GNBDUConfigurationUpdateAcknowledge, + GNBDUConfigurationUpdateFailure, + GNBCUConfigurationUpdate, + GNBCUConfigurationUpdateAcknowledge, + GNBCUConfigurationUpdateFailure, + UEContextSetupRequest, + UEContextSetupResponse, + UEContextSetupFailure, + UEContextReleaseCommand, + UEContextReleaseComplete, + UEContextModificationRequest, + UEContextModificationResponse, + UEContextModificationFailure, + UEContextModificationRequired, + UEContextModificationConfirm, + ErrorIndication, + UEContextReleaseRequest, + DLRRCMessageTransfer, + ULRRCMessageTransfer, + GNBDUResourceCoordinationRequest, + GNBDUResourceCoordinationResponse, + PrivateMessage, + UEInactivityNotification, + InitialULRRCMessageTransfer, + SystemInformationDeliveryCommand, + Paging, + Notify, + WriteReplaceWarningRequest, + WriteReplaceWarningResponse, + PWSCancelRequest, + PWSCancelResponse, + PWSRestartIndication, + PWSFailureIndication + +FROM F1AP-PDU-Contents + id-Reset, + id-F1Setup, + id-gNBDUConfigurationUpdate, + id-gNBCUConfigurationUpdate, + id-UEContextSetup, + id-UEContextRelease, + id-UEContextModification, + id-UEContextModificationRequired, + id-ErrorIndication, + id-UEContextReleaseRequest, + id-DLRRCMessageTransfer, + id-ULRRCMessageTransfer, + id-GNBDUResourceCoordination, + id-privateMessage, + id-UEInactivityNotification, + id-InitialULRRCMessageTransfer, + id-SystemInformationDeliveryCommand, + id-Paging, + id-Notify, + id-WriteReplaceWarning, + id-PWSCancel, + id-PWSRestartIndication, + id-PWSFailureIndication + + +FROM F1AP-Constants; + + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &procedureCode ProcedureCode UNIQUE, + &criticality Criticality DEFAULT ignore +} +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + PROCEDURE CODE &procedureCode + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +F1AP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + successfulOutcome SuccessfulOutcome, + unsuccessfulOutcome UnsuccessfulOutcome, + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURES F1AP-ELEMENTARY-PROCEDURE ::= { + F1AP-ELEMENTARY-PROCEDURES-CLASS-1 | + F1AP-ELEMENTARY-PROCEDURES-CLASS-2, + ... +} + + +F1AP-ELEMENTARY-PROCEDURES-CLASS-1 F1AP-ELEMENTARY-PROCEDURE ::= { + reset | + f1Setup | + gNBDUConfigurationUpdate | + gNBCUConfigurationUpdate | + uEContextSetup | + uEContextRelease | + uEContextModification | + uEContextModificationRequired | + writeReplaceWarning | + pWSCancel | + gNBDUResourceCoordination , + ...} + + F1AP-ELEMENTARY-PROCEDURES-CLASS-2 F1AP-ELEMENTARY-PROCEDURE ::= { + errorIndication | + uEContextReleaseRequest | + dLRRCMessageTransfer | + uLRRCMessageTransfer | + uEInactivityNotification | + privateMessage | + initialULRRCMessageTransfer | + systemInformationDelivery | + paging | + notify | + pWSRestartIndication | + pWSFailureIndication , + ... +} +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +reset F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Reset + SUCCESSFUL OUTCOME ResetAcknowledge + PROCEDURE CODE id-Reset + CRITICALITY reject +} + +f1Setup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1SetupRequest + SUCCESSFUL OUTCOME F1SetupResponse + UNSUCCESSFUL OUTCOME F1SetupFailure + PROCEDURE CODE id-F1Setup + CRITICALITY reject +} + +gNBDUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUConfigurationUpdate + SUCCESSFUL OUTCOME GNBDUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBDUConfigurationUpdateFailure + PROCEDURE CODE id-gNBDUConfigurationUpdate + CRITICALITY reject +} + +gNBCUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBCUConfigurationUpdate + SUCCESSFUL OUTCOME GNBCUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBCUConfigurationUpdateFailure + PROCEDURE CODE id-gNBCUConfigurationUpdate + CRITICALITY reject +} + +uEContextSetup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextSetupRequest + SUCCESSFUL OUTCOME UEContextSetupResponse + UNSUCCESSFUL OUTCOME UEContextSetupFailure + PROCEDURE CODE id-UEContextSetup + CRITICALITY reject +} + +uEContextRelease F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseCommand + SUCCESSFUL OUTCOME UEContextReleaseComplete + PROCEDURE CODE id-UEContextRelease + CRITICALITY reject +} + +uEContextModification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequest + SUCCESSFUL OUTCOME UEContextModificationResponse + UNSUCCESSFUL OUTCOME UEContextModificationFailure + PROCEDURE CODE id-UEContextModification + CRITICALITY reject +} + +uEContextModificationRequired F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequired + SUCCESSFUL OUTCOME UEContextModificationConfirm + PROCEDURE CODE id-UEContextModificationRequired + CRITICALITY reject +} + +writeReplaceWarning F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE WriteReplaceWarningRequest + SUCCESSFUL OUTCOME WriteReplaceWarningResponse + PROCEDURE CODE id-WriteReplaceWarning + CRITICALITY reject +} + +pWSCancel F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSCancelRequest + SUCCESSFUL OUTCOME PWSCancelResponse + PROCEDURE CODE id-PWSCancel + CRITICALITY reject +} + +errorIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + PROCEDURE CODE id-ErrorIndication + CRITICALITY ignore +} + +uEContextReleaseRequest F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseRequest + PROCEDURE CODE id-UEContextReleaseRequest + CRITICALITY ignore +} + + +initialULRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InitialULRRCMessageTransfer + PROCEDURE CODE id-InitialULRRCMessageTransfer + CRITICALITY ignore +} + +dLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DLRRCMessageTransfer + PROCEDURE CODE id-DLRRCMessageTransfer + CRITICALITY ignore +} + +uLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ULRRCMessageTransfer + PROCEDURE CODE id-ULRRCMessageTransfer + CRITICALITY ignore +} + + +uEInactivityNotification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEInactivityNotification + PROCEDURE CODE id-UEInactivityNotification + CRITICALITY ignore +} + +gNBDUResourceCoordination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceCoordinationRequest + SUCCESSFUL OUTCOME GNBDUResourceCoordinationResponse + PROCEDURE CODE id-GNBDUResourceCoordination + CRITICALITY reject +} + +privateMessage F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + PROCEDURE CODE id-privateMessage + CRITICALITY ignore +} + +systemInformationDelivery F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SystemInformationDeliveryCommand + PROCEDURE CODE id-SystemInformationDeliveryCommand + CRITICALITY ignore +} + + +paging F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Paging + PROCEDURE CODE id-Paging + CRITICALITY ignore +} + +notify F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Notify + PROCEDURE CODE id-Notify + CRITICALITY ignore +} + +pWSRestartIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSRestartIndication + PROCEDURE CODE id-PWSRestartIndication + CRITICALITY ignore +} + +pWSFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSFailureIndication + PROCEDURE CODE id-PWSFailureIndication + CRITICALITY ignore +} + + +END diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c new file mode 100644 index 0000000000..80c5b7b70d --- /dev/null +++ b/openair2/F1AP/f1ap_common.c @@ -0,0 +1,199 @@ +/* + * 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 f1ap_common.c + * \brief f1ap procedures for both CU and DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include <stdint.h> + +#include "f1ap_common.h" +//#include "S1AP-PDU.h" + +int asn_debug = 0; +int asn1_xer_print = 0; + +#if defined(EMIT_ASN_DEBUG_EXTERN) +inline void ASN_DEBUG(const char *fmt, ...) +{ + if (asn_debug) { + int adi = asn_debug_indent; + va_list ap; + va_start(ap, fmt); + fprintf(stderr, "[ASN1]"); + + while(adi--) fprintf(stderr, " "); + + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); + } +} +#endif + +ssize_t f1ap_generate_initiating_message( + uint8_t **buffer, + uint32_t *length, + e_F1ap_ProcedureCode procedureCode, + F1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *td, + void *sptr) +{ + S1AP_PDU_t pdu; + ssize_t encoded; + + memset(&pdu, 0, sizeof(S1AP_PDU_t)); + + pdu.present = S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = procedureCode; + pdu.choice.initiatingMessage.criticality = criticality; + ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr); + + if (asn1_xer_print) { + xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); + } + + /* We can safely free list of IE from sptr */ + ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); + + if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, + (void **)buffer)) < 0) { + return -1; + } + + *length = encoded; + return encoded; +} + +ssize_t f1ap_generate_successfull_outcome( + uint8_t **buffer, + uint32_t *length, + e_F1ap_ProcedureCode procedureCode, + F1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *td, + void *sptr) +{ + S1AP_PDU_t pdu; + ssize_t encoded; + + memset(&pdu, 0, sizeof(S1AP_PDU_t)); + + pdu.present = S1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome.procedureCode = procedureCode; + pdu.choice.successfulOutcome.criticality = criticality; + ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); + + if (asn1_xer_print) { + xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); + } + + /* We can safely free list of IE from sptr */ + ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); + + if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, + (void **)buffer)) < 0) { + return -1; + } + + *length = encoded; + + return encoded; +} + +ssize_t f1ap_generate_unsuccessfull_outcome( + uint8_t **buffer, + uint32_t *length, + e_F1ap_ProcedureCode procedureCode, + F1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *td, + void *sptr) +{ + S1AP_PDU_t pdu; + ssize_t encoded; + + memset(&pdu, 0, sizeof(S1AP_PDU_t)); + + pdu.present = S1AP_PDU_PR_unsuccessfulOutcome; + pdu.choice.successfulOutcome.procedureCode = procedureCode; + pdu.choice.successfulOutcome.criticality = criticality; + ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); + + if (asn1_xer_print) { + xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); + } + + /* We can safely free list of IE from sptr */ + ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); + + if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, + (void **)buffer)) < 0) { + return -1; + } + + *length = encoded; + + return encoded; +} + +F1ap_IE_t *f1ap_new_ie( + F1ap_ProtocolIE_ID_t id, + F1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *type, + void *sptr) +{ + F1ap_IE_t *buff; + + if ((buff = malloc(sizeof(F1ap_IE_t))) == NULL) { + // Possible error on malloc + return NULL; + } + + memset((void *)buff, 0, sizeof(F1ap_IE_t)); + + buff->id = id; + buff->criticality = criticality; + + if (ANY_fromType_aper(&buff->value, type, sptr) < 0) { + fprintf(stderr, "Encoding of %s failed\n", type->name); + free(buff); + return NULL; + } + + if (asn1_xer_print) + if (xer_fprint(stdout, &asn_DEF_F1ap_IE, buff) < 0) { + free(buff); + return NULL; + } + + return buff; +} + +void f1ap_handle_criticality(F1ap_Criticality_t criticality) +{ + +} diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h new file mode 100644 index 0000000000..884e3dcfe7 --- /dev/null +++ b/openair2/F1AP/f1ap_common.h @@ -0,0 +1,483 @@ +/* + * 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 f1ap_common.h + * \brief f1ap procedures for both CU and DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#if HAVE_CONFIG_H_ +# include "config.h" +#endif + +#ifndef F1AP_COMMON_H_ +#define F1AP_COMMON_H_ + +/* Defined in asn_internal.h */ +// extern int asn_debug_indent; +extern int asn_debug; + +#if defined(EMIT_ASN_DEBUG_EXTERN) +inline void ASN_DEBUG(const char *fmt, ...); +#endif + +#include "F1AP_Active-Cells-List.h" +#include "F1AP_RAT-FrequencyPriorityInformation.h" +#include "F1AP_DLUPTNLInformation-ToBeSetup-Item.h" +#include "F1AP_PrivateMessage.h" +#include "F1AP_Cause.h" +#include "F1AP_Pre-emptionVulnerability.h" +#include "F1AP_NRPCI.h" +#include "F1AP_Transmission-Bandwidth.h" +#include "F1AP_SIB1-message.h" +#include "F1AP_GNBCUConfigurationUpdateAcknowledge.h" +#include "F1AP_DRBs-Setup-Item.h" +#include "F1AP_EUTRA-NR-CellResourceCoordinationReqAck-Container.h" +#include "F1AP_NR-CGI-List-For-Restart-Item.h" +#include "F1AP_GNB-CU-Name.h" +#include "F1AP_PagingDRX.h" +#include "F1AP_RepetitionPeriod.h" +#include "F1AP_DRBs-ToBeModified-List.h" +#include "F1AP_ExecuteDuplication.h" +#include "F1AP_SCell-FailedtoSetupMod-List.h" +#include "F1AP_NRNRB.h" +#include "F1AP_SCell-ToBeSetup-List.h" +#include "F1AP_F1AP-PDU.h" +#include "F1AP_MaskedIMEISV.h" +#include "F1AP_ProtocolIE-Container.h" +#include "F1AP_GNB-CU-TNL-Association-To-Update-Item.h" +#include "F1AP_Cells-to-be-Activated-List-Item.h" +#include "F1AP_DRBs-Required-ToBeModified-Item.h" +#include "F1AP_BitRate.h" +#include "F1AP_SRBs-ToBeSetup-List.h" +#include "F1AP_ConcurrentWarningMessageIndicator.h" +#include "F1AP_CriticalityDiagnostics-IE-Item.h" +#include "F1AP_GNB-CU-TNL-Association-To-Update-List.h" +#include "F1AP_DRB-Notify-List.h" +#include "F1AP_UEContextReleaseCommand.h" +#include "F1AP_ProtocolIE-SingleContainer.h" +#include "F1AP_DRBs-ToBeReleased-List.h" +#include "F1AP_PWS-Failed-NR-CGI-List.h" +#include "F1AP_InitialULRRCMessageTransfer.h" +#include "F1AP_Served-Cell-Information.h" +#include "F1AP_Served-EUTRA-Cells-Information.h" +#include "F1AP_Cells-Broadcast-Cancelled-Item.h" +#include "F1AP_F1SetupRequest.h" +#include "F1AP_Served-Cells-To-Add-Item.h" +#include "F1AP_F1SetupFailure.h" +#include "F1AP_ULUPTNLInformation-ToBeSetup-Item.h" +#include "F1AP_GNB-CU-TNL-Association-To-Add-Item.h" +#include "F1AP_DUtoCURRCContainer.h" +#include "F1AP_GNBDUResourceCoordinationRequest.h" +#include "F1AP_DRBs-FailedToBeSetup-List.h" +#include "F1AP_UPTransportLayerInformation.h" +#include "F1AP_RRCContainer.h" +#include "F1AP_Notification-Cause.h" +#include "F1AP_UEIdentityIndexValue.h" +#include "F1AP_SRBs-ToBeSetupMod-List.h" +#include "F1AP_GNB-DU-Served-Cells-Item.h" +#include "F1AP_RLCMode.h" +#include "F1AP_NRSCS.h" +#include "F1AP_SliceSupportList.h" +#include "F1AP_GTP-TEID.h" +#include "F1AP_UEContextModificationRequest.h" +#include "F1AP_MeasConfig.h" +#include "F1AP_Flows-Mapped-To-DRB-List.h" +#include "F1AP_Cells-to-be-Deactivated-List-Item.h" +#include "F1AP_QoSFlowLevelQoSParameters.h" +#include "F1AP_GNB-CU-UE-F1AP-ID.h" +#include "F1AP_CauseTransport.h" +#include "F1AP_DRBs-ToBeReleased-Item.h" +#include "F1AP_SCell-ToBeSetupMod-Item.h" +#include "F1AP_CellGroupConfig.h" +#include "F1AP_PWSSystemInformation.h" +#include "F1AP_DRBs-Modified-List.h" +#include "F1AP_HandoverPreparationInformation.h" +#include "F1AP_InactivityMonitoringResponse.h" +#include "F1AP_Served-Cells-To-Delete-List.h" +#include "F1AP_ProtocolExtensionField.h" +#include "F1AP_GNB-CU-TNL-Association-To-Remove-List.h" +#include "F1AP_SRBID.h" +#include "F1AP_DRB-Activity-List.h" +#include "F1AP_DRBs-FailedToBeModified-Item.h" +#include "F1AP_TransactionID.h" +#include "F1AP_AllocationAndRetentionPriority.h" +#include "F1AP_ShortDRXCycleLength.h" +#include "F1AP_BroadcastPLMNs-Item.h" +#include "F1AP_DRB-Information.h" +#include "F1AP_TimeToWait.h" +#include "F1AP_NonDynamic5QIDescriptor.h" +#include "F1AP_C-RNTI.h" +#include "F1AP_MIB-message.h" +#include "F1AP_SIBtype-Item.h" +#include "F1AP_Served-Cells-To-Modify-List.h" +#include "F1AP_NRCGI.h" +#include "F1AP_DuplicationActivation.h" +#include "F1AP_CauseProtocol.h" +#include "F1AP_SCell-FailedtoSetup-Item.h" +#include "F1AP_PagingIdentity.h" +#include "F1AP_NGRANAllocationAndRetentionPriority.h" +#include "F1AP_TypeOfError.h" +#include "F1AP_GNB-CU-TNL-Association-To-Add-List.h" +#include "F1AP_DRBs-Required-ToBeReleased-Item.h" +#include "F1AP_EUTRA-Mode-Info.h" +#include "F1AP_FiveGS-TAC.h" +#include "F1AP_Cells-to-be-Activated-List.h" +#include "F1AP_PagingCell-list.h" +#include "F1AP_NotificationControl.h" +#include "F1AP_ProtectedEUTRAResourceIndication.h" +#include "F1AP_CUtoDURRCInformation.h" +#include "F1AP_SystemInformationDeliveryCommand.h" +#include "F1AP_AveragingWindow.h" +#include "F1AP_SRBs-ToBeSetupMod-Item.h" +#include "F1AP_NumberOfBroadcasts.h" +#include "F1AP_Cells-Broadcast-Completed-List.h" +#include "F1AP_GNB-CU-TNL-Association-Setup-Item.h" +#include "F1AP_PWSCancelResponse.h" +#include "F1AP_SpectrumSharingGroupID.h" +#include "F1AP_RANUEPagingIdentity.h" +#include "F1AP_CG-ConfigInfo.h" +#include "F1AP_PagingCell-Item.h" +#include "F1AP_GNB-CU-TNL-Association-To-Remove-Item.h" +#include "F1AP_UE-CapabilityRAT-ContainerList.h" +#include "F1AP_PWSCancelRequest.h" +#include "F1AP_PriorityLevel.h" +#include "F1AP_ProtocolIE-ContainerPair.h" +#include "F1AP_FullConfiguration.h" +#include "F1AP_NRCellIdentity.h" +#include "F1AP_ProtocolExtensionContainer.h" +#include "F1AP_PWSRestartIndication.h" +#include "F1AP_DRBs-ModifiedConf-List.h" +#include "F1AP_GNB-CU-TNL-Association-Failed-To-Setup-List.h" +#include "F1AP_UEContextSetupRequest.h" +#include "F1AP_PWSFailureIndication.h" +#include "F1AP_UE-associatedLogicalF1-ConnectionListResAck.h" +#include "F1AP_DRBs-ToBeSetupMod-Item.h" +#include "F1AP_SRBs-FailedToBeSetup-List.h" +#include "F1AP_Criticality.h" +#include "F1AP_UEContextModificationConfirm.h" +#include "F1AP_Broadcast-To-Be-Cancelled-List.h" +#include "F1AP_UEContextReleaseComplete.h" +#include "F1AP_PrivateIE-Container.h" +#include "F1AP_CellULConfigured.h" +#include "F1AP_DRB-Activity.h" +#include "F1AP_GNB-CU-TNL-Association-Failed-To-Setup-Item.h" +#include "F1AP_PrivateIE-ID.h" +#include "F1AP_WriteReplaceWarningResponse.h" +#include "F1AP_CauseMisc.h" +#include "F1AP_SRBs-Required-ToBeReleased-Item.h" +#include "F1AP_Cells-Broadcast-Cancelled-List.h" +#include "F1AP_ULUEConfiguration.h" +#include "F1AP_RAT-FrequencySelectionPriority.h" +#include "F1AP_UEInactivityNotification.h" +#include "F1AP_DLRRCMessageTransfer.h" +#include "F1AP_TriggeringMessage.h" +#include "F1AP_DRBs-ToBeSetup-List.h" +#include "F1AP_Cells-to-be-Barred-Item.h" +#include "F1AP_UE-associatedLogicalF1-ConnectionItem.h" +#include "F1AP_Cancel-all-Warning-Messages-Indicator.h" +#include "F1AP_SCell-FailedtoSetupMod-Item.h" +#include "F1AP_DRBs-FailedToBeSetupMod-List.h" +#include "F1AP_ProtocolIE-ID.h" +#include "F1AP_TransportLayerAddress.h" +#include "F1AP_GNB-DU-System-Information.h" +#include "F1AP_PWS-Failed-NR-CGI-Item.h" +#include "F1AP_Notify.h" +#include "F1AP_UEContextModificationResponse.h" +#include "F1AP_DRBID.h" +#include "F1AP_GNBDUResourceCoordinationResponse.h" +#include "F1AP_UEContextModificationRequired.h" +#include "F1AP_InitiatingMessage.h" +#include "F1AP_SliceSupportItem.h" +#include "F1AP_ProtocolIE-FieldPair.h" +#include "F1AP_EUTRA-TDD-Info.h" +#include "F1AP_GNBDUConfigurationUpdateFailure.h" +#include "F1AP_ULUPTNLInformation-ToBeSetup-List.h" +#include "F1AP_WriteReplaceWarningRequest.h" +#include "F1AP_ServCellIndex.h" +#include "F1AP_ResetAcknowledge.h" +#include "F1AP_SRBs-FailedToBeSetupMod-Item.h" +#include "F1AP_OffsetToPointA.h" +#include "F1AP_ProcedureCode.h" +#include "F1AP_GTPTunnel.h" +#include "F1AP_TDD-Info.h" +#include "F1AP_Pre-emptionCapability.h" +#include "F1AP_MaxDataBurstVolume.h" +#include "F1AP_SUL-Information.h" +#include "F1AP_CriticalityDiagnostics-IE-List.h" +#include "F1AP_EUTRA-FDD-Info.h" +#include "F1AP_BroadcastPLMNs-List.h" +#include "F1AP_Served-Cells-To-Delete-Item.h" +#include "F1AP_ListofEUTRACellsinGNBDUCoordination.h" +#include "F1AP_Candidate-SpCell-Item.h" +#include "F1AP_Cells-To-Be-Broadcast-List.h" +#include "F1AP_ULRRCMessageTransfer.h" +#include "F1AP_Cells-to-be-Deactivated-List.h" +#include "F1AP_DRBs-Required-ToBeReleased-List.h" +#include "F1AP_Served-Cells-To-Add-List.h" +#include "F1AP_Potential-SpCell-List.h" +#include "F1AP_EUTRANQoS.h" +#include "F1AP_Dynamic5QIDescriptor.h" +#include "F1AP_GNBCUConfigurationUpdateFailure.h" +#include "F1AP_DuplicationIndication.h" +#include "F1AP_GNB-DU-Served-Cells-List.h" +#include "F1AP_QoS-Characteristics.h" +#include "F1AP_UE-associatedLogicalF1-ConnectionListRes.h" +#include "F1AP_ResourceCoordinationTransferContainer.h" +#include "F1AP_DRXCycle.h" +#include "F1AP_DRBs-FailedToBeSetup-Item.h" +#include "F1AP_PrivateIE-Field.h" +#include "F1AP_SRBs-ToBeReleased-List.h" +#include "F1AP_MeasGapConfig.h" +#include "F1AP_NR-Mode-Info.h" +#include "F1AP_Active-Cells-Item.h" +#include "F1AP_Protected-EUTRA-Resources-List.h" +#include "F1AP_SRBs-FailedToBeSetup-Item.h" +#include "F1AP_ResetAll.h" +#include "F1AP_SCell-FailedtoSetup-List.h" +#include "F1AP_UEContextModificationFailure.h" +#include "F1AP_CNUEPagingIdentity.h" +#include "F1AP_DRBs-ToBeSetupMod-List.h" +#include "F1AP_GNBDUConfigurationUpdate.h" +#include "F1AP_DRBs-ToBeSetup-Item.h" +#include "F1AP_UnsuccessfulOutcome.h" +#include "F1AP_SRBs-FailedToBeSetupMod-List.h" +#include "F1AP_SCell-ToBeRemoved-Item.h" +#include "F1AP_InactivityMonitoringRequest.h" +#include "F1AP_Cells-Failed-to-be-Activated-List-Item.h" +#include "F1AP_DRBs-Modified-Item.h" +#include "F1AP_SRBs-Required-ToBeReleased-List.h" +#include "F1AP_GBR-QosInformation.h" +#include "F1AP_SCell-ToBeRemoved-List.h" +#include "F1AP_RANAC.h" +#include "F1AP_GNB-DU-UE-F1AP-ID.h" +#include "F1AP_CauseRadioNetwork.h" +#include "F1AP_DRB-Notify-Item.h" +#include "F1AP_GNBDUConfigurationUpdateAcknowledge.h" +#include "F1AP_GNB-CUSystemInformation.h" +#include "F1AP_ProtocolIE-Field.h" +#include "F1AP_Served-Cells-To-Modify-Item.h" +#include "F1AP_Flows-Mapped-To-DRB-Item.h" +#include "F1AP_SupportedSULFreqBandItem.h" +#include "F1AP_UEContextReleaseRequest.h" +#include "F1AP_GNB-DU-Name.h" +#include "F1AP_DRBs-ToBeModified-Item.h" +#include "F1AP_SIBtype-List.h" +#include "F1AP_EUTRA-NR-CellResourceCoordinationReq-Container.h" +#include "F1AP_DRBs-SetupMod-List.h" +#include "F1AP_DRBs-Required-ToBeModified-List.h" +#include "F1AP_DUtoCURRCInformation.h" +#include "F1AP_MaxPacketLossRate.h" +#include "F1AP_PacketDelayBudget.h" +#include "F1AP_GNBCUConfigurationUpdate.h" +#include "F1AP_Cells-Broadcast-Completed-Item.h" +#include "F1AP_RRCRconfigurationCompleteIndicator.h" +#include "F1AP_PagingPriority.h" +#include "F1AP_Cells-Failed-to-be-Activated-List.h" +#include "F1AP_Endpoint-IP-address-and-port.h" +#include "F1AP_PacketErrorRate.h" +#include "F1AP_PLMN-Identity.h" +#include "F1AP_asn_constant.h" +#include "F1AP_ResetType.h" +#include "F1AP_FDD-Info.h" +#include "F1AP_DLUPTNLInformation-ToBeSetup-List.h" +#include "F1AP_QoSFlowIndicator.h" +#include "F1AP_NR-CGI-List-For-Restart-List.h" +#include "F1AP_F1SetupResponse.h" +#include "F1AP_UEContextSetupResponse.h" +#include "F1AP_CP-TransportLayerAddress.h" +#include "F1AP_Broadcast-To-Be-Cancelled-Item.h" +#include "F1AP_ErrorIndication.h" +#include "F1AP_SubscriberProfileIDforRFP.h" +#include "F1AP_SNSSAI.h" +#include "F1AP_DRBs-ModifiedConf-Item.h" +#include "F1AP_GNB-CU-TNL-Association-Setup-List.h" +#include "F1AP_DRB-Activity-Item.h" +#include "F1AP_LCID.h" +#include "F1AP_ULConfiguration.h" +#include "F1AP_ShortDRXCycleTimer.h" +#include "F1AP_FreqBandNrItem.h" +#include "F1AP_Cells-to-be-Barred-List.h" +#include "F1AP_Presence.h" +#include "F1AP_CellBarred.h" +#include "F1AP_SIBtype.h" +#include "F1AP_RequestType.h" +#include "F1AP_NRFreqInfo.h" +#include "F1AP_Potential-SpCell-Item.h" +#include "F1AP_NumberofBroadcastRequest.h" +#include "F1AP_TNLAssociationUsage.h" +#include "F1AP_SCell-ToBeSetupMod-List.h" +#include "F1AP_DRBs-Setup-List.h" +#include "F1AP_Reset.h" +#include "F1AP_CriticalityDiagnostics.h" +#include "F1AP_Paging.h" +#include "F1AP_LongDRXCycleLength.h" +#include "F1AP_GNB-DU-ID.h" +#include "F1AP_SuccessfulOutcome.h" +#include "F1AP_Configured-EPS-TAC.h" +#include "F1AP_Candidate-SpCell-List.h" +#include "F1AP_SRBs-ToBeReleased-Item.h" +#include "F1AP_QoSInformation.h" +#include "F1AP_SCell-ToBeSetup-Item.h" +#include "F1AP_SRBs-ToBeSetup-Item.h" +#include "F1AP_GBR-QoSFlowInformation.h" +#include "F1AP_SCellIndex.h" +#include "F1AP_DRBs-SetupMod-Item.h" +#include "F1AP_TransmissionStopIndicator.h" +#include "F1AP_UEContextSetupFailure.h" +#include "F1AP_DRBs-FailedToBeModified-List.h" +#include "F1AP_DRBs-FailedToBeSetupMod-Item.h" +#include "F1AP_ProtocolExtensionID.h" +#include "F1AP_Cells-To-Be-Broadcast-Item.h" +#include "F1AP_QCI.h" + +/* Checking version of ASN1C compiler */ +#if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) +# error "You are compiling f1ap with the wrong version of ASN1C" +#endif + +#ifndef FALSE +# define FALSE (0) +#endif +#ifndef TRUE +# define TRUE (!FALSE) +#endif + +#define F1AP_UE_ID_FMT "0x%06"PRIX32 + +extern int asn_debug; +extern int asn1_xer_print; + +#include "assertions.h" + +#if defined(ENB_MODE) +# include "log.h" +# include "f1ap_default_values.h" +# define F1AP_ERROR(x, args...) LOG_E(F1AP, x, ##args) +# define F1AP_WARN(x, args...) LOG_W(F1AP, x, ##args) +# define F1AP_TRAF(x, args...) LOG_I(F1AP, x, ##args) +# define F1AP_INFO(x, args...) LOG_I(F1AP, x, ##args) +# define F1AP_DEBUG(x, args...) LOG_I(F1AP, x, ##args) +#else +//# include "mme_default_values.h" +# define F1AP_ERROR(x, args...) do { fprintf(stdout, "[F1AP][E]"x, ##args); } while(0) +# define F1AP_WARN(x, args...) do { fprintf(stdout, "[F1AP][W]"x, ##args); } while(0) +# define F1AP_TRAF(x, args...) do { fprintf(stdout, "[F1AP][T]"x, ##args); } while(0) +# define F1AP_INFO(x, args...) do { fprintf(stdout, "[F1AP][I]"x, ##args); } while(0) +# define F1AP_DEBUG(x, args...) do { fprintf(stdout, "[F1AP][D]"x, ##args); } while(0) +#endif + +//Forward declaration +//struct f1ap_message_s; + +typedef struct f1ap_message_s { + F1AP_ProtocolIE_ID_t id; + F1AP_Criticality_t criticality; + uint8_t direction; + union { + F1AP_F1SetupRequestIEs_t f1ap_F1SetupRequestIEs; + } msg; +} f1ap_message; + +/** \brief Function callback prototype. + **/ +/*typedef int (*f1ap_message_decoded_callback)( + uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p +);*/ + +/** \brief Encode a successfull outcome message + \param buffer pointer to buffer in which data will be encoded + \param length pointer to the length of buffer + \param procedureCode Procedure code for the message + \param criticality Criticality of the message + \param td ASN1C type descriptor of the sptr + \param sptr Deferenced pointer to the structure to encode + @returns size in bytes encded on success or 0 on failure + **/ +/*ssize_t f1ap_generate_successfull_outcome( + uint8_t **buffer, + uint32_t *length, + e_F1ap_ProcedureCode procedureCode, + F1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *td, + void *sptr); +*/ +/** \brief Encode an initiating message + \param buffer pointer to buffer in which data will be encoded + \param length pointer to the length of buffer + \param procedureCode Procedure code for the message + \param criticality Criticality of the message + \param td ASN1C type descriptor of the sptr + \param sptr Deferenced pointer to the structure to encode + @returns size in bytes encded on success or 0 on failure + **/ +/*ssize_t f1ap_generate_initiating_message( + uint8_t **buffer, + uint32_t *length, + e_F1ap_ProcedureCode procedureCode, + F1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *td, + void *sptr); +*/ +/** \brief Encode an unsuccessfull outcome message + \param buffer pointer to buffer in which data will be encoded + \param length pointer to the length of buffer + \param procedureCode Procedure code for the message + \param criticality Criticality of the message + \param td ASN1C type descriptor of the sptr + \param sptr Deferenced pointer to the structure to encode + @returns size in bytes encded on success or 0 on failure + **/ +/*ssize_t f1ap_generate_unsuccessfull_outcome( + uint8_t **buffer, + uint32_t *length, + e_F1ap_ProcedureCode procedureCode, + F1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *td, + void *sptr); +*/ +/** \brief Generate a new IE + \param id Protocol ie id of the IE + \param criticality Criticality of the IE + \param type ASN1 type descriptor of the IE value + \param sptr Structure to be encoded in the value field + @returns a pointer to the newly created IE structure or NULL in case of failure + **/ +/*F1ap_IE_t *f1ap_new_ie(F1ap_ProtocolIE_ID_t id, + F1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *type, + void *sptr); +*/ +/** \brief Handle criticality + \param criticality Criticality of the IE + @returns void + **/ +//void f1ap_handle_criticality(F1ap_Criticality_t criticality); + +#endif /* F1AP_COMMON_H_ */ diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c new file mode 100644 index 0000000000..9d89cf5172 --- /dev/null +++ b/openair2/F1AP/f1ap_decoder.c @@ -0,0 +1,235 @@ +/* + * 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 f1ap_decoder.c + * \brief f1ap pdu decode procedures + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include <stdio.h> + +#include "assertions.h" + +#include "intertask_interface.h" + +#include "f1ap_common.h" +#include "f1ap_ies_defs.h" +#include "f1ap_decoder.h" + +static int f1ap_decode_initiating_message(f1ap_message *message, + F1ap_InitiatingMessage_t *initiating_p) +{ + int ret = -1; + MessageDef *message_p; + char *message_string = NULL; + size_t message_string_size; + MessagesIds message_id; + + DevAssert(initiating_p != NULL); + + message_string = calloc(10000, sizeof(char)); + + f1ap_string_total_size = 0; + + message->procedureCode = initiating_p->procedureCode; + message->criticality = initiating_p->criticality; + + switch(initiating_p->procedureCode) { + + case F1ap_ProcedureCode_id_InitialContextSetup: + ret = f1ap_decode_f1ap_initialcontextsetuprequesties( + &message->msg.f1ap_InitialContextSetupRequestIEs, &initiating_p->value); + f1ap_xer_print_f1ap_initialcontextsetuprequest(f1ap_xer__print2sp, message_string, message); + message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; + message_string_size = strlen(message_string); + message_p = itti_alloc_new_message_sized(TASK_F1AP, + message_id, + message_string_size + sizeof (IttiMsgText)); + message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size; + memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(message_string); + break; + + case F1ap_ProcedureCode_id_UEContextRelease: + ret = f1ap_decode_f1ap_uecontextreleasecommandies( + &message->msg.f1ap_UEContextReleaseCommandIEs, &initiating_p->value); + f1ap_xer_print_f1ap_uecontextreleasecommand(f1ap_xer__print2sp, message_string, message); + message_id = F1AP_UE_CONTEXT_RELEASE_COMMAND_LOG; + message_string_size = strlen(message_string); + message_p = itti_alloc_new_message_sized(TASK_F1AP, + message_id, + message_string_size + sizeof (IttiMsgText)); + message_p->ittiMsg.f1ap_ue_context_release_command_log.size = message_string_size; + memcpy(&message_p->ittiMsg.f1ap_ue_context_release_command_log.text, message_string, message_string_size); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(message_string); + break; + + case F1ap_ProcedureCode_id_ErrorIndication: + ret = f1ap_decode_f1ap_errorindicationies( + &message->msg.f1ap_ErrorIndicationIEs, &initiating_p->value); + f1ap_xer_print_f1ap_errorindication(f1ap_xer__print2sp, message_string, message); + message_id = F1AP_E_RAB_ERROR_INDICATION_LOG; + message_string_size = strlen(message_string); + message_p = itti_alloc_new_message_sized(TASK_F1AP, + message_id, + message_string_size + sizeof (IttiMsgText)); + message_p->ittiMsg.f1ap_e_rab_release_request_log.size = message_string_size; + memcpy(&message_p->ittiMsg.f1ap_error_indication_log.text, message_string, message_string_size); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(message_string); + F1AP_INFO("ErrorIndication initiating message\n"); + break; + + default: + F1AP_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); + return -1; + } + + + return ret; +} + +static int f1ap_decode_successful_outcome(f1ap_message *message, + F1ap_SuccessfulOutcome_t *successfullOutcome_p) +{ + int ret = -1; + MessageDef *message_p; + char *message_string = NULL; + size_t message_string_size; + MessagesIds message_id; + + DevAssert(successfullOutcome_p != NULL); + + message_string = malloc(sizeof(char) * 10000); + memset((void*)message_string,0,sizeof(char) * 10000); + + f1ap_string_total_size = 0; + + message->procedureCode = successfullOutcome_p->procedureCode; + message->criticality = successfullOutcome_p->criticality; + + switch(successfullOutcome_p->procedureCode) { + case F1ap_ProcedureCode_id_F1Setup: + ret = f1ap_decode_f1ap_f1setupresponseies( + &message->msg.f1ap_F1SetupResponseIEs, &successfullOutcome_p->value); + f1ap_xer_print_f1ap_f1setupresponse(f1ap_xer__print2sp, message_string, message); + message_id = F1AP_F1_SETUP_LOG; + break; + + default: + F1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n", + (int)successfullOutcome_p->procedureCode); + return -1; + } + + message_string_size = strlen(message_string); + + message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); + message_p->ittiMsg.f1ap_f1_setup_log.size = message_string_size; + memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + + free(message_string); + + return ret; +} + +static int f1ap_decode_unsuccessful_outcome(f1ap_message *message, + F1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p) +{ + int ret = -1; + DevAssert(unSuccessfullOutcome_p != NULL); + + message->procedureCode = unSuccessfullOutcome_p->procedureCode; + message->criticality = unSuccessfullOutcome_p->criticality; + + switch(unSuccessfullOutcome_p->procedureCode) { + case F1ap_ProcedureCode_id_F1Setup: + return f1ap_decode_f1ap_f1setupfailureies( + &message->msg.f1ap_F1SetupFailureIEs, &unSuccessfullOutcome_p->value); + + default: + F1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n", + (int)unSuccessfullOutcome_p->procedureCode); + break; + } + + return ret; +} + +int f1ap_decode_pdu(f1ap_message *message, const uint8_t * const buffer, + const uint32_t length) +{ + F1AP_PDU_t pdu; + F1AP_PDU_t *pdu_p = &pdu; + asn_dec_rval_t dec_ret; + + DevAssert(buffer != NULL); + + memset((void *)pdu_p, 0, sizeof(F1AP_PDU_t)); + + dec_ret = aper_decode(NULL, + &asn_DEF_F1AP_PDU, + (void **)&pdu_p, + buffer, + length, + 0, + 0); + + if (dec_ret.code != RC_OK) { + F1AP_ERROR("Failed to decode pdu\n"); + return -1; + } + + message->direction = pdu_p->present; + + switch(pdu_p->present) { + case F1AP_F1AP_PDU_PR_initiatingMessage: + return f1ap_decode_initiating_message(message, + &pdu_p->choice.initiatingMessage); + + case F1AP_F1AP_PDU_PR_successfulOutcome: + return f1ap_decode_successful_outcome(message, + &pdu_p->choice.successfulOutcome); + + case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: + return f1ap_decode_unsuccessful_outcome(message, + &pdu_p->choice.unsuccessfulOutcome); + + default: + F1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu_p->present); + break; + } + + return -1; +} diff --git a/openair2/F1AP/f1ap_decoder.h b/openair2/F1AP/f1ap_decoder.h new file mode 100644 index 0000000000..81a8e3512b --- /dev/null +++ b/openair2/F1AP/f1ap_decoder.h @@ -0,0 +1,42 @@ +/* + * 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 f1ap_decoder.h + * \brief f1ap pdu decode procedures + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include <stdint.h> +#include "f1ap_ies_defs.h" + +#ifndef F1AP_DECODER_H_ +#define F1AP_DECODER_H_ + +int f1ap_decode_pdu(f1ap_message *message, const uint8_t * const buffer, + const uint32_t length) __attribute__ ((warn_unused_result)); + +#endif /* F1AP_DECODER_H_ */ diff --git a/openair2/F1AP/f1ap_default_values.h b/openair2/F1AP/f1ap_default_values.h new file mode 100644 index 0000000000..ddb2ef5b07 --- /dev/null +++ b/openair2/F1AP/f1ap_default_values.h @@ -0,0 +1,46 @@ +/* + * 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 f1ap_default_values.h + * \brief default values for f1ap procedures + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#ifndef F1AP_DEFAULT_VALUES_H_ +#define F1AP_DEFAULT_VALUES_H_ + +#define ENB_TAC (1) +#define ENB_MCC (208) +#define ENB_MNC (92) + +#define ENB_NAME "Eurecom ENB" +#define ENB_NAME_FORMAT (ENB_NAME" %u") + +#define F1AP_PORT_NUMBER (3642) +#define F1AP_SCTP_PPID (62) + +#endif /* F1AP_DEFAULT_VALUES_H_ */ diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c new file mode 100644 index 0000000000..58be896eae --- /dev/null +++ b/openair2/F1AP/f1ap_encoder.c @@ -0,0 +1,382 @@ +/* + * 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 f1ap_encoder.c + * \brief f1ap pdu encode procedures + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include <stdio.h> +#include <string.h> +#include <stdint.h> + +#include "assertions.h" + +#include "conversions.h" + +#include "intertask_interface.h" + +#include "f1ap_common.h" +#include "f1ap_ies_defs.h" +#include "f1ap_encoder.h" + +static inline int f1ap_encode_initiating(f1ap_message *message, + uint8_t **buffer, + uint32_t *len); + +static inline int f1ap_encode_successfull_outcome(f1ap_message *message, + uint8_t **buffer, uint32_t *len); + +static inline int f1ap_encode_unsuccessfull_outcome(f1ap_message *message, + uint8_t **buffer, uint32_t *len); + +static inline int f1ap_encode_f1_setup_request( + F1ap_F1SetupRequestIEs_t *f1SetupRequestIEs, uint8_t **buffer, uint32_t *length); + +static inline int f1ap_encode_trace_failure(F1ap_TraceFailureIndicationIEs_t + *trace_failure_ies_p, uint8_t **buffer, + uint32_t *length); + +static inline int f1ap_encode_initial_context_setup_response( + F1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs, + uint8_t **buffer, + uint32_t *length); + +static inline +int f1ap_encode_ue_context_release_complete( + F1ap_UEContextReleaseCompleteIEs_t *f1ap_UEContextReleaseCompleteIEs, + uint8_t **buffer, + uint32_t *length); + +static inline +int f1ap_encode_ue_context_release_request( + F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs, + uint8_t **buffer, + uint32_t *length); + +int f1ap_encode_pdu(f1ap_message *message, uint8_t **buffer, uint32_t *len) +{ + DevAssert(message != NULL); + DevAssert(buffer != NULL); + DevAssert(len != NULL); + + switch(message->direction) { // Need Check (present)? + case F1AP_F1AP_PDU_PR_initiatingMessage: + return f1ap_encode_initiating(message, buffer, len); + + case F1AP_F1AP_PDU_PR_successfulOutcome: + return f1ap_encode_successfull_outcome(message, buffer, len); + + case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: + return f1ap_encode_unsuccessfull_outcome(message, buffer, len); + + default: + F1AP_DEBUG("Unknown message outcome (%d) or not implemented", + (int)message->direction); + break; + } + + return -1; +} + +static inline +int f1ap_encode_initiating(f1ap_message *f1ap_message_p, + uint8_t **buffer, uint32_t *len) +{ + int ret = -1; + MessageDef *message_p; + char *message_string = NULL; + size_t message_string_size; + MessagesIds message_id; + + DevAssert(f1ap_message_p != NULL); + + message_string = calloc(10000, sizeof(char)); + + f1ap_string_total_size = 0; + + switch(f1ap_message_p->procedureCode) { + case F1ap_ProcedureCode_id_F1Setup: + ret = f1ap_encode_f1_setup_request( + &f1ap_message_p->msg.f1ap_F1SetupRequestIEs, buffer, len); + //f1ap_xer_print_f1ap_f1setuprequest(f1ap_xer__print2sp, message_string, f1ap_message_p); + message_id = F1AP_F1_SETUP_LOG; + break; + + case F1ap_ProcedureCode_id_UEContextReleaseRequest: + ret = f1ap_encode_ue_context_release_request( + &f1ap_message_p->msg.f1ap_UEContextReleaseRequestIEs, buffer, len); + //f1ap_xer_print_f1ap_uecontextreleaserequest(f1ap_xer__print2sp, + // message_string, f1ap_message_p); + message_id = F1AP_UE_CONTEXT_RELEASE_REQ_LOG; + break; + + + default: + F1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n", + (int)f1ap_message_p->procedureCode); + return ret; + break; + } + + message_string_size = strlen(message_string); + + message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); + message_p->ittiMsg.f1ap_f1_setup_log.size = message_string_size; + memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + + free(message_string); + + return ret; +} + +static inline +int f1ap_encode_successfull_outcome(f1ap_message *f1ap_message_p, + uint8_t **buffer, uint32_t *len) +{ + int ret = -1; + MessageDef *message_p; + char *message_string = NULL; + size_t message_string_size; + MessagesIds message_id; + + DevAssert(f1ap_message_p != NULL); + + message_string = calloc(10000, sizeof(char)); + + f1ap_string_total_size = 0; + message_string_size = strlen(message_string); + + + switch(f1ap_message_p->procedureCode) { + case F1ap_ProcedureCode_id_InitialContextSetup: + ret = f1ap_encode_initial_context_setup_response( + &f1ap_message_p->msg.f1ap_InitialContextSetupResponseIEs, buffer, len); + + f1ap_xer_print_f1ap_initialcontextsetupresponse(f1ap_xer__print2sp, message_string, f1ap_message_p); + message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; + message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); + message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size; + memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(message_string); + break; + + case F1ap_ProcedureCode_id_UEContextRelease: + ret = f1ap_encode_ue_context_release_complete( + &f1ap_message_p->msg.f1ap_UEContextReleaseCompleteIEs, buffer, len); + f1ap_xer_print_f1ap_uecontextreleasecomplete(f1ap_xer__print2sp, message_string, f1ap_message_p); + message_id = F1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG; + message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); + message_p->ittiMsg.f1ap_ue_context_release_complete_log.size = message_string_size; + memcpy(&message_p->ittiMsg.f1ap_ue_context_release_complete_log.text, message_string, message_string_size); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(message_string); + break; + + default: + F1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n", + (int)f1ap_message_p->procedureCode); + return ret; + break; + } + + + return ret; +} + +static inline +int f1ap_encode_unsuccessfull_outcome(f1ap_message *f1ap_message_p, + uint8_t **buffer, uint32_t *len) +{ + int ret = -1; + MessageDef *message_p; + char *message_string = NULL; + size_t message_string_size; + MessagesIds message_id; + + DevAssert(f1ap_message_p != NULL); + + message_string = calloc(10000, sizeof(char)); + + f1ap_string_total_size = 0; + + switch(f1ap_message_p->procedureCode) { + case F1ap_ProcedureCode_id_InitialContextSetup: + // ret = f1ap_encode_f1ap_initialcontextsetupfailureies( + // &f1ap_message_p->ittiMsg.f1ap_InitialContextSetupFailureIEs, buffer, len); + f1ap_xer_print_f1ap_initialcontextsetupfailure(f1ap_xer__print2sp, message_string, f1ap_message_p); + message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; + break; + + default: + F1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n", + (int)f1ap_message_p->procedureCode); + return ret; + break; + } + + message_string_size = strlen(message_string); + + message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); + message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size; + memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + + free(message_string); + + return ret; +} + +static inline +int f1ap_encode_f1_setup_request( + F1ap_F1SetupRequestIEs_t *f1SetupRequestIEs, + uint8_t **buffer, + uint32_t *length) +{ + F1ap_F1SetupRequest_t f1SetupRequest; + F1ap_F1SetupRequest_t *f1SetupRequest_p = &f1SetupRequest; + + memset((void *)f1SetupRequest_p, 0, sizeof(f1SetupRequest)); + + if (f1ap_encode_f1ap_f1setuprequesties(f1SetupRequest_p, f1SetupRequestIEs) < 0) { + return -1; + } + + return f1ap_generate_initiating_message(buffer, + length, + F1ap_ProcedureCode_id_F1Setup, + F1ap_Criticality_reject, + &asn_DEF_F1ap_F1SetupRequest, + f1SetupRequest_p); +} + +static inline +int f1ap_encode_trace_failure( + F1ap_TraceFailureIndicationIEs_t *trace_failure_ies_p, + uint8_t **buffer, + uint32_t *length) +{ + F1ap_TraceFailureIndication_t trace_failure; + F1ap_TraceFailureIndication_t *trace_failure_p = &trace_failure; + + memset((void *)trace_failure_p, 0, sizeof(trace_failure)); + + if (f1ap_encode_f1ap_tracefailureindicationies( + trace_failure_p, trace_failure_ies_p) < 0) { + return -1; + } + + return f1ap_generate_initiating_message(buffer, + length, + F1ap_ProcedureCode_id_TraceFailureIndication, + F1ap_Criticality_reject, + &asn_DEF_F1ap_TraceFailureIndication, + trace_failure_p); +} + +static inline +int f1ap_encode_initial_context_setup_response( + F1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs, + uint8_t **buffer, + uint32_t *length) +{ + F1ap_InitialContextSetupResponse_t initial_context_setup_response; + F1ap_InitialContextSetupResponse_t *initial_context_setup_response_p = + &initial_context_setup_response; + + memset((void *)initial_context_setup_response_p, 0, + sizeof(initial_context_setup_response)); + + if (f1ap_encode_f1ap_initialcontextsetupresponseies( + initial_context_setup_response_p, initialContextSetupResponseIEs) < 0) { + return -1; + } + + return f1ap_generate_successfull_outcome(buffer, + length, + F1ap_ProcedureCode_id_InitialContextSetup, + F1ap_Criticality_reject, + &asn_DEF_F1ap_InitialContextSetupResponse, + initial_context_setup_response_p); +} + +static inline +int f1ap_encode_ue_context_release_complete( + F1ap_UEContextReleaseCompleteIEs_t *f1ap_UEContextReleaseCompleteIEs, + uint8_t **buffer, + uint32_t *length) +{ + F1ap_UEContextReleaseComplete_t ue_context_release_complete; + F1ap_UEContextReleaseComplete_t *ue_context_release_complete_p = + &ue_context_release_complete; + + memset((void *)ue_context_release_complete_p, 0, + sizeof(ue_context_release_complete)); + + if (f1ap_encode_f1ap_uecontextreleasecompleteies( + ue_context_release_complete_p, f1ap_UEContextReleaseCompleteIEs) < 0) { + return -1; + } + + return f1ap_generate_successfull_outcome(buffer, + length, + F1ap_ProcedureCode_id_UEContextRelease, + F1ap_Criticality_reject, + &asn_DEF_F1ap_UEContextReleaseComplete, + ue_context_release_complete_p); +} + +static inline +int f1ap_encode_ue_context_release_request( + F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs, + uint8_t **buffer, + uint32_t *length) +{ + F1ap_UEContextReleaseRequest_t ue_context_release_request; + F1ap_UEContextReleaseRequest_t *ue_context_release_request_p = + &ue_context_release_request; + + memset((void *)ue_context_release_request_p, 0, + sizeof(ue_context_release_request)); + + if (f1ap_encode_f1ap_uecontextreleaserequesties( + ue_context_release_request_p, f1ap_UEContextReleaseRequestIEs) < 0) { + return -1; + } + + return f1ap_generate_initiating_message(buffer, + length, + F1ap_ProcedureCode_id_UEContextReleaseRequest, + F1ap_Criticality_reject, + &asn_DEF_F1ap_UEContextReleaseRequest, + ue_context_release_request_p); +} + diff --git a/openair2/F1AP/f1ap_encoder.h b/openair2/F1AP/f1ap_encoder.h new file mode 100644 index 0000000000..d926497aa5 --- /dev/null +++ b/openair2/F1AP/f1ap_encoder.h @@ -0,0 +1,39 @@ +/* + * 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 f1ap_encoder.h + * \brief f1ap pdu encode procedures + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#ifndef F1AP_ENCODER_H_ +#define F1AP_ENCODER_H_ + +int f1ap_encode_pdu(f1ap_message *message, uint8_t **buffer, uint32_t *len) +__attribute__ ((warn_unused_result)); + +#endif /* F1AP_ENCODER_H_ */ diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c new file mode 100644 index 0000000000..e779364803 --- /dev/null +++ b/openair2/F1AP/f1ap_handlers.c @@ -0,0 +1,1381 @@ +/* + * 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 f1ap_handlers.c + * \brief f1ap messages handlers + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include <stdint.h> + +#include "intertask_interface.h" + +#include "asn1_conversions.h" + +#include "f1ap_common.h" +#include "f1ap_ies_defs.h" +// #include "f1ap_eNB.h" +#include "f1ap_defs.h" +#include "f1ap_handlers.h" +#include "f1ap_decoder.h" + +#include "f1ap_ue_context.h" +#include "f1ap_trace.h" +#include "f1ap_nas_procedures.h" +#include "f1ap_management_procedures.h" + +#include "f1ap_default_values.h" + +#include "assertions.h" +#include "conversions.h" +#include "msc.h" + +static +int f1ap_handle_f1_setup_response(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p); +static +int f1ap_handle_f1_setup_failure(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p); + +static +int f1ap_handle_error_indication(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p); + +static +int f1ap_handle_initial_context_request(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p); + +static +int f1ap_handle_ue_context_release_command(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p); + + +static +int f1ap_handle_e_rab_setup_request(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p); + +static +int f1ap_handle_paging(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p); + +static +int f1ap_handle_e_rab_modify_request(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p); + +static +int f1ap_handle_e_rab_release_command(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p); + +/* Handlers matrix. Only eNB related procedure present here */ +f1ap_message_decoded_callback messages_callback[][3] = { + { 0, 0, 0 }, /* HandoverPreparation */ + { 0, 0, 0 }, /* HandoverResourceAllocation */ + { 0, 0, 0 }, /* HandoverNotification */ + { 0, 0, 0 }, /* PathSwitchRequest */ + { 0, 0, 0 }, /* HandoverCancel */ + { f1ap_handle_e_rab_setup_request, 0, 0 }, /* E_RABSetup */ + { f1ap_handle_e_rab_modify_request, 0, 0 }, /* E_RABModify */ + { f1ap_handle_e_rab_release_command, 0, 0 }, /* E_RABRelease */ + { 0, 0, 0 }, /* E_RABReleaseIndication */ + { f1ap_handle_initial_context_request, 0, 0 }, /* InitialContextSetup */ + { f1ap_handle_paging, 0, 0 }, /* Paging */ + { f1ap_handle_nas_downlink, 0, 0 }, /* downlinkNASTransport */ + { 0, 0, 0 }, /* initialUEMessage */ + { 0, 0, 0 }, /* uplinkNASTransport */ + { 0, 0, 0 }, /* Reset */ + { f1ap_handle_error_indication, 0, 0 }, /* ErrorIndication */ + { 0, 0, 0 }, /* NASNonDeliveryIndication */ + { 0, f1ap_handle_f1_setup_response, f1ap_handle_f1_setup_failure }, /* F1Setup */ + { 0, 0, 0 }, /* UEContextReleaseRequest */ + { 0, 0, 0 }, /* DownlinkF1cdma2000tunneling */ + { 0, 0, 0 }, /* UplinkF1cdma2000tunneling */ + { 0, 0, 0 }, /* UEContextModification */ + { 0, 0, 0 }, /* UECapabilityInfoIndication */ + { f1ap_handle_ue_context_release_command, 0, 0 }, /* UEContextRelease */ + { 0, 0, 0 }, /* eNBStatusTransfer */ + { 0, 0, 0 }, /* MMEStatusTransfer */ + { f1ap_handle_deactivate_trace, 0, 0 }, /* DeactivateTrace */ + { f1ap_handle_trace_start, 0, 0 }, /* TraceStart */ + { 0, 0, 0 }, /* TraceFailureIndication */ + { 0, 0, 0 }, /* ENBConfigurationUpdate */ + { 0, 0, 0 }, /* MMEConfigurationUpdate */ + { 0, 0, 0 }, /* LocationReportingControl */ + { 0, 0, 0 }, /* LocationReportingFailureIndication */ + { 0, 0, 0 }, /* LocationReport */ + { 0, 0, 0 }, /* OverloadStart */ + { 0, 0, 0 }, /* OverloadStop */ + { 0, 0, 0 }, /* WriteReplaceWarning */ + { 0, 0, 0 }, /* eNBDirectInformationTransfer */ + { 0, 0, 0 }, /* MMEDirectInformationTransfer */ + { 0, 0, 0 }, /* PrivateMessage */ + { 0, 0, 0 }, /* eNBConfigurationTransfer */ + { 0, 0, 0 }, /* MMEConfigurationTransfer */ + { 0, 0, 0 }, /* CellTrafficTrace */ +#if (F1AP_VERSION >= MAKE_VERSION(9, 0, 0)) + { 0, 0, 0 }, /* Kill */ + { 0, 0, 0 }, /* DownlinkUEAssociatedLPPaTransport */ + { 0, 0, 0 }, /* UplinkUEAssociatedLPPaTransport */ + { 0, 0, 0 }, /* DownlinkNonUEAssociatedLPPaTransport */ + { 0, 0, 0 }, /* UplinkNonUEAssociatedLPPaTransport */ +#endif +}; + +static const char *f1ap_direction2String[] = { + "", /* Nothing */ + "Originating message", /* originating message */ + "Successfull outcome", /* successfull outcome */ + "UnSuccessfull outcome", /* successfull outcome */ +}; + +void f1ap_handle_f1_setup_message(f1ap_mme_data_t *mme_desc_p, int sctp_shutdown) +{ + if (sctp_shutdown) { + /* A previously connected MME has been shutdown */ + + /* TODO check if it was used by some eNB and send a message to inform these eNB if there is no more associated MME */ + if (mme_desc_p->state == F1AP_ENB_STATE_CONNECTED) { + mme_desc_p->state = F1AP_ENB_STATE_DISCONNECTED; + + if (mme_desc_p->f1ap_instance->f1ap_mme_associated_nb > 0) { + /* Decrease associated MME number */ + mme_desc_p->f1ap_instance->f1ap_mme_associated_nb --; + } + + /* If there are no more associated MME, inform eNB app */ + if (mme_desc_p->f1ap_instance->f1ap_mme_associated_nb == 0) { + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_DEREGISTERED_ENB_IND); + F1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; + itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->f1ap_instance->instance, message_p); + } + } + } else { + /* Check that at least one setup message is pending */ + DevCheck(mme_desc_p->f1ap_instance->f1ap_mme_pending_nb > 0, mme_desc_p->f1ap_instance->instance, + mme_desc_p->f1ap_instance->f1ap_mme_pending_nb, 0); + + if (mme_desc_p->f1ap_instance->f1ap_mme_pending_nb > 0) { + /* Decrease pending messages number */ + mme_desc_p->f1ap_instance->f1ap_mme_pending_nb --; + } + + /* If there are no more pending messages, inform eNB app */ + if (mme_desc_p->f1ap_instance->f1ap_mme_pending_nb == 0) { + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_REGISTER_ENB_CNF); + F1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->f1ap_instance->f1ap_mme_associated_nb; + itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->f1ap_instance->instance, message_p); + } + } +} + +int f1ap_handle_message(uint32_t assoc_id, int32_t stream, + const uint8_t * const data, const uint32_t data_length) +{ + struct f1ap_message_s message; + + DevAssert(data != NULL); + + memset(&message, 0, sizeof(struct f1ap_message_s)); + + if (f1ap_decode_pdu(&message, data, data_length) < 0) { + F1AP_ERROR("Failed to decode PDU\n"); + return -1; + } + + /* Checking procedure Code and direction of message */ + if (message.procedureCode > sizeof(messages_callback) / (3 * sizeof( + f1ap_message_decoded_callback)) + || (message.direction > F1AP_PDU_PR_unsuccessfulOutcome)) { + F1AP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", + assoc_id, message.procedureCode, message.direction); + return -1; + } + + /* No handler present. + * This can mean not implemented or no procedure for eNB (wrong direction). + */ + if (messages_callback[message.procedureCode][message.direction-1] == NULL) { + F1AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n", + assoc_id, message.procedureCode, + f1ap_direction2String[message.direction]); + return -1; + } + + /* Calling the right handler */ + return (*messages_callback[message.procedureCode][message.direction-1]) + (assoc_id, stream, &message); +} + +static +int f1ap_handle_f1_setup_failure(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p) +{ + F1ap_F1SetupFailureIEs_t *f1_setup_failure_p; + f1ap_mme_data_t *mme_desc_p; + + DevAssert(message_p != NULL); + + f1_setup_failure_p = &message_p->msg.f1ap_F1SetupFailureIEs; + + /* F1 Setup Failure == Non UE-related procedure -> stream 0 */ + if (stream != 0) { + F1AP_WARN("[SCTP %d] Received f1 setup failure on stream != 0 (%d)\n", + assoc_id, stream); + } + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received F1 setup response for non existing " + "MME context\n", assoc_id); + return -1; + } + + if ((f1_setup_failure_p->cause.present == F1ap_Cause_PR_misc) && + (f1_setup_failure_p->cause.choice.misc == F1ap_CauseMisc_unspecified)) { + F1AP_WARN("Received f1 setup failure for MME... MME is not ready\n"); + } else { + F1AP_ERROR("Received f1 setup failure for MME... please check your parameters\n"); + } + + mme_desc_p->state = F1AP_ENB_STATE_WAITING; + f1ap_handle_f1_setup_message(mme_desc_p, 0); + + return 0; +} + +static +int f1ap_handle_f1_setup_response(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p) +{ + F1ap_F1SetupResponseIEs_t *f1SetupResponse_p; + f1ap_mme_data_t *mme_desc_p; + int i; + + DevAssert(message_p != NULL); + + f1SetupResponse_p = &message_p->msg.f1ap_F1SetupResponseIEs; + + /* F1 Setup Response == Non UE-related procedure -> stream 0 */ + if (stream != 0) { + F1AP_ERROR("[SCTP %d] Received f1 setup response on stream != 0 (%d)\n", + assoc_id, stream); + return -1; + } + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received F1 setup response for non existing " + "MME context\n", assoc_id); + return -1; + } + + /* The list of served gummei can contain at most 8 elements. + * LTE related gummei is the first element in the list, i.e with an id of 0. + */ + F1AP_DEBUG("servedGUMMEIs.list.count %d\n",f1SetupResponse_p->servedGUMMEIs.list.count); + DevAssert(f1SetupResponse_p->servedGUMMEIs.list.count > 0); + DevAssert(f1SetupResponse_p->servedGUMMEIs.list.count <= 8); + + + for (i = 0; i < f1SetupResponse_p->servedGUMMEIs.list.count; i++) { + struct F1ap_ServedGUMMEIsItem *gummei_item_p; + struct served_gummei_s *new_gummei_p; + int j; + + gummei_item_p = (struct F1ap_ServedGUMMEIsItem *) + f1SetupResponse_p->servedGUMMEIs.list.array[i]; + new_gummei_p = calloc(1, sizeof(struct served_gummei_s)); + + STAILQ_INIT(&new_gummei_p->served_plmns); + STAILQ_INIT(&new_gummei_p->served_group_ids); + STAILQ_INIT(&new_gummei_p->mme_codes); + + F1AP_DEBUG("servedPLMNs.list.count %d\n",gummei_item_p->servedPLMNs.list.count); + for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) { + F1ap_PLMNidentity_t *plmn_identity_p; + struct plmn_identity_s *new_plmn_identity_p; + + plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j]; + new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); + TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, + new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length); + STAILQ_INSERT_TAIL(&new_gummei_p->served_plmns, new_plmn_identity_p, next); + new_gummei_p->nb_served_plmns++; + } + + for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) { + F1ap_MME_Group_ID_t *mme_group_id_p; + struct served_group_id_s *new_group_id_p; + + mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j]; + new_group_id_p = calloc(1, sizeof(struct served_group_id_s)); + OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id); + STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next); + new_gummei_p->nb_group_id++; + } + + for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) { + F1ap_MME_Code_t *mme_code_p; + struct mme_code_s *new_mme_code_p; + + mme_code_p = gummei_item_p->servedMMECs.list.array[j]; + new_mme_code_p = calloc(1, sizeof(struct mme_code_s)); + + OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code); + STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next); + new_gummei_p->nb_mme_code++; + } + + STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); + } + + /* Free contents of the list */ + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1ap_ServedGUMMEIs, + (void *)&f1SetupResponse_p->servedGUMMEIs); + /* Set the capacity of this MME */ + mme_desc_p->relative_mme_capacity = f1SetupResponse_p->relativeMMECapacity; + + /* Optionaly set the mme name */ + if (f1SetupResponse_p->presenceMask & F1AP_F1SETUPRESPONSEIES_MMENAME_PRESENT) { + mme_desc_p->mme_name = calloc(f1SetupResponse_p->mmEname.size + 1, sizeof(char)); + memcpy(mme_desc_p->mme_name, f1SetupResponse_p->mmEname.buf, + f1SetupResponse_p->mmEname.size); + /* Convert the mme name to a printable string */ + mme_desc_p->mme_name[f1SetupResponse_p->mmEname.size] = '\0'; + } + + /* The association is now ready as eNB and MME know parameters of each other. + * Mark the association as UP to enable UE contexts creation. + */ + mme_desc_p->state = F1AP_ENB_STATE_CONNECTED; + mme_desc_p->f1ap_instance->f1ap_mme_associated_nb ++; + f1ap_handle_f1_setup_message(mme_desc_p, 0); + +#if 0 + /* We call back our self + * -> generate a dummy initial UE message + */ + { + f1ap_nas_first_req_t f1ap_nas_first_req; + + memset(&f1ap_nas_first_req, 0, sizeof(f1ap_nas_first_req_t)); + + f1ap_nas_first_req.rnti = 0xC03A; + f1ap_nas_first_req.establishment_cause = RRC_CAUSE_MO_DATA; + f1ap_nas_first_req.ue_identity.presenceMask = UE_IDENTITIES_gummei; + + f1ap_nas_first_req.ue_identity.gummei.mcc = 208; + f1ap_nas_first_req.ue_identity.gummei.mnc = 34; + f1ap_nas_first_req.ue_identity.gummei.mme_code = 0; + f1ap_nas_first_req.ue_identity.gummei.mme_group_id = 0; + + /* NAS Attach request with IMSI */ + static uint8_t nas_attach_req_imsi[] = { + 0x07, 0x41, + /* EPS Mobile identity = IMSI */ + 0x71, 0x08, 0x29, 0x80, 0x43, 0x21, 0x43, 0x65, 0x87, + 0xF9, + /* End of EPS Mobile Identity */ + 0x02, 0xE0, 0xE0, 0x00, 0x20, 0x02, 0x03, + 0xD0, 0x11, 0x27, 0x1A, 0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, + 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x83, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x0A, 0x00, 0x52, 0x12, 0xF2, + 0x01, 0x27, 0x11, + }; + + /* NAS Attach request with GUTI */ + static uint8_t nas_attach_req_guti[] = { + 0x07, 0x41, + /* EPS Mobile identity = IMSI */ + 0x71, 0x0B, 0xF6, 0x12, 0xF2, 0x01, 0x80, 0x00, 0x01, 0xE0, 0x00, + 0xDA, 0x1F, + /* End of EPS Mobile Identity */ + 0x02, 0xE0, 0xE0, 0x00, 0x20, 0x02, 0x03, + 0xD0, 0x11, 0x27, 0x1A, 0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, + 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x83, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x0A, 0x00, 0x52, 0x12, 0xF2, + 0x01, 0x27, 0x11, + }; + + f1ap_nas_first_req.nas_pdu.buffer = nas_attach_req_guti; + f1ap_nas_first_req.nas_pdu.length = sizeof(nas_attach_req_guti); + + f1ap_handle_nas_first_req(mme_desc_p->f1ap_instance->instance, + &f1ap_nas_first_req); + } +#endif + + return 0; +} + + +static +int f1ap_handle_error_indication(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *message_p) +{ + F1ap_ErrorIndicationIEs_t *f1_error_indication_p; + f1ap_mme_data_t *mme_desc_p; + + DevAssert(message_p != NULL); + + f1_error_indication_p = &message_p->msg.f1ap_ErrorIndicationIEs; + + /* F1 Setup Failure == Non UE-related procedure -> stream 0 */ + if (stream != 0) { + F1AP_WARN("[SCTP %d] Received f1 Error indication on stream != 0 (%d)\n", + assoc_id, stream); + } + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received F1 Error indication for non existing " + "MME context\n", assoc_id); + return -1; + } + if ( f1_error_indication_p->presenceMask & F1AP_ERRORINDICATIONIES_MME_UE_F1AP_ID_PRESENT) { + F1AP_WARN("Received F1 Error indication MME UE F1AP ID 0x%lx\n", f1_error_indication_p->mme_ue_f1ap_id); + } + if ( f1_error_indication_p->presenceMask & F1AP_ERRORINDICATIONIES_ENB_UE_F1AP_ID_PRESENT) { + F1AP_WARN("Received F1 Error indication eNB UE F1AP ID 0x%lx\n", f1_error_indication_p->eNB_UE_F1AP_ID); + } + + if ( f1_error_indication_p->presenceMask & F1AP_ERRORINDICATIONIES_CAUSE_PRESENT) { + switch(f1_error_indication_p->cause.present) { + case F1ap_Cause_PR_NOTHING: + F1AP_WARN("Received F1 Error indication cause NOTHING\n"); + break; + case F1ap_Cause_PR_radioNetwork: + switch (f1_error_indication_p->cause.choice.radioNetwork) { + case F1ap_CauseRadioNetwork_unspecified: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unspecified\n"); + break; + case F1ap_CauseRadioNetwork_tx2relocoverall_expiry: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_tx2relocoverall_expiry\n"); + break; + case F1ap_CauseRadioNetwork_successful_handover: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_successful_handover\n"); + break; + case F1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason\n"); + break; + case F1ap_CauseRadioNetwork_handover_cancelled: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_handover_cancelled\n"); + break; + case F1ap_CauseRadioNetwork_partial_handover: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_partial_handover\n"); + break; + case F1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system\n"); + break; + case F1ap_CauseRadioNetwork_ho_target_not_allowed: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_ho_target_not_allowed\n"); + break; + case F1ap_CauseRadioNetwork_tF1relocoverall_expiry: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_tF1relocoverall_expiry\n"); + break; + case F1ap_CauseRadioNetwork_tF1relocprep_expiry: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_tF1relocprep_expiry\n"); + break; + case F1ap_CauseRadioNetwork_cell_not_available: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_cell_not_available\n"); + break; + case F1ap_CauseRadioNetwork_unknown_targetID: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_targetID\n"); + break; + case F1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n"); + break; + case F1ap_CauseRadioNetwork_unknown_mme_ue_f1ap_id: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_mme_ue_f1ap_id\n"); + break; + case F1ap_CauseRadioNetwork_unknown_enb_ue_f1ap_id: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_enb_ue_f1ap_id\n"); + break; + case F1ap_CauseRadioNetwork_unknown_pair_ue_f1ap_id: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_pair_ue_f1ap_id\n"); + break; + case F1ap_CauseRadioNetwork_handover_desirable_for_radio_reason: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_handover_desirable_for_radio_reason\n"); + break; + case F1ap_CauseRadioNetwork_time_critical_handover: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_time_critical_handover\n"); + break; + case F1ap_CauseRadioNetwork_resource_optimisation_handover: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_resource_optimisation_handover\n"); + break; + case F1ap_CauseRadioNetwork_reduce_load_in_serving_cell: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_reduce_load_in_serving_cell\n"); + break; + case F1ap_CauseRadioNetwork_user_inactivity: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_user_inactivity\n"); + break; + case F1ap_CauseRadioNetwork_radio_connection_with_ue_lost: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_radio_connection_with_ue_lost\n"); + break; + case F1ap_CauseRadioNetwork_load_balancing_tau_required: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_load_balancing_tau_required\n"); + break; + case F1ap_CauseRadioNetwork_cs_fallback_triggered: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_cs_fallback_triggered\n"); + break; + case F1ap_CauseRadioNetwork_ue_not_available_for_ps_service: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_ue_not_available_for_ps_service\n"); + break; + case F1ap_CauseRadioNetwork_radio_resources_not_available: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_radio_resources_not_available\n"); + break; + case F1ap_CauseRadioNetwork_failure_in_radio_interface_procedure: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_failure_in_radio_interface_procedure\n"); + break; + case F1ap_CauseRadioNetwork_invalf1ap_id_qos_combination: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_invalf1ap_id_qos_combination\n"); + break; + case F1ap_CauseRadioNetwork_interrat_redirection: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_interrat_redirection\n"); + break; + case F1ap_CauseRadioNetwork_interaction_with_other_procedure: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_interaction_with_other_procedure\n"); + break; + case F1ap_CauseRadioNetwork_unknown_E_RAB_ID: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_E_RAB_ID\n"); + break; + case F1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances\n"); + break; + case F1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n"); + break; + case F1ap_CauseRadioNetwork_f1_intra_system_handover_triggered: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_f1_intra_system_handover_triggered\n"); + break; + case F1ap_CauseRadioNetwork_f1_inter_system_handover_triggered: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_f1_inter_system_handover_triggered\n"); + break; + case F1ap_CauseRadioNetwork_x2_handover_triggered: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_x2_handover_triggered\n"); + break; + case F1ap_CauseRadioNetwork_redirection_towards_1xRTT: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_redirection_towards_1xRTT\n"); + break; + case F1ap_CauseRadioNetwork_not_supported_QCI_value: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_not_supported_QCI_value\n"); + break; + case F1ap_CauseRadioNetwork_invalf1ap_id_CSG_Id: + F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_invalf1ap_id_CSG_Id\n"); + break; + default: + F1AP_WARN("Received F1 Error indication cause radio network case not handled\n"); + } + break; + + case F1ap_Cause_PR_transport: + switch (f1_error_indication_p->cause.choice.transport) { + case F1ap_CauseTransport_transport_resource_unavailable: + F1AP_WARN("Received F1 Error indication F1ap_CauseTransport_transport_resource_unavailable\n"); + break; + case F1ap_CauseTransport_unspecified: + F1AP_WARN("Received F1 Error indication F1ap_CauseTransport_unspecified\n"); + break; + default: + F1AP_WARN("Received F1 Error indication cause transport case not handled\n"); + } + break; + + case F1ap_Cause_PR_nas: + switch (f1_error_indication_p->cause.choice.nas) { + case F1ap_CauseNas_normal_release: + F1AP_WARN("Received F1 Error indication F1ap_CauseNas_normal_release\n"); + break; + case F1ap_CauseNas_authentication_failure: + F1AP_WARN("Received F1 Error indication F1ap_CauseNas_authentication_failure\n"); + break; + case F1ap_CauseNas_detach: + F1AP_WARN("Received F1 Error indication F1ap_CauseNas_detach\n"); + break; + case F1ap_CauseNas_unspecified: + F1AP_WARN("Received F1 Error indication F1ap_CauseNas_unspecified\n"); + break; + case F1ap_CauseNas_csg_subscription_expiry: + F1AP_WARN("Received F1 Error indication F1ap_CauseNas_csg_subscription_expiry\n"); + break; + default: + F1AP_WARN("Received F1 Error indication cause nas case not handled\n"); + } + break; + + case F1ap_Cause_PR_protocol: + switch (f1_error_indication_p->cause.choice.protocol) { + case F1ap_CauseProtocol_transfer_syntax_error: + F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_transfer_syntax_error\n"); + break; + case F1ap_CauseProtocol_abstract_syntax_error_reject: + F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_abstract_syntax_error_reject\n"); + break; + case F1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify: + F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify\n"); + break; + case F1ap_CauseProtocol_message_not_compatible_with_receiver_state: + F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_message_not_compatible_with_receiver_state\n"); + break; + case F1ap_CauseProtocol_semantic_error: + F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_semantic_error\n"); + break; + case F1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message: + F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message\n"); + break; + case F1ap_CauseProtocol_unspecified: + F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_unspecified\n"); + break; + default: + F1AP_WARN("Received F1 Error indication cause protocol case not handled\n"); + } + break; + + case F1ap_Cause_PR_misc: + switch (f1_error_indication_p->cause.choice.protocol) { + case F1ap_CauseMisc_control_processing_overload: + F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_control_processing_overload\n"); + break; + case F1ap_CauseMisc_not_enough_user_plane_processing_resources: + F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_not_enough_user_plane_processing_resources\n"); + break; + case F1ap_CauseMisc_hardware_failure: + F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_hardware_failure\n"); + break; + case F1ap_CauseMisc_om_intervention: + F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_om_intervention\n"); + break; + case F1ap_CauseMisc_unspecified: + F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_unspecified\n"); + break; + case F1ap_CauseMisc_unknown_PLMN: + F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_unknown_PLMN\n"); + break; + default: + F1AP_WARN("Received F1 Error indication cause misc case not handled\n"); + } + break; + } + } + if ( f1_error_indication_p->presenceMask & F1AP_ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT) { + // TODO continue + } + // TODO continue + + return 0; +} + + +static +int f1ap_handle_initial_context_request(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p) +{ + int i; + + f1ap_mme_data_t *mme_desc_p = NULL; + f1ap_ue_context_t *ue_desc_p = NULL; + MessageDef *message_p = NULL; + + F1ap_InitialContextSetupRequestIEs_t *initialContextSetupRequest_p; + DevAssert(f1ap_message_p != NULL); + + initialContextSetupRequest_p = &f1ap_message_p->msg.f1ap_InitialContextSetupRequestIEs; + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received initial context setup request for non " + "existing MME context\n", assoc_id); + return -1; + } + + if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, + initialContextSetupRequest_p->eNB_UE_F1AP_ID)) == NULL) { + F1AP_ERROR("[SCTP %d] Received initial context setup request for non " + "existing UE context 0x%06lx\n", assoc_id, + initialContextSetupRequest_p->eNB_UE_F1AP_ID); + return -1; + } + + /* Initial context request = UE-related procedure -> stream != 0 */ + if (stream == 0) { + F1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", + assoc_id, stream); + return -1; + } + + ue_desc_p->rx_stream = stream; + + ue_desc_p->mme_ue_f1ap_id = initialContextSetupRequest_p->mme_ue_f1ap_id; + + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_INITIAL_CONTEXT_SETUP_REQ); + + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; + ue_desc_p->ue_initial_id = 0; + + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).eNB_ue_f1ap_id = ue_desc_p->eNB_ue_f1ap_id; + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs = + initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.f1ap_E_RABToBeSetupItemCtxtSUReq.count; + + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul = 64;// TO DO(bitrate_t)(initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL); + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl = 1024;//(bitrate_t)(initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL); + + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.encryption_algorithms = + BIT_STRING_to_uint16(&initialContextSetupRequest_p->ueSecurityCapabilities.encryptionAlgorithms); + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = + BIT_STRING_to_uint16(&initialContextSetupRequest_p->ueSecurityCapabilities.integrityProtectionAlgorithms); + + /* Copy the security key */ + memcpy(&F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key, + initialContextSetupRequest_p->securityKey.buf, initialContextSetupRequest_p->securityKey.size); + + for (i = 0; i < initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.f1ap_E_RABToBeSetupItemCtxtSUReq.count; i++) { + F1ap_E_RABToBeSetupItemCtxtSUReq_t *item_p; + + item_p = (F1ap_E_RABToBeSetupItemCtxtSUReq_t *)initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.f1ap_E_RABToBeSetupItemCtxtSUReq.array[i]; + + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].e_rab_id = item_p->e_RAB_ID; + + if (item_p->nAS_PDU != NULL) { + /* Only copy NAS pdu if present */ + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = item_p->nAS_PDU->size; + + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = + malloc(sizeof(uint8_t) * item_p->nAS_PDU->size); + + memcpy(F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer, + item_p->nAS_PDU->buf, item_p->nAS_PDU->size); + F1AP_DEBUG("Received NAS message with the E_RAB setup procedure\n"); + } else { + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = 0; + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = NULL; + } + + /* Set the transport layer address */ + memcpy(F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.buffer, + item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.length = + item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; + + /* GTP tunnel endpoint ID */ + OCTET_STRING_TO_INT32(&item_p->gTP_TEID, F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].gtp_teid); + + /* Set the QOS informations */ + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; + + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.priority_level = + item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = + item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; + F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability = + item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; + } + + itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); + + return 0; +} + + +static +int f1ap_handle_ue_context_release_command(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p) +{ + f1ap_mme_data_t *mme_desc_p = NULL; + f1ap_ue_context_t *ue_desc_p = NULL; + MessageDef *message_p = NULL; + + F1ap_UEContextReleaseCommandIEs_t *ueContextReleaseCommand_p; + DevAssert(f1ap_message_p != NULL); + + ueContextReleaseCommand_p = &f1ap_message_p->msg.f1ap_UEContextReleaseCommandIEs; + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received UE context release command for non " + "existing MME context\n", assoc_id); + return -1; + } + + F1ap_MME_UE_F1AP_ID_t mme_ue_f1ap_id; + F1ap_ENB_UE_F1AP_ID_t enb_ue_f1ap_id; + + switch (ueContextReleaseCommand_p->uE_F1AP_IDs.present) { + case F1ap_UE_F1AP_IDs_PR_uE_F1AP_ID_pair: + enb_ue_f1ap_id = ueContextReleaseCommand_p->uE_F1AP_IDs.choice.uE_F1AP_ID_pair.eNB_UE_F1AP_ID; + mme_ue_f1ap_id = ueContextReleaseCommand_p->uE_F1AP_IDs.choice.uE_F1AP_ID_pair.mME_UE_F1AP_ID; + + MSC_LOG_RX_MESSAGE( + MSC_F1AP_ENB, + MSC_F1AP_MME, + NULL,0, + "0 UEContextRelease/%s eNB_ue_f1ap_id "F1AP_UE_ID_FMT" mme_ue_f1ap_id "F1AP_UE_ID_FMT" len %u", + f1ap_direction2String[f1ap_message_p->direction], + enb_ue_f1ap_id, + mme_ue_f1ap_id); + + if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, + enb_ue_f1ap_id)) == NULL) { + F1AP_ERROR("[SCTP %d] Received UE context release command for non " + "existing UE context 0x%06lx\n", + assoc_id, + enb_ue_f1ap_id); + /*MessageDef *msg_complete_p; + msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_COMPLETE); + F1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_f1ap_id = enb_ue_f1ap_id; + itti_send_msg_to_task(TASK_F1AP, ue_desc_p->eNB_instance->instance <=> 0, msg_complete_p); + */ + return -1; + } else { + MSC_LOG_TX_MESSAGE( + MSC_F1AP_ENB, + MSC_RRC_ENB, + NULL,0, + "0 F1AP_UE_CONTEXT_RELEASE_COMMAND/%d eNB_ue_f1ap_id "F1AP_UE_ID_FMT" ", + enb_ue_f1ap_id); + + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_UE_CONTEXT_RELEASE_COMMAND); + F1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_f1ap_id = enb_ue_f1ap_id; + itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); + return 0; + } + + break; + +//#warning "TODO mapping mme_ue_f1ap_id enb_ue_f1ap_id?" + + case F1ap_UE_F1AP_IDs_PR_mME_UE_F1AP_ID: + mme_ue_f1ap_id = ueContextReleaseCommand_p->uE_F1AP_IDs.choice.mME_UE_F1AP_ID; + F1AP_ERROR("TO DO mapping mme_ue_f1ap_id enb_ue_f1ap_id"); + (void)mme_ue_f1ap_id; /* TODO: remove - it's to remove gcc warning about unused var */ + + case F1ap_UE_F1AP_IDs_PR_NOTHING: + default: + F1AP_ERROR("F1AP_UE_CONTEXT_RELEASE_COMMAND not processed, missing info elements"); + return -1; + } +} + +static +int f1ap_handle_e_rab_setup_request(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p) { + + int i; + + f1ap_mme_data_t *mme_desc_p = NULL; + f1ap_ue_context_t *ue_desc_p = NULL; + MessageDef *message_p = NULL; + + F1ap_E_RABSetupRequestIEs_t *f1ap_E_RABSetupRequest; + DevAssert(f1ap_message_p != NULL); + + f1ap_E_RABSetupRequest = &f1ap_message_p->msg.f1ap_E_RABSetupRequestIEs; + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received initial context setup request for non " + "existing MME context\n", assoc_id); + return -1; + } + + + if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, + f1ap_E_RABSetupRequest->eNB_UE_F1AP_ID)) == NULL) { + F1AP_ERROR("[SCTP %d] Received initial context setup request for non " + "existing UE context 0x%06lx\n", assoc_id, + f1ap_E_RABSetupRequest->eNB_UE_F1AP_ID); + return -1; + } + + /* Initial context request = UE-related procedure -> stream != 0 */ + if (stream == 0) { + F1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", + assoc_id, stream); + return -1; + } + + ue_desc_p->rx_stream = stream; + + if ( ue_desc_p->mme_ue_f1ap_id != f1ap_E_RABSetupRequest->mme_ue_f1ap_id){ + F1AP_WARN("UE context mme_ue_f1ap_id is different form that of the message (%d != %ld)", + ue_desc_p->mme_ue_f1ap_id, f1ap_E_RABSetupRequest->mme_ue_f1ap_id); + + } + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_E_RAB_SETUP_REQ); + + F1AP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; + + F1AP_E_RAB_SETUP_REQ(message_p).mme_ue_f1ap_id = f1ap_E_RABSetupRequest->mme_ue_f1ap_id; + F1AP_E_RAB_SETUP_REQ(message_p).eNB_ue_f1ap_id = f1ap_E_RABSetupRequest->eNB_UE_F1AP_ID; + + F1AP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup = + f1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.f1ap_E_RABToBeSetupItemBearerSUReq.count; + + for (i = 0; i < f1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.f1ap_E_RABToBeSetupItemBearerSUReq.count; i++) { + F1ap_E_RABToBeSetupItemBearerSUReq_t *item_p; + + item_p = (F1ap_E_RABToBeSetupItemBearerSUReq_t *)f1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.f1ap_E_RABToBeSetupItemBearerSUReq.array[i]; + + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].e_rab_id = item_p->e_RAB_ID; + + // check for the NAS PDU + if (item_p->nAS_PDU.size > 0 ) { + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size; + + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); + + memcpy(F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer, + item_p->nAS_PDU.buf, item_p->nAS_PDU.size); + // F1AP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]); + } else { + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = 0; + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = NULL; + + F1AP_WARN("NAS PDU is not provided, generate a E_RAB_SETUP Failure (TBD) back to MME \n"); + // return -1; + } + + /* Set the transport layer address */ + memcpy(F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, + item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length = + item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; + + /* F1AP_INFO("sgw addr %s len: %d (size %d, index %d)\n", + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length, + item_p->transportLayerAddress.size, i); + */ + /* GTP tunnel endpoint ID */ + OCTET_STRING_TO_INT32(&item_p->gTP_TEID, F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].gtp_teid); + + /* Set the QOS informations */ + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; + + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.priority_level = + item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_capability = + item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; + F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = + item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; + } + + itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); + + return 0; +} + +static +int f1ap_handle_paging(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p) +{ + F1ap_PagingIEs_t *paging_p; + f1ap_mme_data_t *mme_desc_p = NULL; + f1ap_instance_t *f1ap_instance = NULL; + MessageDef *message_p = NULL; + + DevAssert(f1ap_message_p != NULL); + // received Paging Message from MME + F1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id); + + paging_p = &f1ap_message_p->msg.f1ap_PagingIEs; + + /* Paging procedure -> stream != 0 */ + if (stream == 0) { + F1AP_ERROR("[SCTP %d] Received Paging procedure on stream (%d)\n", + assoc_id, stream); + return -1; + } + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received Paging for non " + "existing MME context\n", assoc_id); + return -1; + } + + f1ap_instance = mme_desc_p->f1ap_instance; + if (f1ap_instance == NULL) { + F1AP_ERROR("[SCTP %d] Received Paging for non existing MME context : f1ap_instance is NULL\n", + assoc_id); + return -1; + } + + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_PAGING_IND); + + /* convert F1ap_PagingIEs_t to f1ap_paging_ind_t */ + /* convert UE Identity Index value */ + F1AP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&paging_p->ueIdentityIndexValue); + F1AP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n", + assoc_id,(uint32_t)F1AP_PAGING_IND(message_p).ue_index_value); + + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0; + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0; + + /* convert UE Paging Identity */ + if (paging_p->uePagingID.present == F1ap_UEPagingID_PR_s_TMSI) { + F1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi; + OCTET_STRING_TO_INT8(&paging_p->uePagingID.choice.s_TMSI.mMEC, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code); + OCTET_STRING_TO_INT32(&paging_p->uePagingID.choice.s_TMSI.m_TMSI, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi); + } else if (paging_p->uePagingID.present == F1ap_UEPagingID_PR_iMSI) { + F1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_imsi; + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length = 0; + for (int i = 0; i < paging_p->uePagingID.choice.iMSI.size; i++) { + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i] = (uint8_t)(paging_p->uePagingID.choice.iMSI.buf[i] & 0x0F ); + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++; + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] = (uint8_t)((paging_p->uePagingID.choice.iMSI.buf[i]>>4) & 0x0F); + LOG_D(F1AP,"paging : i %d %d imsi %d %d \n",2*i,2*i+1,F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i], F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1]); + if (F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] == 0x0F) { + if(i != paging_p->uePagingID.choice.iMSI.size - 1){ + /* invalid paging_p->uePagingID.choise.iMSI.buffer */ + F1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI error(i %d 0x0F)\n", assoc_id,i); + return -1; + } + } else { + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++; + } + } + if (F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length >= F1AP_IMSI_LENGTH) { + /* invalid paging_p->uePagingID.choise.iMSI.size */ + F1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI.size(%d) is over IMSI length(%d)\n", assoc_id, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, F1AP_IMSI_LENGTH); + return -1; + } +} else { + /* invalid paging_p->uePagingID.present */ + F1AP_ERROR("[SCTP %d] Received Paging : uePagingID.present(%d) is unknown\n", assoc_id, paging_p->uePagingID.present); + return -1; + } + +#if 0 + /* convert Paging DRX(optional) */ + if (paging_p->presenceMask & F1AP_PAGINGIES_PAGINGDRX_PRESENT) { + switch(paging_p->pagingDRX) { + case F1ap_PagingDRX_v32: + F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_32; + break; + case F1ap_PagingDRX_v64: + F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_64; + break; + case F1ap_PagingDRX_v128: + F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_128; + break; + case F1ap_PagingDRX_v256: + F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; + break; + default: + // when UE Paging DRX is no value + F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; + break; + } + } +#endif + F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; + + /* convert cnDomain */ + if (paging_p->cnDomain == F1ap_CNDomain_ps) { + F1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_PS; + } else if (paging_p->cnDomain == F1ap_CNDomain_cs) { + F1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_CS; + } else { + /* invalid paging_p->cnDomain */ + F1AP_ERROR("[SCTP %d] Received Paging : cnDomain(%ld) is unknown\n", assoc_id, paging_p->cnDomain); + return -1; + } + + memset (&F1AP_PAGING_IND(message_p).plmn_identity[0], 0, sizeof(plmn_identity_t)*256); + memset (&F1AP_PAGING_IND(message_p).tac[0], 0, sizeof(int16_t)*256); + F1AP_PAGING_IND(message_p).tai_size = 0; + + for (int i = 0; i < paging_p->taiList.f1ap_TAIItem.count; i++) { + F1AP_INFO("[SCTP %d] Received Paging taiList: i %d, count %d\n", assoc_id, i, paging_p->taiList.f1ap_TAIItem.count); + F1ap_TAIItem_t f1ap_TAIItem; + memset (&f1ap_TAIItem, 0, sizeof(F1ap_TAIItem_t)); + + memcpy(&f1ap_TAIItem, paging_p->taiList.f1ap_TAIItem.array[i], sizeof(F1ap_TAIItem_t)); + + TBCD_TO_MCC_MNC(&f1ap_TAIItem.tAI.pLMNidentity, F1AP_PAGING_IND(message_p).plmn_identity[i].mcc, + F1AP_PAGING_IND(message_p).plmn_identity[i].mnc, + F1AP_PAGING_IND(message_p).plmn_identity[i].mnc_digit_length); + OCTET_STRING_TO_INT16(&f1ap_TAIItem.tAI.tAC, F1AP_PAGING_IND(message_p).tac[i]); + F1AP_PAGING_IND(message_p).tai_size++; + F1AP_DEBUG("[SCTP %d] Received Paging: MCC %d, MNC %d, TAC %d\n", assoc_id, F1AP_PAGING_IND(message_p).plmn_identity[i].mcc, F1AP_PAGING_IND(message_p).plmn_identity[i].mnc, F1AP_PAGING_IND(message_p).tac[i]); + } + +#if 0 + // CSG Id(optional) List is not used + if (paging_p->presenceMask & F1AP_PAGINGIES_CSG_IDLIST_PRESENT) { + // TODO + } + + /* convert pagingPriority (optional) if has value */ + if (paging_p->presenceMask & F1AP_PAGINGIES_PAGINGPRIORITY_PRESENT) { + switch(paging_p->pagingPriority) { + case F1ap_PagingPriority_priolevel1: + F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL1; + break; + case F1ap_PagingPriority_priolevel2: + F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL2; + break; + case F1ap_PagingPriority_priolevel3: + F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL3; + break; + case F1ap_PagingPriority_priolevel4: + F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL4; + break; + case F1ap_PagingPriority_priolevel5: + F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL5; + break; + case F1ap_PagingPriority_priolevel6: + F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL6; + break; + case F1ap_PagingPriority_priolevel7: + F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL7; + break; + case F1ap_PagingPriority_priolevel8: + F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL8; + break; + default: + /* invalid paging_p->pagingPriority */ + F1AP_ERROR("[SCTP %d] Received paging : pagingPriority(%ld) is invalid\n", assoc_id, paging_p->pagingPriority); + return -1; + } + } +#endif + //paging parameter values + F1AP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d cn_domain %d paging_drx %d paging_priority %d\n",assoc_id, + F1AP_PAGING_IND(message_p).ue_index_value, F1AP_PAGING_IND(message_p).cn_domain, + F1AP_PAGING_IND(message_p).paging_drx, F1AP_PAGING_IND(message_p).paging_priority); + F1AP_DEBUG("[SCTP %d] Received Paging parameters(ue): presenceMask %d s_tmsi.m_tmsi %d s_tmsi.mme_code %d IMSI length %d (0-5) %d%d%d%d%d%d\n",assoc_id, + F1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi, + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1], + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3], + F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]); + + /* send message to RRC */ + itti_send_msg_to_task(TASK_RRC_ENB, f1ap_instance->instance, message_p); + + return 0; +} + +static +int f1ap_handle_e_rab_modify_request(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p) { + + int i; + + f1ap_mme_data_t *mme_desc_p = NULL; + f1ap_ue_context_t *ue_desc_p = NULL; + MessageDef *message_p = NULL; + int nb_of_e_rabs_failed = 0; + + F1ap_E_RABModifyRequestIEs_t *f1ap_E_RABModifyRequest; + DevAssert(f1ap_message_p != NULL); + + f1ap_E_RABModifyRequest = &f1ap_message_p->msg.f1ap_E_RABModifyRequestIEs; + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received E-RAB modify request for non " + "existing MME context\n", assoc_id); + return -1; + } + + + if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, + f1ap_E_RABModifyRequest->eNB_UE_F1AP_ID)) == NULL) { + F1AP_ERROR("[SCTP %d] Received E-RAB modify request for non " + "existing UE context 0x%06lx\n", assoc_id, + f1ap_E_RABModifyRequest->eNB_UE_F1AP_ID); + return -1; + } + + /* E-RAB modify request = UE-related procedure -> stream != 0 */ + if (stream == 0) { + F1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", + assoc_id, stream); + return -1; + } + + ue_desc_p->rx_stream = stream; + + if ( ue_desc_p->mme_ue_f1ap_id != f1ap_E_RABModifyRequest->mme_ue_f1ap_id){ + F1AP_WARN("UE context mme_ue_f1ap_id is different form that of the message (%d != %ld)", + ue_desc_p->mme_ue_f1ap_id, f1ap_E_RABModifyRequest->mme_ue_f1ap_id); + message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_E_RAB_MODIFY_RESP); + + F1AP_E_RAB_MODIFY_RESP (message_p).eNB_ue_f1ap_id = f1ap_E_RABModifyRequest->eNB_UE_F1AP_ID; +// F1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[F1AP_MAX_E_RAB]; + F1AP_E_RAB_MODIFY_RESP (message_p).nb_of_e_rabs = 0; + + for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.count; nb_of_e_rabs_failed++) { + F1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = + ((F1ap_E_RABToBeModifiedItemBearerModReq_t *)f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.array[nb_of_e_rabs_failed])->e_RAB_ID; + F1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = 13;//F1ap_CauseRadioNetwork_unknown_mme_ue_f1ap_id; + } + F1AP_E_RAB_MODIFY_RESP (message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; + + f1ap_e_rab_modify_resp(mme_desc_p->f1ap_instance->instance, + &F1AP_E_RAB_MODIFY_RESP(message_p)); + + message_p = NULL; + return -1; + } + + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_E_RAB_MODIFY_REQ); + + F1AP_E_RAB_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; + + F1AP_E_RAB_MODIFY_REQ(message_p).mme_ue_f1ap_id = f1ap_E_RABModifyRequest->mme_ue_f1ap_id; + F1AP_E_RAB_MODIFY_REQ(message_p).eNB_ue_f1ap_id = f1ap_E_RABModifyRequest->eNB_UE_F1AP_ID; + + F1AP_E_RAB_MODIFY_REQ(message_p).nb_e_rabs_tomodify = + f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.count; + + for (i = 0; i < f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.count; i++) { + F1ap_E_RABToBeModifiedItemBearerModReq_t *item_p; + + item_p = (F1ap_E_RABToBeModifiedItemBearerModReq_t *)f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.array[i]; + + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].e_rab_id = item_p->e_RAB_ID; + + // check for the NAS PDU + if (item_p->nAS_PDU.size > 0 ) { + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size; + + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); + + memcpy(F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer, + item_p->nAS_PDU.buf, item_p->nAS_PDU.size); + } else { + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = 0; + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = NULL; + continue; + } + + /* Set the QOS informations */ + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI; + + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.priority_level = + item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel; + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_capability = + item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; + F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = + item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; + + } + + itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); + + return 0; +} +// handle e-rab release command and send it to rrc_end +static +int f1ap_handle_e_rab_release_command(uint32_t assoc_id, + uint32_t stream, + struct f1ap_message_s *f1ap_message_p) { + + int i; + + f1ap_mme_data_t *mme_desc_p = NULL; + f1ap_ue_context_t *ue_desc_p = NULL; + MessageDef *message_p = NULL; + + F1ap_E_RABReleaseCommandIEs_t *f1ap_E_RABReleaseCommand; + DevAssert(f1ap_message_p != NULL); + f1ap_E_RABReleaseCommand = &f1ap_message_p->msg.f1ap_E_RABReleaseCommandIEs; + + if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { + F1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing MME context\n", assoc_id); + return -1; + } + if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, + f1ap_E_RABReleaseCommand->eNB_UE_F1AP_ID)) == NULL) { + F1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id, + f1ap_E_RABReleaseCommand->eNB_UE_F1AP_ID); + return -1; + } + + /* Initial context request = UE-related procedure -> stream != 0 */ + if (stream == 0) { + F1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", + assoc_id, stream); + return -1; + } + + ue_desc_p->rx_stream = stream; + + if ( ue_desc_p->mme_ue_f1ap_id != f1ap_E_RABReleaseCommand->mme_ue_f1ap_id){ + F1AP_WARN("UE context mme_ue_f1ap_id is different form that of the message (%d != %ld)", + ue_desc_p->mme_ue_f1ap_id, f1ap_E_RABReleaseCommand->mme_ue_f1ap_id); + } + + F1AP_DEBUG("[SCTP %d] Received E-RAB release command for eNB_UE_F1AP_ID %ld mme_ue_f1ap_id %ld\n", + assoc_id, f1ap_E_RABReleaseCommand->eNB_UE_F1AP_ID, f1ap_E_RABReleaseCommand->mme_ue_f1ap_id); + + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_E_RAB_RELEASE_COMMAND); + + F1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_f1ap_id = f1ap_E_RABReleaseCommand->eNB_UE_F1AP_ID; + F1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_f1ap_id = f1ap_E_RABReleaseCommand->mme_ue_f1ap_id; + if(f1ap_E_RABReleaseCommand->nas_pdu.size > 0 ){ + F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = f1ap_E_RABReleaseCommand->nas_pdu.size; + + F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = + malloc(sizeof(uint8_t) * f1ap_E_RABReleaseCommand->nas_pdu.size); + + memcpy(F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer, + f1ap_E_RABReleaseCommand->nas_pdu.buf, + f1ap_E_RABReleaseCommand->nas_pdu.size); + } else { + F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0; + F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL; + } + + F1AP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = f1ap_E_RABReleaseCommand->e_RABToBeReleasedList.f1ap_E_RABItem.count; + for(i=0; i < f1ap_E_RABReleaseCommand->e_RABToBeReleasedList.f1ap_E_RABItem.count; i++){ + F1ap_E_RABItem_t *item_p; + item_p = (F1ap_E_RABItem_t*)f1ap_E_RABReleaseCommand->e_RABToBeReleasedList.f1ap_E_RABItem.array[i]; + F1AP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID; + F1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); + } + + itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); + + return 0; +} diff --git a/openair2/F1AP/f1ap_handlers.h b/openair2/F1AP/f1ap_handlers.h new file mode 100644 index 0000000000..eaa2b15c31 --- /dev/null +++ b/openair2/F1AP/f1ap_handlers.h @@ -0,0 +1,41 @@ +/* + * 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 f1ap_handlers.h + * \brief f1ap messages handlers + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#ifndef F1AP_HANDLERS_H_ +#define F1AP_HANDLERS_H_ + +void f1ap_handle_f1_setup_message(f1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown); + +int f1ap_handle_message(uint32_t assoc_id, int32_t stream, + const uint8_t * const data, const uint32_t data_length); + +#endif /* F1AP_HANDLERS_H_ */ diff --git a/openair2/F1AP/f1ap_messaging.c b/openair2/F1AP/f1ap_messaging.c new file mode 100644 index 0000000000..1be0ee9829 --- /dev/null +++ b/openair2/F1AP/f1ap_messaging.c @@ -0,0 +1,88 @@ +/* + * 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 f1ap_messaging.c + * \brief f1ap procedures + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + + +#include "intertask_interface.h" + +#include "f1ap_messaging.h" + +void f1ap_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_F1AP, 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 f1ap_send_nas_downlink_ind(instance_t instance, + uint16_t ue_initial_id, + uint32_t eNB_ue_s1ap_id, + uint8_t *nas_pdu, + uint32_t nas_pdu_length) +{ + MessageDef *message_p; + f1ap_downlink_nas_t *f1ap_downlink_nas; + + message_p = itti_alloc_new_message(TASK_F1AP, F1AP_DOWNLINK_NAS); + + f1ap_downlink_nas = &message_p->ittiMsg.f1ap_downlink_nas; + + f1ap_downlink_nas->ue_initial_id = ue_initial_id; + f1ap_downlink_nas->eNB_ue_s1ap_id = eNB_ue_f1ap_id; + f1ap_downlink_nas->nas_pdu.buffer = nas_pdu; + f1ap_downlink_nas->nas_pdu.length = nas_pdu_length; + + itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); +} + +void f1ap_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_F1AP, 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); +} + diff --git a/openair2/F1AP/f1ap_messaging.h b/openair2/F1AP/f1ap_messaging.h new file mode 100644 index 0000000000..8d224ab75b --- /dev/null +++ b/openair2/F1AP/f1ap_messaging.h @@ -0,0 +1,50 @@ +/* + * 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 f1ap_messaging.h + * \brief f1ap procedures + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + + +#ifndef F1AP_MESSAGING_H_ +#define F1AP_MESSAGING_H_ + +void f1ap_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, + uint32_t buffer_length, uint16_t stream); + +void f1ap_send_nas_downlink_ind(instance_t instance, + uint16_t ue_initial_id, + uint32_t eNB_ue_f1ap_id, + uint8_t *nas_pdu, + uint32_t nas_pdu_length); + +void f1ap_send_sctp_close_association(instance_t instance, + int32_t assoc_id); + + +#endif /* F1AP_MESSAGING_H_ */ diff --git a/openair2/F1AP/sctp_cu.c b/openair2/F1AP/sctp_cu.c new file mode 100644 index 0000000000..546759e003 --- /dev/null +++ b/openair2/F1AP/sctp_cu.c @@ -0,0 +1,123 @@ +/* + * 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 sctp_server.c + * \brief sctp server procedures for f1ap + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ +#include <stdio.h> +#include <string.h> +#include <time.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <netinet/sctp.h> +#include <arpa/inet.h> +#include <pthread.h> +#include <unistd.h> // for close +#include <stdlib.h> + +#define MAX_BUFFER 1024 + +/* server */ + +int sfd, cfd, len, flags; +struct sctp_sndrcvinfo sndrcvinfo; +struct sockaddr_in saddr, caddr; +struct sctp_initmsg initmsg; +uint8_t buff[INET_ADDRSTRLEN]; + +void send_func(int cfd) { + uint8_t buffer_send[MAX_BUFFER+1]; + /* Changing 9th character the character after # in the message buffer */ + buffer_send[0] = rand(); + sctp_sendmsg( cfd, (void *)buffer_send, (size_t)strlen(buffer_send), + NULL, 0, htons(62), 0, 1 /* stream */, 0, 0 ); + printf("S - Sent: %s\n", buffer_send); +} + +void *recv_func(void *cfd) { + int ret; + uint8_t buffer_recv[MAX_BUFFER+1]; + + //recv message + bzero( (void *)&buffer_recv, sizeof(buffer_recv) ); + while(ret = sctp_recvmsg( *(int*)cfd, (void *)buffer_recv, sizeof(buffer_recv), + (struct sockaddr *)NULL, 0, &sndrcvinfo, &flags )) { + //send_func(*(int*)cfd); + //printf("S - cfd = %d\n", *(int*)cfd); + printf("S - Received following data on ppid %d, data is: %x\n", + sndrcvinfo.sinfo_ppid, buffer_recv); + printf("S - Received following data on stream %d, data is: \n", sndrcvinfo.sinfo_stream); + + int i_ret; + for (i_ret = 0; i_ret < sizeof(buffer_recv); i_ret++) { + printf("%x ", *(buffer_recv+i_ret)); + } + + printf("\n"); + + f1ap_decode_pdu(NULL , buffer_recv, sizeof(buffer_recv)); + } + printf("ret = %d\n", ret); + close( *(int*)cfd ); +} + +int sctp_cu_init() { + pthread_t threads; + printf("S - Waiting for socket_accept\n"); + + sfd = socket( AF_INET, SOCK_STREAM, IPPROTO_SCTP ); + bzero( (void *)&saddr, sizeof(saddr) ); + saddr.sin_family = AF_INET; + saddr.sin_addr.s_addr = htonl( INADDR_ANY ); + saddr.sin_port = htons(29008); + + bind( sfd, (struct sockaddr *)&saddr, sizeof(saddr) ); + + /* Maximum of 3 streams will be available per socket */ + memset( &initmsg, 0, sizeof(initmsg) ); + initmsg.sinit_num_ostreams = 3; + initmsg.sinit_max_instreams = 3; + initmsg.sinit_max_attempts = 2; + setsockopt( sfd, IPPROTO_SCTP, SCTP_INITMSG, + &initmsg, sizeof(initmsg) ); + + listen( sfd, 5 ); + + while(cfd=accept(sfd, (struct sockaddr *)&caddr, (socklen_t*)&caddr)) { + printf("-------- S - Connected to %s\n", + inet_ntop(AF_INET, &caddr.sin_addr, buff, + sizeof(buff))); + int *thread_args = malloc(sizeof(int)); + *thread_args = cfd; + pthread_create(&threads, NULL, recv_func, thread_args); + } + + printf("S - close\n"); + return 0; +} \ No newline at end of file diff --git a/openair2/F1AP/sctp_du.c b/openair2/F1AP/sctp_du.c new file mode 100644 index 0000000000..3520f4691b --- /dev/null +++ b/openair2/F1AP/sctp_du.c @@ -0,0 +1,139 @@ +/* + * 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 sctp_client.c + * \brief sctp client procedures for f1ap + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ +#include <stdio.h> +#include <string.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <netinet/sctp.h> +#include <pthread.h> +#include <arpa/inet.h> +#include <unistd.h> // for close +#include <stdlib.h> + +#define MAX_BUFFER 1024 +#define NUM_THREADS 1 + +int cfd, i, flags, ret; +struct sockaddr_in saddr; +struct sctp_sndrcvinfo sndrcvinfo; +struct sctp_event_subscribe events; +struct sctp_initmsg initmsg; +uint8_t buffer_send[MAX_BUFFER+1]; +uint8_t buffer_recv[MAX_BUFFER+1]; + +void f1ap_du_send_message(uint8_t *buffer_send, uint32_t length) +{ + /* Changing 9th character the character after # in the message buffer */ + //while (1) { + //buffer_send[0] = rand(); + sctp_sendmsg( cfd, (void *)buffer_send, length, + NULL, 0, htonl(62), 0, 1 /* stream */, 0, 0 ); + printf("C - Sent: "); + + int i_ret; + for (i_ret = 0; i_ret < length; i_ret++) { + printf("%x ", *(buffer_send+i_ret)); + } + + printf("\n"); + //} +} + +/* for test*/ +void *send_func(void *argument) +{ + /* Changing 9th character the character after # in the message buffer */ + while (1) { + buffer_send[0] = rand(); + sctp_sendmsg( cfd, (void *)buffer_send, (size_t)strlen(buffer_send), + NULL, 0, 0, 0, 1 /* stream */, 0, 0 ); + printf("C - Sent: %s\n", buffer_send); + } +} + +void *recv_func(void *argument) +{ + bzero( (void *)&buffer_recv, sizeof(buffer_recv) ); + + while(ret = sctp_recvmsg( cfd, (void *)buffer_recv, sizeof(buffer_recv), + (struct sockaddr *)NULL, 0, &sndrcvinfo, &flags )) { + + printf("C - Received following data on stream %d, data is: %s\n", + sndrcvinfo.sinfo_stream, buffer_recv); + } + close(cfd); + printf("C - close\n"); +} + +int sctp_du_init() +{ + pthread_t threads[NUM_THREADS]; + + char *ipadd; + ipadd = "127.0.0.1"; + printf("Use default ipaddress %s \n", ipadd); + + cfd = socket( AF_INET, SOCK_STREAM, IPPROTO_SCTP ); + + /* Specify that a maximum of 3 streams will be available per socket */ + memset( &initmsg, 0, sizeof(initmsg) ); + initmsg.sinit_num_ostreams = 3; + initmsg.sinit_max_instreams = 3; + initmsg.sinit_max_attempts = 2; + setsockopt( cfd, IPPROTO_SCTP, SCTP_INITMSG, + &initmsg, sizeof(initmsg) ); + + bzero( (void *)&saddr, sizeof(saddr) ); + saddr.sin_family = AF_INET; + inet_pton(AF_INET, ipadd, &saddr.sin_addr); + saddr.sin_port = htons(29008); + + int ret; + ret = connect( cfd, (struct sockaddr *)&saddr, sizeof(saddr) ); + if (ret == -1) { + printf("C - Not founded Server, close\n"); + return 0; + } + memset( (void *)&events, 0, sizeof(events) ); + events.sctp_data_io_event = 1; + setsockopt( cfd, SOL_SCTP, SCTP_EVENTS, + (const void *)&events, sizeof(events) ); + + /* Sending three messages on different streams */ + // send message + //pthread_create(&threads[0], NULL, send_func, (void *)0); + + pthread_create(&threads[0], NULL, recv_func, (void *)0); + + return 0; +} \ No newline at end of file diff --git a/openair2/F1AP/test_f1ap_cu.c b/openair2/F1AP/test_f1ap_cu.c new file mode 100644 index 0000000000..544d787cf8 --- /dev/null +++ b/openair2/F1AP/test_f1ap_cu.c @@ -0,0 +1,11 @@ + +/* Test */ +void CU_handle_F1_SETUP_REQUEST(void); +/**/ + +int main(void) { + /* Test */ + F1AP_CU_task(); + //CU_handle_F1_SETUP_REQUEST(); + return 0; +} diff --git a/openair2/F1AP/test_f1ap_du.c b/openair2/F1AP/test_f1ap_du.c new file mode 100644 index 0000000000..78ae552a88 --- /dev/null +++ b/openair2/F1AP/test_f1ap_du.c @@ -0,0 +1,5 @@ + +int main(void) { + F1AP_DU_task(); + return 0; +} diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index 00287341b2..abfe20c418 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -251,6 +251,37 @@ do { \ + pLMN.MNCdigit2 * 10 + pLMN.MNCdigit1; \ } while(0) + +/* TS 38.473 v15.1.1 section 9.3.2.1: + * NR CELL ID + */ +#define TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(mACRO, bITsTRING) \ +do { \ + (bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \ + (bITsTRING)->buf[0] = (mACRO) >> 28; \ + (bITsTRING)->buf[1] = (mACRO) >> 20; \ + (bITsTRING)->buf[2] = (mACRO) >> 12; \ + (bITsTRING)->buf[3] = (mACRO) >> 4; \ + (bITsTRING)->buf[4] = ((mACRO) & 0x0f) << 4; \ + (bITsTRING)->size = 5; \ + (bITsTRING)->bits_unused = 4; \ +} while(0) + +/* TS 38.473 v15.1.1 section 9.3.1.12: + * NR CELL ID + */ +#define NR_CELL_ID_TO_BIT_STRING(mACRO, bITsTRING) \ +do { \ + (bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \ + (bITsTRING)->buf[0] = (mACRO) >> 28; \ + (bITsTRING)->buf[1] = (mACRO) >> 20; \ + (bITsTRING)->buf[2] = (mACRO) >> 12; \ + (bITsTRING)->buf[3] = (mACRO) >> 4; \ + (bITsTRING)->buf[4] = ((mACRO) & 0x0f) << 4; \ + (bITsTRING)->size = 5; \ + (bITsTRING)->bits_unused = 4; \ +} while(0) + /* TS 36.413 v10.9.0 section 9.2.1.37: * Macro eNB ID: * Equal to the 20 leftmost bits of the Cell -- GitLab From a817b54c74b20b7cf7d40657502102d862bf4d92 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 28 Aug 2018 17:01:17 +0200 Subject: [PATCH 018/308] T: generate for PROTO_AGENT and F1U --- common/utils/T/T_IDs.h | 546 ---------------------------------- common/utils/T/T_messages.txt | 22 ++ 2 files changed, 22 insertions(+), 546 deletions(-) delete mode 100644 common/utils/T/T_IDs.h diff --git a/common/utils/T/T_IDs.h b/common/utils/T/T_IDs.h deleted file mode 100644 index 58b4307518..0000000000 --- a/common/utils/T/T_IDs.h +++ /dev/null @@ -1,546 +0,0 @@ -/* generated file, do not edit by hand */ - -#define T_ENB_MASTER_TICK T_ID(0) -#define T_ENB_PHY_UL_TICK T_ID(1) -#define T_ENB_PHY_DL_TICK T_ID(2) -#define T_ENB_PHY_DLSCH_UE_DCI T_ID(3) -#define T_ENB_PHY_DLSCH_UE_ACK T_ID(4) -#define T_ENB_PHY_DLSCH_UE_NACK T_ID(5) -#define T_ENB_PHY_ULSCH_UE_DCI T_ID(6) -#define T_ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION T_ID(7) -#define T_ENB_PHY_ULSCH_UE_ACK T_ID(8) -#define T_ENB_PHY_ULSCH_UE_NACK T_ID(9) -#define T_ENB_PHY_INPUT_SIGNAL T_ID(10) -#define T_ENB_PHY_OUTPUT_SIGNAL T_ID(11) -#define T_ENB_PHY_UL_CHANNEL_ESTIMATE T_ID(12) -#define T_ENB_PHY_PUSCH_IQ T_ID(13) -#define T_ENB_PHY_PUCCH_1AB_IQ T_ID(14) -#define T_ENB_PHY_PUCCH_1_ENERGY T_ID(15) -#define T_ENB_PHY_PHICH T_ID(16) -#define T_ENB_PHY_MSG3_ALLOCATION T_ID(17) -#define T_ENB_PHY_INITIATE_RA_PROCEDURE T_ID(18) -#define T_ENB_MAC_UE_DL_SDU T_ID(19) -#define T_ENB_MAC_UE_UL_SCHEDULE T_ID(20) -#define T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION T_ID(21) -#define T_ENB_MAC_UE_UL_PDU T_ID(22) -#define T_ENB_MAC_UE_UL_PDU_WITH_DATA T_ID(23) -#define T_ENB_MAC_UE_UL_SDU T_ID(24) -#define T_ENB_MAC_UE_UL_SDU_WITH_DATA T_ID(25) -#define T_ENB_MAC_UE_UL_CE T_ID(26) -#define T_ENB_MAC_UE_DL_PDU_WITH_DATA T_ID(27) -#define T_ENB_MAC_SCHEDULING_REQUEST T_ID(28) -#define T_ENB_RLC_DL T_ID(29) -#define T_ENB_RLC_UL T_ID(30) -#define T_ENB_RLC_MAC_DL T_ID(31) -#define T_ENB_RLC_MAC_UL T_ID(32) -#define T_ENB_PDCP_UL T_ID(33) -#define T_ENB_PDCP_DL T_ID(34) -#define T_ENB_RRC_CONNECTION_SETUP_COMPLETE T_ID(35) -#define T_ENB_RRC_SECURITY_MODE_COMMAND T_ID(36) -#define T_ENB_RRC_SECURITY_MODE_COMPLETE T_ID(37) -#define T_ENB_RRC_SECURITY_MODE_FAILURE T_ID(38) -#define T_ENB_RRC_UE_CAPABILITY_ENQUIRY T_ID(39) -#define T_ENB_RRC_UE_CAPABILITY_INFORMATION T_ID(40) -#define T_ENB_RRC_CONNECTION_REQUEST T_ID(41) -#define T_ENB_RRC_CONNECTION_REJECT T_ID(42) -#define T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST T_ID(43) -#define T_ENB_RRC_CONNECTION_REESTABLISHMENT T_ID(44) -#define T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE T_ID(45) -#define T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT T_ID(46) -#define T_ENB_RRC_CONNECTION_RELEASE T_ID(47) -#define T_ENB_RRC_CONNECTION_RECONFIGURATION T_ID(48) -#define T_ENB_RRC_MEASUREMENT_REPORT T_ID(49) -#define T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION T_ID(50) -#define T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE T_ID(51) -#define T_ENB_RRC_CONNECTION_SETUP T_ID(52) -#define T_ENB_RRC_UL_CCCH_DATA_IN T_ID(53) -#define T_ENB_RRC_UL_DCCH_DATA_IN T_ID(54) -#define T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER T_ID(55) -#define T_ENB_RRC_UL_INFORMATION_TRANSFER T_ID(56) -#define T_ENB_RRC_COUNTER_CHECK_RESPONSE T_ID(57) -#define T_ENB_RRC_UE_INFORMATION_RESPONSE_R9 T_ID(58) -#define T_ENB_RRC_PROXIMITY_INDICATION_R9 T_ID(59) -#define T_ENB_RRC_RECONFIGURATION_COMPLETE_R10 T_ID(60) -#define T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10 T_ID(61) -#define T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION T_ID(62) -#define T_ENB_RRC_UNKNOW_MESSAGE T_ID(63) -#define T_LEGACY_MAC_INFO T_ID(64) -#define T_LEGACY_MAC_ERROR T_ID(65) -#define T_LEGACY_MAC_WARNING T_ID(66) -#define T_LEGACY_MAC_DEBUG T_ID(67) -#define T_LEGACY_MAC_TRACE T_ID(68) -#define T_LEGACY_PHY_INFO T_ID(69) -#define T_LEGACY_PHY_ERROR T_ID(70) -#define T_LEGACY_PHY_WARNING T_ID(71) -#define T_LEGACY_PHY_DEBUG T_ID(72) -#define T_LEGACY_PHY_TRACE T_ID(73) -#define T_LEGACY_S1AP_INFO T_ID(74) -#define T_LEGACY_S1AP_ERROR T_ID(75) -#define T_LEGACY_S1AP_WARNING T_ID(76) -#define T_LEGACY_S1AP_DEBUG T_ID(77) -#define T_LEGACY_S1AP_TRACE T_ID(78) -#define T_LEGACY_X2AP_INFO T_ID(79) -#define T_LEGACY_X2AP_ERROR T_ID(80) -#define T_LEGACY_X2AP_WARNING T_ID(81) -#define T_LEGACY_X2AP_DEBUG T_ID(82) -#define T_LEGACY_X2AP_TRACE T_ID(83) -#define T_LEGACY_RRC_INFO T_ID(84) -#define T_LEGACY_RRC_ERROR T_ID(85) -#define T_LEGACY_RRC_WARNING T_ID(86) -#define T_LEGACY_RRC_DEBUG T_ID(87) -#define T_LEGACY_RRC_TRACE T_ID(88) -#define T_LEGACY_RLC_INFO T_ID(89) -#define T_LEGACY_RLC_ERROR T_ID(90) -#define T_LEGACY_RLC_WARNING T_ID(91) -#define T_LEGACY_RLC_DEBUG T_ID(92) -#define T_LEGACY_RLC_TRACE T_ID(93) -#define T_LEGACY_PDCP_INFO T_ID(94) -#define T_LEGACY_PDCP_ERROR T_ID(95) -#define T_LEGACY_PDCP_WARNING T_ID(96) -#define T_LEGACY_PDCP_DEBUG T_ID(97) -#define T_LEGACY_PDCP_TRACE T_ID(98) -#define T_LEGACY_ENB_APP_INFO T_ID(99) -#define T_LEGACY_ENB_APP_ERROR T_ID(100) -#define T_LEGACY_ENB_APP_WARNING T_ID(101) -#define T_LEGACY_ENB_APP_DEBUG T_ID(102) -#define T_LEGACY_ENB_APP_TRACE T_ID(103) -#define T_LEGACY_FLEXRAN_AGENT_INFO T_ID(104) -#define T_LEGACY_FLEXRAN_AGENT_ERROR T_ID(105) -#define T_LEGACY_FLEXRAN_AGENT_WARNING T_ID(106) -#define T_LEGACY_FLEXRAN_AGENT_DEBUG T_ID(107) -#define T_LEGACY_FLEXRAN_AGENT_TRACE T_ID(108) -#define T_LEGACY_SCTP_INFO T_ID(109) -#define T_LEGACY_SCTP_ERROR T_ID(110) -#define T_LEGACY_SCTP_WARNING T_ID(111) -#define T_LEGACY_SCTP_DEBUG T_ID(112) -#define T_LEGACY_SCTP_TRACE T_ID(113) -#define T_LEGACY_UDP__INFO T_ID(114) -#define T_LEGACY_UDP__ERROR T_ID(115) -#define T_LEGACY_UDP__WARNING T_ID(116) -#define T_LEGACY_UDP__DEBUG T_ID(117) -#define T_LEGACY_UDP__TRACE T_ID(118) -#define T_LEGACY_NAS_INFO T_ID(119) -#define T_LEGACY_NAS_ERROR T_ID(120) -#define T_LEGACY_NAS_WARNING T_ID(121) -#define T_LEGACY_NAS_DEBUG T_ID(122) -#define T_LEGACY_NAS_TRACE T_ID(123) -#define T_LEGACY_HW_INFO T_ID(124) -#define T_LEGACY_HW_ERROR T_ID(125) -#define T_LEGACY_HW_WARNING T_ID(126) -#define T_LEGACY_HW_DEBUG T_ID(127) -#define T_LEGACY_HW_TRACE T_ID(128) -#define T_LEGACY_EMU_INFO T_ID(129) -#define T_LEGACY_EMU_ERROR T_ID(130) -#define T_LEGACY_EMU_WARNING T_ID(131) -#define T_LEGACY_EMU_DEBUG T_ID(132) -#define T_LEGACY_EMU_TRACE T_ID(133) -#define T_LEGACY_OTG_INFO T_ID(134) -#define T_LEGACY_OTG_ERROR T_ID(135) -#define T_LEGACY_OTG_WARNING T_ID(136) -#define T_LEGACY_OTG_DEBUG T_ID(137) -#define T_LEGACY_OTG_TRACE T_ID(138) -#define T_LEGACY_OCG_INFO T_ID(139) -#define T_LEGACY_OCG_ERROR T_ID(140) -#define T_LEGACY_OCG_WARNING T_ID(141) -#define T_LEGACY_OCG_DEBUG T_ID(142) -#define T_LEGACY_OCG_TRACE T_ID(143) -#define T_LEGACY_OCM_INFO T_ID(144) -#define T_LEGACY_OCM_ERROR T_ID(145) -#define T_LEGACY_OCM_WARNING T_ID(146) -#define T_LEGACY_OCM_DEBUG T_ID(147) -#define T_LEGACY_OCM_TRACE T_ID(148) -#define T_LEGACY_OIP_INFO T_ID(149) -#define T_LEGACY_OIP_ERROR T_ID(150) -#define T_LEGACY_OIP_WARNING T_ID(151) -#define T_LEGACY_OIP_DEBUG T_ID(152) -#define T_LEGACY_OIP_TRACE T_ID(153) -#define T_LEGACY_OMG_INFO T_ID(154) -#define T_LEGACY_OMG_ERROR T_ID(155) -#define T_LEGACY_OMG_WARNING T_ID(156) -#define T_LEGACY_OMG_DEBUG T_ID(157) -#define T_LEGACY_OMG_TRACE T_ID(158) -#define T_LEGACY_OPT_INFO T_ID(159) -#define T_LEGACY_OPT_ERROR T_ID(160) -#define T_LEGACY_OPT_WARNING T_ID(161) -#define T_LEGACY_OPT_DEBUG T_ID(162) -#define T_LEGACY_OPT_TRACE T_ID(163) -#define T_LEGACY_GTPU_INFO T_ID(164) -#define T_LEGACY_GTPU_ERROR T_ID(165) -#define T_LEGACY_GTPU_WARNING T_ID(166) -#define T_LEGACY_GTPU_DEBUG T_ID(167) -#define T_LEGACY_GTPU_TRACE T_ID(168) -#define T_LEGACY_TMR_INFO T_ID(169) -#define T_LEGACY_TMR_ERROR T_ID(170) -#define T_LEGACY_TMR_WARNING T_ID(171) -#define T_LEGACY_TMR_DEBUG T_ID(172) -#define T_LEGACY_TMR_TRACE T_ID(173) -#define T_LEGACY_OSA_INFO T_ID(174) -#define T_LEGACY_OSA_ERROR T_ID(175) -#define T_LEGACY_OSA_WARNING T_ID(176) -#define T_LEGACY_OSA_DEBUG T_ID(177) -#define T_LEGACY_OSA_TRACE T_ID(178) -#define T_LEGACY_SIM_INFO T_ID(179) -#define T_LEGACY_SIM_ERROR T_ID(180) -#define T_LEGACY_SIM_WARNING T_ID(181) -#define T_LEGACY_SIM_DEBUG T_ID(182) -#define T_LEGACY_SIM_TRACE T_ID(183) -#define T_LEGACY_component_INFO T_ID(184) -#define T_LEGACY_component_ERROR T_ID(185) -#define T_LEGACY_component_WARNING T_ID(186) -#define T_LEGACY_component_DEBUG T_ID(187) -#define T_LEGACY_component_TRACE T_ID(188) -#define T_LEGACY_componentP_INFO T_ID(189) -#define T_LEGACY_componentP_ERROR T_ID(190) -#define T_LEGACY_componentP_WARNING T_ID(191) -#define T_LEGACY_componentP_DEBUG T_ID(192) -#define T_LEGACY_componentP_TRACE T_ID(193) -#define T_LEGACY_CLI_INFO T_ID(194) -#define T_LEGACY_CLI_ERROR T_ID(195) -#define T_LEGACY_CLI_WARNING T_ID(196) -#define T_LEGACY_CLI_DEBUG T_ID(197) -#define T_LEGACY_CLI_TRACE T_ID(198) -#define T_UE_MASTER_TICK T_ID(199) -#define T_UE_PHY_UL_TICK T_ID(200) -#define T_UE_PHY_DL_TICK T_ID(201) -#define T_UE_PHY_DLSCH_UE_DCI T_ID(202) -#define T_UE_PHY_DLSCH_UE_ACK T_ID(203) -#define T_UE_PHY_DLSCH_UE_NACK T_ID(204) -#define T_UE_PHY_ULSCH_UE_DCI T_ID(205) -#define T_UE_PHY_ULSCH_UE_ACK T_ID(206) -#define T_UE_PHY_ULSCH_UE_NACK T_ID(207) -#define T_UE_PHY_INPUT_SIGNAL T_ID(208) -#define T_UE_PHY_DL_CHANNEL_ESTIMATE T_ID(209) -#define T_UE_PHY_PDCCH_IQ T_ID(210) -#define T_UE_PHY_PDCCH_ENERGY T_ID(211) -#define T_UE_PHY_PDSCH_IQ T_ID(212) -#define T_UE_PHY_PDSCH_ENERGY T_ID(213) -#define T_UE_PHY_PUSCH_TX_POWER T_ID(214) -#define T_UE_PHY_PUCCH_TX_POWER T_ID(215) -#define T_UE_PHY_MEAS T_ID(216) -#define T_first T_ID(217) -#define T_buf_test T_ID(218) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_ENB T_ID(219) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_ENB T_ID(220) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_ENB T_ID(221) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_ENB T_ID(222) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_ENB T_ID(223) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_ENB T_ID(224) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_ENB T_ID(225) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_ENB T_ID(226) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_RU T_ID(227) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_RU T_ID(228) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_RU T_ID(229) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_RU T_ID(230) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_RU T_ID(231) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_RU T_ID(232) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_RU T_ID(233) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_RU T_ID(234) -#define T_VCD_VARIABLE_RUNTIME_TX_ENB T_ID(235) -#define T_VCD_VARIABLE_RUNTIME_RX_ENB T_ID(236) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_UE T_ID(237) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_UE T_ID(238) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_UE T_ID(239) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_UE T_ID(240) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_UE T_ID(241) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_UE T_ID(242) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_UE T_ID(243) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_UE T_ID(244) -#define T_VCD_VARIABLE_UE_RX_OFFSET T_ID(245) -#define T_VCD_VARIABLE_DIFF T_ID(246) -#define T_VCD_VARIABLE_HW_SUBFRAME T_ID(247) -#define T_VCD_VARIABLE_HW_FRAME T_ID(248) -#define T_VCD_VARIABLE_HW_SUBFRAME_RX T_ID(249) -#define T_VCD_VARIABLE_HW_FRAME_RX T_ID(250) -#define T_VCD_VARIABLE_TXCNT T_ID(251) -#define T_VCD_VARIABLE_RXCNT T_ID(252) -#define T_VCD_VARIABLE_TRX_TS T_ID(253) -#define T_VCD_VARIABLE_TRX_TST T_ID(254) -#define T_VCD_VARIABLE_TRX_TS_UE T_ID(255) -#define T_VCD_VARIABLE_TRX_TST_UE T_ID(256) -#define T_VCD_VARIABLE_TRX_WRITE_FLAGS T_ID(257) -#define T_VCD_VARIABLE_TX_TS T_ID(258) -#define T_VCD_VARIABLE_RX_TS T_ID(259) -#define T_VCD_VARIABLE_RX_HWCNT T_ID(260) -#define T_VCD_VARIABLE_RX_LHWCNT T_ID(261) -#define T_VCD_VARIABLE_TX_HWCNT T_ID(262) -#define T_VCD_VARIABLE_TX_LHWCNT T_ID(263) -#define T_VCD_VARIABLE_RX_PCK T_ID(264) -#define T_VCD_VARIABLE_TX_PCK T_ID(265) -#define T_VCD_VARIABLE_RX_SEQ_NUM T_ID(266) -#define T_VCD_VARIABLE_RX_SEQ_NUM_PRV T_ID(267) -#define T_VCD_VARIABLE_TX_SEQ_NUM T_ID(268) -#define T_VCD_VARIABLE_CNT T_ID(269) -#define T_VCD_VARIABLE_DUMMY_DUMP T_ID(270) -#define T_VCD_VARIABLE_ITTI_SEND_MSG T_ID(271) -#define T_VCD_VARIABLE_ITTI_POLL_MSG T_ID(272) -#define T_VCD_VARIABLE_ITTI_RECV_MSG T_ID(273) -#define T_VCD_VARIABLE_ITTI_ALLOC_MSG T_ID(274) -#define T_VCD_VARIABLE_MP_ALLOC T_ID(275) -#define T_VCD_VARIABLE_MP_FREE T_ID(276) -#define T_VCD_VARIABLE_UE_INST_CNT_RX T_ID(277) -#define T_VCD_VARIABLE_UE_INST_CNT_TX T_ID(278) -#define T_VCD_VARIABLE_DCI_INFO T_ID(279) -#define T_VCD_VARIABLE_UE0_BSR T_ID(280) -#define T_VCD_VARIABLE_UE0_BO T_ID(281) -#define T_VCD_VARIABLE_UE0_SCHEDULED T_ID(282) -#define T_VCD_VARIABLE_UE0_TIMING_ADVANCE T_ID(283) -#define T_VCD_VARIABLE_UE0_SR_ENERGY T_ID(284) -#define T_VCD_VARIABLE_UE0_SR_THRES T_ID(285) -#define T_VCD_VARIABLE_UE0_RSSI0 T_ID(286) -#define T_VCD_VARIABLE_UE0_RSSI1 T_ID(287) -#define T_VCD_VARIABLE_UE0_RSSI2 T_ID(288) -#define T_VCD_VARIABLE_UE0_RSSI3 T_ID(289) -#define T_VCD_VARIABLE_UE0_RSSI4 T_ID(290) -#define T_VCD_VARIABLE_UE0_RSSI5 T_ID(291) -#define T_VCD_VARIABLE_UE0_RSSI6 T_ID(292) -#define T_VCD_VARIABLE_UE0_RSSI7 T_ID(293) -#define T_VCD_VARIABLE_UE0_RES0 T_ID(294) -#define T_VCD_VARIABLE_UE0_RES1 T_ID(295) -#define T_VCD_VARIABLE_UE0_RES2 T_ID(296) -#define T_VCD_VARIABLE_UE0_RES3 T_ID(297) -#define T_VCD_VARIABLE_UE0_RES4 T_ID(298) -#define T_VCD_VARIABLE_UE0_RES5 T_ID(299) -#define T_VCD_VARIABLE_UE0_RES6 T_ID(300) -#define T_VCD_VARIABLE_UE0_RES7 T_ID(301) -#define T_VCD_VARIABLE_UE0_MCS0 T_ID(302) -#define T_VCD_VARIABLE_UE0_MCS1 T_ID(303) -#define T_VCD_VARIABLE_UE0_MCS2 T_ID(304) -#define T_VCD_VARIABLE_UE0_MCS3 T_ID(305) -#define T_VCD_VARIABLE_UE0_MCS4 T_ID(306) -#define T_VCD_VARIABLE_UE0_MCS5 T_ID(307) -#define T_VCD_VARIABLE_UE0_MCS6 T_ID(308) -#define T_VCD_VARIABLE_UE0_MCS7 T_ID(309) -#define T_VCD_VARIABLE_UE0_RB0 T_ID(310) -#define T_VCD_VARIABLE_UE0_RB1 T_ID(311) -#define T_VCD_VARIABLE_UE0_RB2 T_ID(312) -#define T_VCD_VARIABLE_UE0_RB3 T_ID(313) -#define T_VCD_VARIABLE_UE0_RB4 T_ID(314) -#define T_VCD_VARIABLE_UE0_RB5 T_ID(315) -#define T_VCD_VARIABLE_UE0_RB6 T_ID(316) -#define T_VCD_VARIABLE_UE0_RB7 T_ID(317) -#define T_VCD_VARIABLE_UE0_ROUND0 T_ID(318) -#define T_VCD_VARIABLE_UE0_ROUND1 T_ID(319) -#define T_VCD_VARIABLE_UE0_ROUND2 T_ID(320) -#define T_VCD_VARIABLE_UE0_ROUND3 T_ID(321) -#define T_VCD_VARIABLE_UE0_ROUND4 T_ID(322) -#define T_VCD_VARIABLE_UE0_ROUND5 T_ID(323) -#define T_VCD_VARIABLE_UE0_ROUND6 T_ID(324) -#define T_VCD_VARIABLE_UE0_ROUND7 T_ID(325) -#define T_VCD_VARIABLE_UE0_SFN0 T_ID(326) -#define T_VCD_VARIABLE_UE0_SFN1 T_ID(327) -#define T_VCD_VARIABLE_UE0_SFN2 T_ID(328) -#define T_VCD_VARIABLE_UE0_SFN3 T_ID(329) -#define T_VCD_VARIABLE_UE0_SFN4 T_ID(330) -#define T_VCD_VARIABLE_UE0_SFN5 T_ID(331) -#define T_VCD_VARIABLE_UE0_SFN6 T_ID(332) -#define T_VCD_VARIABLE_UE0_SFN7 T_ID(333) -#define T_VCD_VARIABLE_SEND_IF4_SYMBOL T_ID(334) -#define T_VCD_VARIABLE_RECV_IF4_SYMBOL T_ID(335) -#define T_VCD_VARIABLE_SEND_IF5_PKT_ID T_ID(336) -#define T_VCD_VARIABLE_RECV_IF5_PKT_ID T_ID(337) -#define T_VCD_VARIABLE_UE_PDCP_FLUSH_SIZE T_ID(338) -#define T_VCD_VARIABLE_UE_PDCP_FLUSH_ERR T_ID(339) -#define T_VCD_VARIABLE_UE0_TRX_READ_NS T_ID(340) -#define T_VCD_VARIABLE_UE0_TRX_WRITE_NS T_ID(341) -#define T_VCD_VARIABLE_UE0_TRX_READ_NS_MISSING T_ID(342) -#define T_VCD_VARIABLE_UE0_TRX_WRITE_NS_MISSING T_ID(343) -#define T_VCD_VARIABLE_CPUID_ENB_THREAD_RXTX T_ID(344) -#define T_VCD_VARIABLE_CPUID_RU_THREAD T_ID(345) -#define T_VCD_VARIABLE_CPUID_RU_THREAD_TX T_ID(346) -#define T_VCD_FUNCTION_RT_SLEEP T_ID(347) -#define T_VCD_FUNCTION_TRX_READ T_ID(348) -#define T_VCD_FUNCTION_TRX_WRITE T_ID(349) -#define T_VCD_FUNCTION_TRX_READ_UE T_ID(350) -#define T_VCD_FUNCTION_TRX_WRITE_UE T_ID(351) -#define T_VCD_FUNCTION_TRX_READ_IF T_ID(352) -#define T_VCD_FUNCTION_TRX_WRITE_IF T_ID(353) -#define T_VCD_FUNCTION_eNB_PROC_RXTX0 T_ID(354) -#define T_VCD_FUNCTION_eNB_PROC_RXTX1 T_ID(355) -#define T_VCD_FUNCTION_UE_THREAD_SYNCH T_ID(356) -#define T_VCD_FUNCTION_UE_THREAD_RXTX0 T_ID(357) -#define T_VCD_FUNCTION_UE_THREAD_RXTX1 T_ID(358) -#define T_VCD_FUNCTION_TRX_READ_SF9 T_ID(359) -#define T_VCD_FUNCTION_TRX_WRITE_SF9 T_ID(360) -#define T_VCD_FUNCTION_UE_SIGNAL_COND_RXTX0 T_ID(361) -#define T_VCD_FUNCTION_UE_SIGNAL_COND_RXTX1 T_ID(362) -#define T_VCD_FUNCTION_UE_WAIT_COND_RXTX0 T_ID(363) -#define T_VCD_FUNCTION_UE_WAIT_COND_RXTX1 T_ID(364) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0 T_ID(365) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1 T_ID(366) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0 T_ID(367) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1 T_ID(368) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0 T_ID(369) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1 T_ID(370) -#define T_VCD_FUNCTION_SIM_DO_DL_SIGNAL T_ID(371) -#define T_VCD_FUNCTION_SIM_DO_UL_SIGNAL T_ID(372) -#define T_VCD_FUNCTION_SIM_UE_TRX_READ T_ID(373) -#define T_VCD_FUNCTION_eNB_TX T_ID(374) -#define T_VCD_FUNCTION_eNB_RX T_ID(375) -#define T_VCD_FUNCTION_eNB_TRX T_ID(376) -#define T_VCD_FUNCTION_eNB_TM T_ID(377) -#define T_VCD_FUNCTION_eNB_RX_SLEEP T_ID(378) -#define T_VCD_FUNCTION_eNB_TX_SLEEP T_ID(379) -#define T_VCD_FUNCTION_eNB_PROC_SLEEP T_ID(380) -#define T_VCD_FUNCTION_TRX_READ_RF T_ID(381) -#define T_VCD_FUNCTION_TRX_WRITE_RF T_ID(382) -#define T_VCD_FUNCTION_UE_SYNCH T_ID(383) -#define T_VCD_FUNCTION_UE_SLOT_FEP T_ID(384) -#define T_VCD_FUNCTION_UE_RRC_MEASUREMENTS T_ID(385) -#define T_VCD_FUNCTION_UE_GAIN_CONTROL T_ID(386) -#define T_VCD_FUNCTION_UE_ADJUST_SYNCH T_ID(387) -#define T_VCD_FUNCTION_UE_MEASUREMENT_PROCEDURES T_ID(388) -#define T_VCD_FUNCTION_UE_PDCCH_PROCEDURES T_ID(389) -#define T_VCD_FUNCTION_UE_PBCH_PROCEDURES T_ID(390) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_TX T_ID(391) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_TX1 T_ID(392) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX T_ID(393) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX1 T_ID(394) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM T_ID(395) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM1 T_ID(396) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC T_ID(397) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC1 T_ID(398) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC T_ID(399) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC1 T_ID(400) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX T_ID(401) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_RX T_ID(402) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC T_ID(403) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PUCCH T_ID(404) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_COMMON T_ID(405) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PRACH T_ID(406) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_RAR T_ID(407) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_LTE T_ID(408) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_LTE T_ID(409) -#define T_VCD_FUNCTION_PDSCH_THREAD T_ID(410) -#define T_VCD_FUNCTION_DLSCH_THREAD0 T_ID(411) -#define T_VCD_FUNCTION_DLSCH_THREAD1 T_ID(412) -#define T_VCD_FUNCTION_DLSCH_THREAD2 T_ID(413) -#define T_VCD_FUNCTION_DLSCH_THREAD3 T_ID(414) -#define T_VCD_FUNCTION_DLSCH_THREAD4 T_ID(415) -#define T_VCD_FUNCTION_DLSCH_THREAD5 T_ID(416) -#define T_VCD_FUNCTION_DLSCH_THREAD6 T_ID(417) -#define T_VCD_FUNCTION_DLSCH_THREAD7 T_ID(418) -#define T_VCD_FUNCTION_DLSCH_DECODING0 T_ID(419) -#define T_VCD_FUNCTION_DLSCH_DECODING1 T_ID(420) -#define T_VCD_FUNCTION_DLSCH_DECODING2 T_ID(421) -#define T_VCD_FUNCTION_DLSCH_DECODING3 T_ID(422) -#define T_VCD_FUNCTION_DLSCH_DECODING4 T_ID(423) -#define T_VCD_FUNCTION_DLSCH_DECODING5 T_ID(424) -#define T_VCD_FUNCTION_DLSCH_DECODING6 T_ID(425) -#define T_VCD_FUNCTION_DLSCH_DECODING7 T_ID(426) -#define T_VCD_FUNCTION_RX_PDCCH T_ID(427) -#define T_VCD_FUNCTION_DCI_DECODING T_ID(428) -#define T_VCD_FUNCTION_RX_PHICH T_ID(429) -#define T_VCD_FUNCTION_PDSCH_PROC T_ID(430) -#define T_VCD_FUNCTION_PDSCH_PROC_SI T_ID(431) -#define T_VCD_FUNCTION_PDSCH_PROC_P T_ID(432) -#define T_VCD_FUNCTION_PDSCH_PROC_RA T_ID(433) -#define T_VCD_FUNCTION_PHY_UE_CONFIG_SIB2 T_ID(434) -#define T_VCD_FUNCTION_PHY_CONFIG_SIB1_ENB T_ID(435) -#define T_VCD_FUNCTION_PHY_CONFIG_SIB2_ENB T_ID(436) -#define T_VCD_FUNCTION_PHY_CONFIG_DEDICATED_ENB T_ID(437) -#define T_VCD_FUNCTION_PHY_UE_COMPUTE_PRACH T_ID(438) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_MSG3 T_ID(439) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING0 T_ID(440) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING1 T_ID(441) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING2 T_ID(442) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING3 T_ID(443) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING4 T_ID(444) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING5 T_ID(445) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING6 T_ID(446) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING7 T_ID(447) -#define T_VCD_FUNCTION_PHY_ENB_SFGEN T_ID(448) -#define T_VCD_FUNCTION_PHY_ENB_PRACH_RX T_ID(449) -#define T_VCD_FUNCTION_PHY_RU_PRACH_RX T_ID(450) -#define T_VCD_FUNCTION_PHY_ENB_PDCCH_TX T_ID(451) -#define T_VCD_FUNCTION_PHY_ENB_RS_TX T_ID(452) -#define T_VCD_FUNCTION_UE_GENERATE_PRACH T_ID(453) -#define T_VCD_FUNCTION_UE_ULSCH_MODULATION T_ID(454) -#define T_VCD_FUNCTION_UE_ULSCH_ENCODING T_ID(455) -#define T_VCD_FUNCTION_UE_ULSCH_ENCODING_FILL_CQI T_ID(456) -#define T_VCD_FUNCTION_UE_ULSCH_SCRAMBLING T_ID(457) -#define T_VCD_FUNCTION_ENB_DLSCH_MODULATION T_ID(458) -#define T_VCD_FUNCTION_ENB_DLSCH_ENCODING T_ID(459) -#define T_VCD_FUNCTION_ENB_DLSCH_ENCODING_W T_ID(460) -#define T_VCD_FUNCTION_ENB_DLSCH_SCRAMBLING T_ID(461) -#define T_VCD_FUNCTION_ENB_BEAM_PRECODING T_ID(462) -#define T_VCD_FUNCTION_ENB_OFDM_MODULATION T_ID(463) -#define T_VCD_FUNCTION_MACPHY_INIT T_ID(464) -#define T_VCD_FUNCTION_MACPHY_EXIT T_ID(465) -#define T_VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER T_ID(466) -#define T_VCD_FUNCTION_FILL_RAR T_ID(467) -#define T_VCD_FUNCTION_TERMINATE_RA_PROC T_ID(468) -#define T_VCD_FUNCTION_INITIATE_RA_PROC T_ID(469) -#define T_VCD_FUNCTION_CANCEL_RA_PROC T_ID(470) -#define T_VCD_FUNCTION_GET_DCI_SDU T_ID(471) -#define T_VCD_FUNCTION_GET_DLSCH_SDU T_ID(472) -#define T_VCD_FUNCTION_RX_SDU T_ID(473) -#define T_VCD_FUNCTION_MRBCH_PHY_SYNC_FAILURE T_ID(474) -#define T_VCD_FUNCTION_SR_INDICATION T_ID(475) -#define T_VCD_FUNCTION_DLSCH_PREPROCESSOR T_ID(476) -#define T_VCD_FUNCTION_SCHEDULE_DLSCH T_ID(477) -#define T_VCD_FUNCTION_FILL_DLSCH_DCI T_ID(478) -#define T_VCD_FUNCTION_OUT_OF_SYNC_IND T_ID(479) -#define T_VCD_FUNCTION_UE_DECODE_SI T_ID(480) -#define T_VCD_FUNCTION_UE_DECODE_PCCH T_ID(481) -#define T_VCD_FUNCTION_UE_DECODE_CCCH T_ID(482) -#define T_VCD_FUNCTION_UE_DECODE_BCCH T_ID(483) -#define T_VCD_FUNCTION_UE_SEND_SDU T_ID(484) -#define T_VCD_FUNCTION_UE_GET_SDU T_ID(485) -#define T_VCD_FUNCTION_UE_GET_RACH T_ID(486) -#define T_VCD_FUNCTION_UE_PROCESS_RAR T_ID(487) -#define T_VCD_FUNCTION_UE_SCHEDULER T_ID(488) -#define T_VCD_FUNCTION_UE_GET_SR T_ID(489) -#define T_VCD_FUNCTION_UE_SEND_MCH_SDU T_ID(490) -#define T_VCD_FUNCTION_RLC_DATA_REQ T_ID(491) -#define T_VCD_FUNCTION_MAC_RLC_STATUS_IND T_ID(492) -#define T_VCD_FUNCTION_MAC_RLC_DATA_REQ T_ID(493) -#define T_VCD_FUNCTION_MAC_RLC_DATA_IND T_ID(494) -#define T_VCD_FUNCTION_RLC_UM_TRY_REASSEMBLY T_ID(495) -#define T_VCD_FUNCTION_RLC_UM_CHECK_TIMER_DAR_TIME_OUT T_ID(496) -#define T_VCD_FUNCTION_RLC_UM_RECEIVE_PROCESS_DAR T_ID(497) -#define T_VCD_FUNCTION_PDCP_RUN T_ID(498) -#define T_VCD_FUNCTION_PDCP_DATA_REQ T_ID(499) -#define T_VCD_FUNCTION_PDCP_DATA_IND T_ID(500) -#define T_VCD_FUNCTION_PDCP_APPLY_SECURITY T_ID(501) -#define T_VCD_FUNCTION_PDCP_VALIDATE_SECURITY T_ID(502) -#define T_VCD_FUNCTION_PDCP_FIFO_READ T_ID(503) -#define T_VCD_FUNCTION_PDCP_FIFO_READ_BUFFER T_ID(504) -#define T_VCD_FUNCTION_PDCP_FIFO_FLUSH T_ID(505) -#define T_VCD_FUNCTION_PDCP_FIFO_FLUSH_BUFFER T_ID(506) -#define T_VCD_FUNCTION_RRC_RX_TX T_ID(507) -#define T_VCD_FUNCTION_RRC_MAC_CONFIG T_ID(508) -#define T_VCD_FUNCTION_RRC_UE_DECODE_SIB1 T_ID(509) -#define T_VCD_FUNCTION_RRC_UE_DECODE_SI T_ID(510) -#define T_VCD_FUNCTION_GTPV1U_ENB_TASK T_ID(511) -#define T_VCD_FUNCTION_GTPV1U_PROCESS_UDP_REQ T_ID(512) -#define T_VCD_FUNCTION_GTPV1U_PROCESS_TUNNEL_DATA_REQ T_ID(513) -#define T_VCD_FUNCTION_UDP_ENB_TASK T_ID(514) -#define T_VCD_FUNCTION_EMU_TRANSPORT T_ID(515) -#define T_VCD_FUNCTION_LOG_RECORD T_ID(516) -#define T_VCD_FUNCTION_ITTI_ENQUEUE_MESSAGE T_ID(517) -#define T_VCD_FUNCTION_ITTI_DUMP_ENQUEUE_MESSAGE T_ID(518) -#define T_VCD_FUNCTION_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC T_ID(519) -#define T_VCD_FUNCTION_ITTI_RELAY_THREAD T_ID(520) -#define T_VCD_FUNCTION_TEST T_ID(521) -#define T_VCD_FUNCTION_SEND_IF4 T_ID(522) -#define T_VCD_FUNCTION_RECV_IF4 T_ID(523) -#define T_VCD_FUNCTION_SEND_IF5 T_ID(524) -#define T_VCD_FUNCTION_RECV_IF5 T_ID(525) -#define T_VCD_FUNCTION_TRX_COMPR_IF T_ID(526) -#define T_VCD_FUNCTION_TRX_DECOMPR_IF T_ID(527) -#define T_VCD_FUNCTION_NFAPI T_ID(528) -#define T_VCD_FUNCTION_GENERATE_PCFICH T_ID(529) -#define T_VCD_FUNCTION_GENERATE_DCI0 T_ID(530) -#define T_VCD_FUNCTION_GENERATE_DLSCH T_ID(531) -#define T_VCD_FUNCTION_GENERATE_PHICH T_ID(532) -#define T_VCD_FUNCTION_PDCCH_SCRAMBLING T_ID(533) -#define T_VCD_FUNCTION_PDCCH_MODULATION T_ID(534) -#define T_VCD_FUNCTION_PDCCH_INTERLEAVING T_ID(535) -#define T_VCD_FUNCTION_PDCCH_TX T_ID(536) -#define T_NUMBER_OF_IDS 537 - -#define T_LEGACY_PROTO_AGENT_DEBUG T_ID(538) -#define T_LEGACY_PROTO_AGENT_INFO T_ID(539) -#define T_LEGACY_PROTO_AGENT_ERROR T_ID(540) -#define T_LEGACY_F1U_ERROR T_ID(541) -#define T_LEGACY_F1U_DEBUG T_ID(542) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 676f329a0e..a0ce662462 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -838,6 +838,28 @@ ID = LEGACY_CLI_TRACE GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log +ID = LEGACY_PROTO_AGENT_DEBUG + DESC = PROTO AGENT legacy logs - debug level + GROUP = ALL:LEGACY_PROTO_AGENT:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log +ID = LEGACY_PROTO_AGENT_INFO + DESC = PROTO AGENT legacy logs - info level + GROUP = ALL:LEGACY_PROTO_AGENT:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log +ID = LEGACY_PROTO_AGENT_ERROR + DESC = PROTO AGENT legacy logs - error level + GROUP = ALL:LEGACY_PROTO_AGENT:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log + +ID = LEGACY_F1U_ERROR + DESC = F1U legacy logs - error level + GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log +ID = LEGACY_F1U_DEBUG + DESC = F1U legacy logs - debug level + GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log + ################# #### UE LOGS #### ################# -- GitLab From 3021cf114d42a1f4350d08084776709fa68677c1 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 31 Aug 2018 15:55:42 +0200 Subject: [PATCH 019/308] F1 & MAC: 1. Fix UE_CONTEXT_SETUP_REQUEST and CONTEXT_MODIFICATION_REQUEST encode/decode 2. Add gNB_DU_CONFIGURATION_UPDATE and gNB_CU_CONFIGURATION_UPDATE procedure 3. Add C_RNTI_TO_BIT_STRING function 4. Add INITIAL_UL_RRC_MESSAGE_TRANSFER procedure and with mac_du_data_ind (MSG3) 5. Add GNB-CUSystemInformation extension part for the F1SetupResponse procedure --- cmake_targets/CMakeLists.txt | 4 + openair2/F1AP/CU_F1AP.c | 465 +++++++++++++- openair2/F1AP/DU_F1AP.c | 586 +++++++++++++++++- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 34 +- .../L2_INTERFACE/openair_rrc_L2_interface.h | 8 +- openair2/RRC/LTE/L2_interface.c | 43 +- openair2/RRC/LTE/rrc_eNB.c | 1 + openair2/RRC/LTE/rrc_proto.h | 6 +- openair3/UTILS/conversions.h | 15 +- 9 files changed, 1110 insertions(+), 52 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 3b22302133..92ec6de90f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -525,12 +525,16 @@ add_library(F1AP_LIB include_directories ("${F1AP_C_DIR}") include_directories ("${F1AP_DIR}") +message(${F1AP_C_DIR}) +message(${F1AP_DIR}) add_library(F1AP #${F1AP_DIR}/test.c ${F1AP_DIR}/DU_F1AP.c ${F1AP_DIR}/CU_F1AP.c + ${F1AP_DIR}/sctp_du.c + ${F1AP_DIR}/sctp_cu.c ) add_executable(test_f1ap_du diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index e164dc99db..8130f9b8e3 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -87,17 +87,20 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ void F1AP_CU_task() { printf("Start F1AP CU task!\n"); - sctp_cu_init(); + //sctp_cu_init(); // while (1) { // switch () { - // case F1AP_ProcedureCode_id_F1Setup: - //CU_send_F1_SETUP_RESPONSE(); - //CU_send_DL_RRC_MESSAGE_TRANSFER(); // L436 - //CU_send_UE_CONTEXT_SETUP_REQUEST(); // god - //CU_send_UE_CONTEXT_MODIFICATION_REQUEST(); // oh my + //case F1AP_ProcedureCode_id_F1Setup: + CU_send_F1_SETUP_RESPONSE(); + //case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: + // CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER (); + //CU_send_DL_RRC_MESSAGE_TRANSFER(); // SRBID and RRCContainer get issue when decode. + //CU_send_UE_CONTEXT_SETUP_REQUEST(); + //CU_send_UE_CONTEXT_MODIFICATION_REQUEST(); + //CU_send_gNB_CU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); // some problem found // break; // default: @@ -170,11 +173,6 @@ void CU_send_F1_SETUP_RESPONSE() { pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_F1SetupResponse; out = &pdu.choice.successfulOutcome->value.choice.F1SetupResponse; - - /* response_present_val */ - //F1AP_F1SetupResponseIEs__value_PR_TransactionID - //F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name - //F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List /* mandatory */ /* c1. Transaction ID (integer value)*/ @@ -228,16 +226,39 @@ void CU_send_F1_SETUP_RESPONSE() { /* optional */ /* - nRPCI */ - if (0) { + if (1) { cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 } /* optional */ /* - gNB-CU System Information */ - //if (1) { + if (1) { + /* 3.1.2 gNB-CUSystem Information */ + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; + cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); + cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; + cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; + + + F1AP_GNB_CUSystemInformation_t gNB_CUSystemInformation; + memset((void *)&gNB_CUSystemInformation, 0, sizeof(F1AP_GNB_CUSystemInformation_t)); - //} + OCTET_STRING_fromBuf(&gNB_CUSystemInformation.sImessage, + "123456", strlen("123456")); + + cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = gNB_CUSystemInformation; + + + F1AP_ProtocolExtensionContainer_160P9_t p_160P9_t; + memset((void *)&p_160P9_t, 0, sizeof(F1AP_ProtocolExtensionContainer_160P9_t)); + + ASN_SEQUENCE_ADD(&p_160P9_t.list, + cells_to_be_activated_list_itemExtIEs); + cells_to_be_activated_list_item.iE_Extensions = &p_160P9_t; + + } /* ADD */ cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, @@ -386,6 +407,16 @@ void CU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } +void CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(){ + + printf("CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER\n"); + // decode the F1 message + // get the rrc message from the contauiner + // call func rrc_eNB_decode_ccch: <-- needs some update here + + // if size > 0 + // CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size) +} void CU_handle_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { AssertFatal(1==0,"Not implemented yet\n"); @@ -447,7 +478,7 @@ void CU_send_DL_RRC_MESSAGE_TRANSFER() { ie->id = F1AP_ProtocolIE_ID_id_SRBID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = 1L; + ie->value.choice.SRBID = 2L; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ @@ -468,7 +499,7 @@ void CU_send_DL_RRC_MESSAGE_TRANSFER() { ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1", strlen("asdsa1")); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "A", strlen("A")); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ @@ -487,7 +518,7 @@ void CU_send_DL_RRC_MESSAGE_TRANSFER() { ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - /* encode */ + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); return -1; @@ -516,8 +547,384 @@ void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpda } -void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { - AssertFatal(1==0,"Not implemented yet\n"); +//void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { +void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP) { + F1AP_F1AP_PDU_t pdu; + F1AP_GNBCUConfigurationUpdate_t *out; + F1AP_GNBCUConfigurationUpdateIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + f1ap_info_t f1ap_info; + f1ap_info.GNB_CU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate; + out = &pdu.choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; + + /* mandatory */ + /* c1. Transaction ID (integer value) */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c2. Cells_to_be_Activated_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List; + + for (i=0; + i<1; + i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; + cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); + cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + + /* 2.1 cells to be Activated list item */ + F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; + memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_activated_list_item.nRCGI = nRCGI; + + /* optional */ + /* - nRPCI */ + if (0) { + cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 + } + + /* optional */ + /* - gNB-CU System Information */ + //if (1) { + + //} + /* ADD */ + cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, + cells_to_be_activated_list_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c3. Cells_to_be_Deactivated_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List; + + for (i=0; + i<1; + i++) { + + F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *cells_to_be_deactivated_list_item_ies; + cells_to_be_deactivated_list_item_ies = (F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Deactivated_List_ItemIEs_t)); + cells_to_be_deactivated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; + + /* 3.1 cells to be Deactivated list item */ + F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item; + memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_deactivated_list_item.nRCGI = nRCGI; + + //} + /* ADD */ + cells_to_be_deactivated_list_item_ies->value.choice.Cells_to_be_Deactivated_List_Item = cells_to_be_deactivated_list_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Deactivated_List.list, + cells_to_be_deactivated_list_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c4. GNB_CU_TNL_Association_To_Add_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Add_List; + + for (i=0; + i<1; + i++) { + + F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *gnb_cu_tnl_association_to_add_item_ies; + gnb_cu_tnl_association_to_add_item_ies = (F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t)); + gnb_cu_tnl_association_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item; + gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; + + /* 4.1 GNB_CU_TNL_Association_To_Add_Item */ + F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item; + memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t)); + + + /* 4.1.1 tNLAssociationTransportLayerAddress */ + F1AP_CP_TransportLayerAddress_t transportLayerAddress; + memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; + // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); + // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + + gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress; + + /* 4.1.2 tNLAssociationUsage */ + gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; + + + /* ADD */ + gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item; + ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list, + gnb_cu_tnl_association_to_add_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c5. GNB_CU_TNL_Association_To_Remove_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List; + for (i=0; + i<1; + i++) { + + F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *gnb_cu_tnl_association_to_remove_item_ies; + gnb_cu_tnl_association_to_remove_item_ies = (F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t)); + gnb_cu_tnl_association_to_remove_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item; + gnb_cu_tnl_association_to_remove_item_ies->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_remove_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item; + + /* 4.1 GNB_CU_TNL_Association_To_Remove_Item */ + F1AP_GNB_CU_TNL_Association_To_Remove_Item_t gnb_cu_tnl_association_to_remove_item; + memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t)); + + + /* 4.1.1 tNLAssociationTransportLayerAddress */ + F1AP_CP_TransportLayerAddress_t transportLayerAddress; + memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; + // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); + // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + + gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress; + + + /* ADD */ + gnb_cu_tnl_association_to_remove_item_ies->value.choice.GNB_CU_TNL_Association_To_Remove_Item = gnb_cu_tnl_association_to_remove_item; + ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, + gnb_cu_tnl_association_to_remove_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c6. GNB_CU_TNL_Association_To_Update_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Update_List; + for (i=0; + i<1; + i++) { + + F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *gnb_cu_tnl_association_to_update_item_ies; + gnb_cu_tnl_association_to_update_item_ies = (F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t)); + gnb_cu_tnl_association_to_update_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item; + gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; + + /* 4.1 GNB_CU_TNL_Association_To_Update_Item */ + F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item; + memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t)); + + + /* 4.1.1 tNLAssociationTransportLayerAddress */ + F1AP_CP_TransportLayerAddress_t transportLayerAddress; + memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; + // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); + // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + + gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress; + + + /* 4.1.2 tNLAssociationUsage */ + if (1) { + gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t)); + *gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; + } + + /* ADD */ + gnb_cu_tnl_association_to_update_item_ies->value.choice.GNB_CU_TNL_Association_To_Update_Item = gnb_cu_tnl_association_to_update_item; + ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Update_List.list, + gnb_cu_tnl_association_to_update_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c7. Cells_to_be_Barred_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Barred_List; + for (i=0; + i<1; + i++) { + + F1AP_Cells_to_be_Barred_ItemIEs_t *cells_to_be_barred_item_ies; + cells_to_be_barred_item_ies = (F1AP_Cells_to_be_Barred_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Barred_ItemIEs_t)); + cells_to_be_barred_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_barred_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_barred_item_ies->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item; + + /* 7.1 cells to be Deactivated list item */ + F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item; + memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_barred_item.nRCGI = nRCGI; + + /* 7.2 cellBarred*/ + cells_to_be_barred_item.cellBarred = F1AP_CellBarred_not_barred; + + /* ADD */ + cells_to_be_barred_item_ies->value.choice.Cells_to_be_Barred_Item = cells_to_be_barred_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Barred_List.list, + cells_to_be_barred_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c8. Protected_EUTRA_Resources_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Protected_EUTRA_Resources_List; + + for (i=0; + i<1; + i++) { + + + F1AP_Protected_EUTRA_Resources_ItemIEs_t *protected_eutra_resources_item_ies; + + /* 8.1 SpectrumSharingGroupID */ + protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); + protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; + protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; + protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_SpectrumSharingGroupID; + protected_eutra_resources_item_ies->value.choice.SpectrumSharingGroupID = 1L; + + ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); + + /* 8.2 ListofEUTRACellsinGNBDUCoordination */ + protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); + protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; + protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; + protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_ListofEUTRACellsinGNBDUCoordination; + + F1AP_Served_EUTRA_Cells_Information_t served_eutra_cells_information; + memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t)); + + F1AP_EUTRA_Mode_Info_t eUTRA_Mode_Info; + memset((void *)&eUTRA_Mode_Info, 0, sizeof(F1AP_EUTRA_Mode_Info_t)); + + // eUTRAFDD + eUTRA_Mode_Info.present = F1AP_EUTRA_Mode_Info_PR_eUTRAFDD; + F1AP_EUTRA_FDD_Info_t *eutra_fdd_info; + eutra_fdd_info = (F1AP_EUTRA_FDD_Info_t *)calloc(1, sizeof(F1AP_EUTRA_FDD_Info_t)); + eutra_fdd_info->uL_offsetToPointA = 123L; + eutra_fdd_info->dL_offsetToPointA = 456L; + eUTRA_Mode_Info.choice.eUTRAFDD = eutra_fdd_info; + + // eUTRATDD + // eUTRA_Mode_Info.present = F1AP_EUTRA_Mode_Info_PR_eUTRATDD; + // F1AP_EUTRA_TDD_Info_t *eutra_tdd_info; + // eutra_tdd_info = (F1AP_EUTRA_TDD_Info_t *)calloc(1, sizeof(F1AP_EUTRA_TDD_Info_t)); + // eutra_tdd_info->uL_offsetToPointA = 123L; + // eutra_tdd_info->dL_offsetToPointA = 456L; + // eUTRA_Mode_Info.choice.eUTRATDD = eutra_tdd_info; + + served_eutra_cells_information.eUTRA_Mode_Info = eUTRA_Mode_Info; + + OCTET_STRING_fromBuf(&served_eutra_cells_information.protectedEUTRAResourceIndication, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + + ASN_SEQUENCE_ADD(&protected_eutra_resources_item_ies->value.choice.ListofEUTRACellsinGNBDUCoordination.list, &served_eutra_cells_information); + + ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return -1; + } + + printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } } void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { @@ -596,7 +1003,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST() { /* c4. ServCellIndex */ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; - ie->criticality = F1AP_Criticality_ignore; + ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; ie->value.choice.ServCellIndex = 2; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -763,7 +1170,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST() { memset((void *)&srbs_toBeSetup_item, 0, sizeof(F1AP_SRBs_ToBeSetup_Item_t)); /* - sRBID */ - srbs_toBeSetup_item.sRBID = 50L; + srbs_toBeSetup_item.sRBID = 2L; /* ADD */ srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item = srbs_toBeSetup_item; @@ -789,7 +1196,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST() { drbs_toBeSetup_item_ies->criticality = F1AP_Criticality_reject; drbs_toBeSetup_item_ies->value.present = F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; - /* 10.1 SRBs_ToBeSetup_Item */ + /* 10.1 DRBs_ToBeSetup_Item */ F1AP_DRBs_ToBeSetup_Item_t drbs_toBeSetup_item; memset((void *)&drbs_toBeSetup_item, 0, sizeof(F1AP_DRBs_ToBeSetup_Item_t)); @@ -799,7 +1206,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST() { /* qoSInformation */ drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 789L; + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; /* ULTunnels_ToBeSetup_List */ int maxnoofULTunnels = 1; // 2; @@ -808,6 +1215,8 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST() { i++) { /* ULTunnels_ToBeSetup_Item */ F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; + + // gTPTunnel uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); @@ -819,7 +1228,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST() { uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, &uLUPTNLInformation_ToBeSetup_Item); + ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); } /* rLCMode */ @@ -1137,7 +1546,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST() { memset((void *)&srbs_toBeSetupMod_item, 0, sizeof(F1AP_SRBs_ToBeSetupMod_Item_t)); /* - sRBID */ - srbs_toBeSetupMod_item.sRBID = 50L; + srbs_toBeSetupMod_item.sRBID = 3L; /* ADD */ srbs_toBeSetupMod_item_ies->value.choice.SRBs_ToBeSetupMod_Item = srbs_toBeSetupMod_item; @@ -1175,7 +1584,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST() { /* qoSInformation */ drbs_toBeSetupMod_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS->qCI = 789L; + drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS->qCI = 253L; /* ULTunnels_ToBeSetupMod_List */ int j = 0; @@ -1244,7 +1653,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST() { /* qoSInformation */ drbs_toBeModified_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS->qCI = 789L; + drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; /* ULTunnels_ToBeModified_List */ int j = 0; @@ -1305,7 +1714,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST() { memset((void *)&srbs_toBeReleased_item, 0, sizeof(F1AP_SRBs_ToBeReleased_Item_t)); /* - sRBID */ - srbs_toBeReleased_item.sRBID = 50L; + srbs_toBeReleased_item.sRBID = 2L; /* ADD */ srbs_toBeReleased_item_ies->value.choice.SRBs_ToBeReleased_Item = srbs_toBeReleased_item; diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 4d9f0cc5f8..ee4ad7dab8 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -34,7 +34,7 @@ #include "f1ap_common.h" #include "f1ap_messages_types.h" #include "platform_types.h" -#include "log.h" +#include "common/utils/LOG/log.h" /* This structure describes association of a DU to a CU */ typedef struct f1ap_info { @@ -71,6 +71,7 @@ typedef struct f1ap_info { // helper functions #define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 +#define F1AP_UE_IDENTIFIER_NUMBER 3 #define NUMBER_OF_eNB_MAX 3 uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t du_mod_idP) { @@ -80,6 +81,13 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ return transaction_identifier[enb_mod_idP+du_mod_idP]; } +uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { + static uint8_t UE_identifier[NUMBER_OF_eNB_MAX]; + UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER; + //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]); + return UE_identifier[enb_mod_idP+CC_idP+UE_id]; +} + // ============================================================================== void F1AP_DU_task() { @@ -94,9 +102,11 @@ void F1AP_DU_task() { // case F1AP_ProcedureCode_id_F1Setup: //DU_send_F1_SETUP_REQUEST((module_id_t)1, (module_id_t)2); // break; + //DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(); //DU_send_UL_RRC_MESSAGE_TRANSFER(); // OK //DU_send_UE_CONTEXT_SETUP_RESPONSE(); // OK - DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(); // OK + //DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(); // OK + //DU_send_gNB_DU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); // default: // } // switch @@ -106,6 +116,10 @@ void F1AP_DU_task() { return NULL; } +// ============================================================================== + + + // ============================================================================== @@ -122,7 +136,7 @@ void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP) { int ret = 0; int i = 0; - // for test + // for test f1ap_info_t f1ap_info; f1ap_info.GNB_DU_ID = 789; f1ap_info.GNB_DU_Name = "ABC"; @@ -573,6 +587,114 @@ void DU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } +//void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { +//void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER() { +void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( + module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP, + uint8_t *sduP, + sdu_size_t sdu_lenP +) +{ + F1AP_F1AP_PDU_t pdu; + F1AP_InitialULRRCMessageTransfer_t *out; + F1AP_InitialULRRCMessageTransferIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + // for test + f1ap_info_t f1ap_info; + f1ap_info.GNB_DU_ID = 789; + f1ap_info.GNB_DU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 3; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_InitialULRRCMessageTransfer; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_InitialULRRCMessageTransfer; + out = &pdu.choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer; + + + /* mandatory */ + /* c1. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = F1AP_get_UE_identifier(module_idP, CC_idP, UE_id); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. NRCGI */ + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_NRCGI; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; + + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + ie->value.choice.NRCGI = nRCGI; + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. C_RNTI */ // 16 + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_C_RNTI; + C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c4. RRCContainer */ + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c5. DUtoCURRCContainer */ + if (0) { + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, "dummy_val", + strlen("dummy_val")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + printf("\n"); + + f1ap_du_send_message(buffer, len); + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + //AssertFatal(1==0,"Not implemented yet\n"); +} //void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { void DU_send_UL_RRC_MESSAGE_TRANSFER() { @@ -653,8 +775,462 @@ void DU_handle_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessage } -void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { - AssertFatal(1==0,"Not implemented yet\n"); +//void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { +void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP) { + F1AP_F1AP_PDU_t pdu; + F1AP_GNBDUConfigurationUpdate_t *out; + F1AP_GNBDUConfigurationUpdateIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int ret = 0; + int i = 0; + + // for test + f1ap_info_t f1ap_info; + f1ap_info.GNB_DU_ID = 789; + f1ap_info.GNB_DU_Name = "ABC"; + f1ap_info.mcc = 208; + f1ap_info.mnc = 93; + f1ap_info.mnc_digit_length = 3; + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBDUConfigurationUpdate; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate; + out = &pdu.choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; + + /* mandatory */ + /* c1. Transaction ID (integer value) */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c2. Served_Cells_To_Add */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Add_List; + + for (i=0; + i<1; + i++) { + // + F1AP_Served_Cells_To_Add_ItemIEs_t *served_cells_to_add_item_ies; + served_cells_to_add_item_ies = (F1AP_Served_Cells_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Add_ItemIEs_t)); + served_cells_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_Item; + served_cells_to_add_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_add_item_ies->value.present = F1AP_Served_Cells_To_Add_ItemIEs__value_PR_Served_Cells_To_Add_Item; + + F1AP_Served_Cells_To_Add_Item_t served_cells_to_add_item; + memset((void *)&served_cells_to_add_item, 0, sizeof(F1AP_Served_Cells_To_Add_Item_t)); + + /* 2.1.1 serverd cell Information */ + F1AP_Served_Cell_Information_t served_cell_information; + + memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &nRCGI.pLMN_Identity); + + + //INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); + nRCGI.nRCellIdentity.buf = malloc((36+7)/8); + + nRCGI.nRCellIdentity.size = (36+7)/8; + nRCGI.nRCellIdentity.bits_unused = 4; + + nRCGI.nRCellIdentity.buf[0] = 123; + + //nRCGI.nRCellIdentity = 15; + served_cell_information.nRCGI = nRCGI; + + /* - nRPCI */ + served_cell_information.nRPCI = 321; // int 0..1007 + + /* - fiveGS_TAC */ + OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + "10", + 3); + + /* - Configured_EPS_TAC */ + if(1){ + served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + "2", + 2); + } + + /* - broadcast PLMNs */ + int maxnoofBPLMNS = 1; + for (i=0; + i<maxnoofBPLMNS; + i++) { + /* > PLMN BroadcastPLMNs Item */ + F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); + //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &broadcastPLMNs_Item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); + } + + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t nR_Mode_Info; + + if ("FDD") { + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + /* > FDD >> FDD Info */ + F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* >>> UL NRFreqInfo */ + fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; + + F1AP_FreqBandNrItem_t ul_freqBandNrItem; + memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + ul_freqBandNrItem.freqBandIndicatorNr = 888L; + + F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; + memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + + /* >>> DL NRFreqInfo */ + fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; + + F1AP_FreqBandNrItem_t dl_freqBandNrItem; + memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + dl_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; + memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + + /* >>> UL Transmission Bandwidth */ + fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + /* >>> DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.fDD = fDD_Info; + } else { // TDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + + /* > TDD >> TDD Info */ + F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + /* >>> ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + nr_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + + tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; + tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.tDD = tDD_Info; + } + + served_cell_information.nR_Mode_Info = nR_Mode_Info; + + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = "0"; // sept. 2018 + + OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + served_cells_to_add_item.served_Cell_Information = served_cell_information; // + + /* 2.1.2 gNB-DU System Information */ + F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + "1", + sizeof("1")); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + "1", + sizeof("1")); + served_cells_to_add_item.gNB_DU_System_Information = gNB_DU_System_Information; // + + /* ADD */ + served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item = served_cells_to_add_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Add_List.list, + served_cells_to_add_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c3. Served_Cells_To_Modify */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List; + + for (i=0; + i<1; + i++) { + // + F1AP_Served_Cells_To_Modify_ItemIEs_t *served_cells_to_modify_item_ies; + served_cells_to_modify_item_ies = (F1AP_Served_Cells_To_Modify_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Modify_ItemIEs_t)); + served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item; + served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_modify_item_ies->value.present = F1AP_Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item; + + F1AP_Served_Cells_To_Modify_Item_t served_cells_to_modify_item; + memset((void *)&served_cells_to_modify_item, 0, sizeof(F1AP_Served_Cells_To_Modify_Item_t)); + + /* 3.1 oldNRCGI */ + F1AP_NRCGI_t oldNRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &oldNRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); + served_cells_to_modify_item.oldNRCGI = oldNRCGI; + + + /* 3.2.1 serverd cell Information */ + F1AP_Served_Cell_Information_t served_cell_information; + memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + served_cell_information.nRCGI = nRCGI; + + /* - nRPCI */ + served_cell_information.nRPCI = 321; // int 0..1007 + + /* - fiveGS_TAC */ + OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + "10", + 3); + + /* - Configured_EPS_TAC */ + if(1){ + served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + "2", + 2); + } + + /* - broadcast PLMNs */ + int maxnoofBPLMNS = 1; + for (i=0; + i<maxnoofBPLMNS; + i++) { + /* > PLMN BroadcastPLMNs Item */ + F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); + //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &broadcastPLMNs_Item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); + } + + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t nR_Mode_Info; + + if ("FDD") { + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + /* > FDD >> FDD Info */ + F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* >>> UL NRFreqInfo */ + fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; + + F1AP_FreqBandNrItem_t ul_freqBandNrItem; + memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + ul_freqBandNrItem.freqBandIndicatorNr = 888L; + + F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; + memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + + /* >>> DL NRFreqInfo */ + fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; + + F1AP_FreqBandNrItem_t dl_freqBandNrItem; + memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + dl_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; + memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + + /* >>> UL Transmission Bandwidth */ + fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + /* >>> DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.fDD = fDD_Info; + } else { // TDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + + /* > TDD >> TDD Info */ + F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + /* >>> ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + nr_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + + tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; + tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.tDD = tDD_Info; + } + + served_cell_information.nR_Mode_Info = nR_Mode_Info; + + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = "0"; // sept. 2018 + + OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + served_cells_to_modify_item.served_Cell_Information = served_cell_information; // + + /* 3.2.2 gNB-DU System Information */ + F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + "1", + sizeof("1")); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + "1", + sizeof("1")); + served_cells_to_modify_item.gNB_DU_System_Information = gNB_DU_System_Information; // + + /* ADD */ + served_cells_to_modify_item_ies->value.choice.Served_Cells_To_Modify_Item = served_cells_to_modify_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Modify_List.list, + served_cells_to_modify_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c4. Served_Cells_To_Delete */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List; + + for (i=0; + i<1; + i++) { + // + F1AP_Served_Cells_To_Delete_ItemIEs_t *served_cells_to_delete_item_ies; + served_cells_to_delete_item_ies = (F1AP_Served_Cells_To_Delete_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Delete_ItemIEs_t)); + served_cells_to_delete_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_Item; + served_cells_to_delete_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; + + F1AP_Served_Cells_To_Delete_Item_t served_cells_to_delete_item; + memset((void *)&served_cells_to_delete_item, 0, sizeof(F1AP_Served_Cells_To_Delete_Item_t)); + + /* 3.1 oldNRCGI */ + F1AP_NRCGI_t oldNRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &oldNRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); + served_cells_to_delete_item.oldNRCGI = oldNRCGI; + + /* ADD */ + served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item = served_cells_to_delete_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Delete_List.list, + served_cells_to_delete_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c5. Active_Cells_List */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Active_Cells_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Active_Cells_List; + + for (i=0; + i<1; + i++) { + // + F1AP_Active_Cells_ItemIEs_t *active_cells_item_ies; + active_cells_item_ies = (F1AP_Active_Cells_ItemIEs_t *)calloc(1, sizeof(F1AP_Active_Cells_ItemIEs_t)); + active_cells_item_ies->id = F1AP_ProtocolIE_ID_id_Active_Cells_Item; + active_cells_item_ies->criticality = F1AP_Criticality_reject; + active_cells_item_ies->value.present = F1AP_Active_Cells_ItemIEs__value_PR_Active_Cells_Item; + + F1AP_Active_Cells_Item_t active_cells_item; + memset((void *)&active_cells_item, 0, sizeof(F1AP_Active_Cells_Item_t)); + + /* 3.1 oldNRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + active_cells_item.nRCGI = nRCGI; + + /* ADD */ + active_cells_item_ies->value.choice.Active_Cells_Item = active_cells_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.Active_Cells_List.list, + active_cells_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + printf("\n"); + + //f1ap_du_send_message(buffer, len); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } } void DU_handle_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 04415a8386..230dc8eac8 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -366,14 +366,19 @@ rx_sdu(const module_id_t enb_mod_idP, for (ii = 0; ii < NB_RA_PROC_MAX; ii++) { ra = &mac->common_channels[CC_idP].ra[ii]; if ((ra->rnti == current_rnti) && (ra->state != IDLE)) { - mac_rrc_data_ind(enb_mod_idP, - CC_idP, - frameP, subframeP, - old_rnti, - DCCH, - (uint8_t *) payload_ptr, - rx_lengths[i], - 0); + //int RC.cudu.du_flag = 1; + int du_flag = 1; + mac_rrc_data_ind( + enb_mod_idP, + CC_idP, + frameP, subframeP, old_UE_id, + old_rnti, + DCCH, + (uint8_t *) payload_ptr, + rx_lengths[i], + 0, + du_flag + ); // prepare transmission of Msg4(RRCConnectionReconfiguration) ra->state = MSGCRNTI; LOG_I(MAC, @@ -612,15 +617,20 @@ rx_sdu(const module_id_t enb_mod_idP, rx_lengths[i], payload_ptr - sduP); // kill RA procedure } - - mac_rrc_data_ind(enb_mod_idP, + + //int RC.cudu.du_flag = 1; + int du_flag = 1; + mac_rrc_data_ind( + enb_mod_idP, CC_idP, - frameP, subframeP, + frameP, subframeP, UE_id, current_rnti, CCCH, (uint8_t *) payload_ptr, rx_lengths[i], - 0); + 0, + du_flag + ); if (num_ce > 0) { // handle msg3 which is not RRCConnectionRequest diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h index 4b651761de..f01721e182 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h @@ -47,14 +47,16 @@ mac_rrc_data_req( int8_t mac_rrc_data_ind( const module_id_t module_idP, - const int CC_idP, + const int CC_id, const frame_t frameP, const sub_frame_t sub_frameP, + const int UE_id, const rnti_t rntiP, const rb_id_t srb_idP, - const uint8_t *sduP, + const uint8_t* sduP, const sdu_size_t sdu_lenP, - const uint8_t mbsfn_sync_area + const uint8_t mbsfn_sync_areaP, + const int du_flag ); int8_t diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index a7c96a8a22..442a93d3cc 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -232,6 +232,33 @@ mac_rrc_data_req( return(0); } +//-------------------------------------------------------------------------- +int8_t +mac_du_data_ind( + const module_id_t module_idP, + const int CC_idP, + const int UE_id, + const rnti_t rntiP, + const uint8_t *sduP, + const sdu_size_t sdu_lenP +) +//-------------------------------------------------------------------------- +{ + printf( + "[F1 %d][RAPROC] CC_id %d current_rnti %x Received Msg3 from already registered UE %d: length %d, offset %ld\n", + module_idP, CC_idP, rntiP, + UE_id, sdu_lenP, sduP); + + DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( + module_idP, + CC_idP, + UE_id, + rntiP, + sduP, + sdu_lenP + ); +} + //------------------------------------------------------------------------------ int8_t mac_rrc_data_ind( @@ -239,14 +266,28 @@ mac_rrc_data_ind( const int CC_id, const frame_t frameP, const sub_frame_t sub_frameP, + const int UE_id, const rnti_t rntiP, const rb_id_t srb_idP, const uint8_t* sduP, const sdu_size_t sdu_lenP, - const uint8_t mbsfn_sync_areaP + const uint8_t mbsfn_sync_areaP, + const int du_flag ) //-------------------------------------------------------------------------- { + + // navid update / Bing-Kai modify + if (du_flag) { + mac_du_data_ind( + module_idP, + CC_id, + UE_id, + rntiP, + sduP, + sdu_lenP); + } + SRB_INFO *Srb_info; protocol_ctxt_t ctxt; sdu_size_t sdu_size = 0; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index b0b444084c..d1210799b2 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6446,6 +6446,7 @@ rrc_eNB_decode_ccch( rrc_eNB_generate_RRCConnectionReject(ctxt_pP, rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), CC_id); + // navid: break; } diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index e16391aef1..4e8ee304c1 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -420,14 +420,16 @@ mac_rrc_data_req( int8_t mac_rrc_data_ind( const module_id_t module_idP, - const int CC_id, + const int CC_id, const frame_t frameP, const sub_frame_t sub_frameP, + const int UE_id, const rnti_t rntiP, const rb_id_t srb_idP, const uint8_t* sduP, const sdu_size_t sdu_lenP, - const uint8_t mbsfn_sync_areaP + const uint8_t mbsfn_sync_areaP, + const int du_flag ); int8_t diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index abfe20c418..46328b4fc6 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -252,8 +252,21 @@ do { \ } while(0) +/* TS 38.473 v15.2.1 section 9.3.1.32: + * C RNTI + */ +#define C_RNTI_TO_BIT_STRING(mACRO, bITsTRING) \ +do { \ + (bITsTRING)->buf = calloc(2, sizeof(uint8_t)); \ + (bITsTRING)->buf[0] = (mACRO) >> 4; \ + (bITsTRING)->buf[1] = ((mACRO) & 0x0f) << 4; \ + (bITsTRING)->size = 2; \ + (bITsTRING)->bits_unused = 0; \ +} while(0) + + /* TS 38.473 v15.1.1 section 9.3.2.1: - * NR CELL ID + * TRANSPORT LAYER ADDRESS */ #define TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(mACRO, bITsTRING) \ do { \ -- GitLab From c56eb9eda797cda6ce372086e35a59e50d96d25c Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Tue, 4 Sep 2018 07:40:04 +0200 Subject: [PATCH 020/308] addition of configuration (DU) for F1AP and filling of F1AP_SET_REQ parameters --- common/ran_context.h | 3 + common/utils/T/T_IDs.h | 690 +++++------ common/utils/T/T_messages.txt | 32 +- openair2/COMMON/f1ap_messages_def.h | 65 +- openair2/COMMON/f1ap_messages_types.h | 755 +++-------- openair2/COMMON/mac_rrc_primitives.h | 2 +- openair2/COMMON/messages_def.h | 1 + openair2/COMMON/messages_types.h | 3 +- openair2/COMMON/rrc_messages_types.h | 1 + openair2/ENB_APP/enb_app.c | 61 +- openair2/ENB_APP/enb_config.c | 1652 +++++++++++++------------ openair2/ENB_APP/enb_config.h | 6 +- openair2/F1AP/DU_F1AP.c | 3 + openair2/F1AP/f1ap_common.h | 8 + openair2/LAYER2/MAC/mac.h | 1 + openair2/LAYER2/MAC/main.c | 4 +- openair2/RRC/LTE/rrc_defs.h | 5 + openair2/RRC/LTE/rrc_eNB.c | 524 ++++---- targets/RT/USER/lte-softmodem.c | 2 +- 19 files changed, 1812 insertions(+), 2006 deletions(-) diff --git a/common/ran_context.h b/common/ran_context.h index 343258cb1d..85c22467f6 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -53,6 +53,9 @@ #include "PHY/defs_L1_NB_IoT.h" #include "RRC/LTE/defs_NB_IoT.h" + + + typedef struct { /// RAN context config file name char *config_file_name; diff --git a/common/utils/T/T_IDs.h b/common/utils/T/T_IDs.h index 58b4307518..df37706186 100644 --- a/common/utils/T/T_IDs.h +++ b/common/utils/T/T_IDs.h @@ -199,348 +199,348 @@ #define T_LEGACY_CLI_WARNING T_ID(196) #define T_LEGACY_CLI_DEBUG T_ID(197) #define T_LEGACY_CLI_TRACE T_ID(198) -#define T_UE_MASTER_TICK T_ID(199) -#define T_UE_PHY_UL_TICK T_ID(200) -#define T_UE_PHY_DL_TICK T_ID(201) -#define T_UE_PHY_DLSCH_UE_DCI T_ID(202) -#define T_UE_PHY_DLSCH_UE_ACK T_ID(203) -#define T_UE_PHY_DLSCH_UE_NACK T_ID(204) -#define T_UE_PHY_ULSCH_UE_DCI T_ID(205) -#define T_UE_PHY_ULSCH_UE_ACK T_ID(206) -#define T_UE_PHY_ULSCH_UE_NACK T_ID(207) -#define T_UE_PHY_INPUT_SIGNAL T_ID(208) -#define T_UE_PHY_DL_CHANNEL_ESTIMATE T_ID(209) -#define T_UE_PHY_PDCCH_IQ T_ID(210) -#define T_UE_PHY_PDCCH_ENERGY T_ID(211) -#define T_UE_PHY_PDSCH_IQ T_ID(212) -#define T_UE_PHY_PDSCH_ENERGY T_ID(213) -#define T_UE_PHY_PUSCH_TX_POWER T_ID(214) -#define T_UE_PHY_PUCCH_TX_POWER T_ID(215) -#define T_UE_PHY_MEAS T_ID(216) -#define T_first T_ID(217) -#define T_buf_test T_ID(218) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_ENB T_ID(219) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_ENB T_ID(220) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_ENB T_ID(221) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_ENB T_ID(222) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_ENB T_ID(223) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_ENB T_ID(224) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_ENB T_ID(225) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_ENB T_ID(226) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_RU T_ID(227) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_RU T_ID(228) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_RU T_ID(229) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_RU T_ID(230) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_RU T_ID(231) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_RU T_ID(232) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_RU T_ID(233) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_RU T_ID(234) -#define T_VCD_VARIABLE_RUNTIME_TX_ENB T_ID(235) -#define T_VCD_VARIABLE_RUNTIME_RX_ENB T_ID(236) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_UE T_ID(237) -#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_UE T_ID(238) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_UE T_ID(239) -#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_UE T_ID(240) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_UE T_ID(241) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_UE T_ID(242) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_UE T_ID(243) -#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_UE T_ID(244) -#define T_VCD_VARIABLE_UE_RX_OFFSET T_ID(245) -#define T_VCD_VARIABLE_DIFF T_ID(246) -#define T_VCD_VARIABLE_HW_SUBFRAME T_ID(247) -#define T_VCD_VARIABLE_HW_FRAME T_ID(248) -#define T_VCD_VARIABLE_HW_SUBFRAME_RX T_ID(249) -#define T_VCD_VARIABLE_HW_FRAME_RX T_ID(250) -#define T_VCD_VARIABLE_TXCNT T_ID(251) -#define T_VCD_VARIABLE_RXCNT T_ID(252) -#define T_VCD_VARIABLE_TRX_TS T_ID(253) -#define T_VCD_VARIABLE_TRX_TST T_ID(254) -#define T_VCD_VARIABLE_TRX_TS_UE T_ID(255) -#define T_VCD_VARIABLE_TRX_TST_UE T_ID(256) -#define T_VCD_VARIABLE_TRX_WRITE_FLAGS T_ID(257) -#define T_VCD_VARIABLE_TX_TS T_ID(258) -#define T_VCD_VARIABLE_RX_TS T_ID(259) -#define T_VCD_VARIABLE_RX_HWCNT T_ID(260) -#define T_VCD_VARIABLE_RX_LHWCNT T_ID(261) -#define T_VCD_VARIABLE_TX_HWCNT T_ID(262) -#define T_VCD_VARIABLE_TX_LHWCNT T_ID(263) -#define T_VCD_VARIABLE_RX_PCK T_ID(264) -#define T_VCD_VARIABLE_TX_PCK T_ID(265) -#define T_VCD_VARIABLE_RX_SEQ_NUM T_ID(266) -#define T_VCD_VARIABLE_RX_SEQ_NUM_PRV T_ID(267) -#define T_VCD_VARIABLE_TX_SEQ_NUM T_ID(268) -#define T_VCD_VARIABLE_CNT T_ID(269) -#define T_VCD_VARIABLE_DUMMY_DUMP T_ID(270) -#define T_VCD_VARIABLE_ITTI_SEND_MSG T_ID(271) -#define T_VCD_VARIABLE_ITTI_POLL_MSG T_ID(272) -#define T_VCD_VARIABLE_ITTI_RECV_MSG T_ID(273) -#define T_VCD_VARIABLE_ITTI_ALLOC_MSG T_ID(274) -#define T_VCD_VARIABLE_MP_ALLOC T_ID(275) -#define T_VCD_VARIABLE_MP_FREE T_ID(276) -#define T_VCD_VARIABLE_UE_INST_CNT_RX T_ID(277) -#define T_VCD_VARIABLE_UE_INST_CNT_TX T_ID(278) -#define T_VCD_VARIABLE_DCI_INFO T_ID(279) -#define T_VCD_VARIABLE_UE0_BSR T_ID(280) -#define T_VCD_VARIABLE_UE0_BO T_ID(281) -#define T_VCD_VARIABLE_UE0_SCHEDULED T_ID(282) -#define T_VCD_VARIABLE_UE0_TIMING_ADVANCE T_ID(283) -#define T_VCD_VARIABLE_UE0_SR_ENERGY T_ID(284) -#define T_VCD_VARIABLE_UE0_SR_THRES T_ID(285) -#define T_VCD_VARIABLE_UE0_RSSI0 T_ID(286) -#define T_VCD_VARIABLE_UE0_RSSI1 T_ID(287) -#define T_VCD_VARIABLE_UE0_RSSI2 T_ID(288) -#define T_VCD_VARIABLE_UE0_RSSI3 T_ID(289) -#define T_VCD_VARIABLE_UE0_RSSI4 T_ID(290) -#define T_VCD_VARIABLE_UE0_RSSI5 T_ID(291) -#define T_VCD_VARIABLE_UE0_RSSI6 T_ID(292) -#define T_VCD_VARIABLE_UE0_RSSI7 T_ID(293) -#define T_VCD_VARIABLE_UE0_RES0 T_ID(294) -#define T_VCD_VARIABLE_UE0_RES1 T_ID(295) -#define T_VCD_VARIABLE_UE0_RES2 T_ID(296) -#define T_VCD_VARIABLE_UE0_RES3 T_ID(297) -#define T_VCD_VARIABLE_UE0_RES4 T_ID(298) -#define T_VCD_VARIABLE_UE0_RES5 T_ID(299) -#define T_VCD_VARIABLE_UE0_RES6 T_ID(300) -#define T_VCD_VARIABLE_UE0_RES7 T_ID(301) -#define T_VCD_VARIABLE_UE0_MCS0 T_ID(302) -#define T_VCD_VARIABLE_UE0_MCS1 T_ID(303) -#define T_VCD_VARIABLE_UE0_MCS2 T_ID(304) -#define T_VCD_VARIABLE_UE0_MCS3 T_ID(305) -#define T_VCD_VARIABLE_UE0_MCS4 T_ID(306) -#define T_VCD_VARIABLE_UE0_MCS5 T_ID(307) -#define T_VCD_VARIABLE_UE0_MCS6 T_ID(308) -#define T_VCD_VARIABLE_UE0_MCS7 T_ID(309) -#define T_VCD_VARIABLE_UE0_RB0 T_ID(310) -#define T_VCD_VARIABLE_UE0_RB1 T_ID(311) -#define T_VCD_VARIABLE_UE0_RB2 T_ID(312) -#define T_VCD_VARIABLE_UE0_RB3 T_ID(313) -#define T_VCD_VARIABLE_UE0_RB4 T_ID(314) -#define T_VCD_VARIABLE_UE0_RB5 T_ID(315) -#define T_VCD_VARIABLE_UE0_RB6 T_ID(316) -#define T_VCD_VARIABLE_UE0_RB7 T_ID(317) -#define T_VCD_VARIABLE_UE0_ROUND0 T_ID(318) -#define T_VCD_VARIABLE_UE0_ROUND1 T_ID(319) -#define T_VCD_VARIABLE_UE0_ROUND2 T_ID(320) -#define T_VCD_VARIABLE_UE0_ROUND3 T_ID(321) -#define T_VCD_VARIABLE_UE0_ROUND4 T_ID(322) -#define T_VCD_VARIABLE_UE0_ROUND5 T_ID(323) -#define T_VCD_VARIABLE_UE0_ROUND6 T_ID(324) -#define T_VCD_VARIABLE_UE0_ROUND7 T_ID(325) -#define T_VCD_VARIABLE_UE0_SFN0 T_ID(326) -#define T_VCD_VARIABLE_UE0_SFN1 T_ID(327) -#define T_VCD_VARIABLE_UE0_SFN2 T_ID(328) -#define T_VCD_VARIABLE_UE0_SFN3 T_ID(329) -#define T_VCD_VARIABLE_UE0_SFN4 T_ID(330) -#define T_VCD_VARIABLE_UE0_SFN5 T_ID(331) -#define T_VCD_VARIABLE_UE0_SFN6 T_ID(332) -#define T_VCD_VARIABLE_UE0_SFN7 T_ID(333) -#define T_VCD_VARIABLE_SEND_IF4_SYMBOL T_ID(334) -#define T_VCD_VARIABLE_RECV_IF4_SYMBOL T_ID(335) -#define T_VCD_VARIABLE_SEND_IF5_PKT_ID T_ID(336) -#define T_VCD_VARIABLE_RECV_IF5_PKT_ID T_ID(337) -#define T_VCD_VARIABLE_UE_PDCP_FLUSH_SIZE T_ID(338) -#define T_VCD_VARIABLE_UE_PDCP_FLUSH_ERR T_ID(339) -#define T_VCD_VARIABLE_UE0_TRX_READ_NS T_ID(340) -#define T_VCD_VARIABLE_UE0_TRX_WRITE_NS T_ID(341) -#define T_VCD_VARIABLE_UE0_TRX_READ_NS_MISSING T_ID(342) -#define T_VCD_VARIABLE_UE0_TRX_WRITE_NS_MISSING T_ID(343) -#define T_VCD_VARIABLE_CPUID_ENB_THREAD_RXTX T_ID(344) -#define T_VCD_VARIABLE_CPUID_RU_THREAD T_ID(345) -#define T_VCD_VARIABLE_CPUID_RU_THREAD_TX T_ID(346) -#define T_VCD_FUNCTION_RT_SLEEP T_ID(347) -#define T_VCD_FUNCTION_TRX_READ T_ID(348) -#define T_VCD_FUNCTION_TRX_WRITE T_ID(349) -#define T_VCD_FUNCTION_TRX_READ_UE T_ID(350) -#define T_VCD_FUNCTION_TRX_WRITE_UE T_ID(351) -#define T_VCD_FUNCTION_TRX_READ_IF T_ID(352) -#define T_VCD_FUNCTION_TRX_WRITE_IF T_ID(353) -#define T_VCD_FUNCTION_eNB_PROC_RXTX0 T_ID(354) -#define T_VCD_FUNCTION_eNB_PROC_RXTX1 T_ID(355) -#define T_VCD_FUNCTION_UE_THREAD_SYNCH T_ID(356) -#define T_VCD_FUNCTION_UE_THREAD_RXTX0 T_ID(357) -#define T_VCD_FUNCTION_UE_THREAD_RXTX1 T_ID(358) -#define T_VCD_FUNCTION_TRX_READ_SF9 T_ID(359) -#define T_VCD_FUNCTION_TRX_WRITE_SF9 T_ID(360) -#define T_VCD_FUNCTION_UE_SIGNAL_COND_RXTX0 T_ID(361) -#define T_VCD_FUNCTION_UE_SIGNAL_COND_RXTX1 T_ID(362) -#define T_VCD_FUNCTION_UE_WAIT_COND_RXTX0 T_ID(363) -#define T_VCD_FUNCTION_UE_WAIT_COND_RXTX1 T_ID(364) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0 T_ID(365) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1 T_ID(366) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0 T_ID(367) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1 T_ID(368) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0 T_ID(369) -#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1 T_ID(370) -#define T_VCD_FUNCTION_SIM_DO_DL_SIGNAL T_ID(371) -#define T_VCD_FUNCTION_SIM_DO_UL_SIGNAL T_ID(372) -#define T_VCD_FUNCTION_SIM_UE_TRX_READ T_ID(373) -#define T_VCD_FUNCTION_eNB_TX T_ID(374) -#define T_VCD_FUNCTION_eNB_RX T_ID(375) -#define T_VCD_FUNCTION_eNB_TRX T_ID(376) -#define T_VCD_FUNCTION_eNB_TM T_ID(377) -#define T_VCD_FUNCTION_eNB_RX_SLEEP T_ID(378) -#define T_VCD_FUNCTION_eNB_TX_SLEEP T_ID(379) -#define T_VCD_FUNCTION_eNB_PROC_SLEEP T_ID(380) -#define T_VCD_FUNCTION_TRX_READ_RF T_ID(381) -#define T_VCD_FUNCTION_TRX_WRITE_RF T_ID(382) -#define T_VCD_FUNCTION_UE_SYNCH T_ID(383) -#define T_VCD_FUNCTION_UE_SLOT_FEP T_ID(384) -#define T_VCD_FUNCTION_UE_RRC_MEASUREMENTS T_ID(385) -#define T_VCD_FUNCTION_UE_GAIN_CONTROL T_ID(386) -#define T_VCD_FUNCTION_UE_ADJUST_SYNCH T_ID(387) -#define T_VCD_FUNCTION_UE_MEASUREMENT_PROCEDURES T_ID(388) -#define T_VCD_FUNCTION_UE_PDCCH_PROCEDURES T_ID(389) -#define T_VCD_FUNCTION_UE_PBCH_PROCEDURES T_ID(390) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_TX T_ID(391) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_TX1 T_ID(392) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX T_ID(393) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX1 T_ID(394) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM T_ID(395) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM1 T_ID(396) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC T_ID(397) -#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC1 T_ID(398) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC T_ID(399) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC1 T_ID(400) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX T_ID(401) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_RX T_ID(402) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC T_ID(403) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PUCCH T_ID(404) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_COMMON T_ID(405) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PRACH T_ID(406) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_RAR T_ID(407) -#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_LTE T_ID(408) -#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_LTE T_ID(409) -#define T_VCD_FUNCTION_PDSCH_THREAD T_ID(410) -#define T_VCD_FUNCTION_DLSCH_THREAD0 T_ID(411) -#define T_VCD_FUNCTION_DLSCH_THREAD1 T_ID(412) -#define T_VCD_FUNCTION_DLSCH_THREAD2 T_ID(413) -#define T_VCD_FUNCTION_DLSCH_THREAD3 T_ID(414) -#define T_VCD_FUNCTION_DLSCH_THREAD4 T_ID(415) -#define T_VCD_FUNCTION_DLSCH_THREAD5 T_ID(416) -#define T_VCD_FUNCTION_DLSCH_THREAD6 T_ID(417) -#define T_VCD_FUNCTION_DLSCH_THREAD7 T_ID(418) -#define T_VCD_FUNCTION_DLSCH_DECODING0 T_ID(419) -#define T_VCD_FUNCTION_DLSCH_DECODING1 T_ID(420) -#define T_VCD_FUNCTION_DLSCH_DECODING2 T_ID(421) -#define T_VCD_FUNCTION_DLSCH_DECODING3 T_ID(422) -#define T_VCD_FUNCTION_DLSCH_DECODING4 T_ID(423) -#define T_VCD_FUNCTION_DLSCH_DECODING5 T_ID(424) -#define T_VCD_FUNCTION_DLSCH_DECODING6 T_ID(425) -#define T_VCD_FUNCTION_DLSCH_DECODING7 T_ID(426) -#define T_VCD_FUNCTION_RX_PDCCH T_ID(427) -#define T_VCD_FUNCTION_DCI_DECODING T_ID(428) -#define T_VCD_FUNCTION_RX_PHICH T_ID(429) -#define T_VCD_FUNCTION_PDSCH_PROC T_ID(430) -#define T_VCD_FUNCTION_PDSCH_PROC_SI T_ID(431) -#define T_VCD_FUNCTION_PDSCH_PROC_P T_ID(432) -#define T_VCD_FUNCTION_PDSCH_PROC_RA T_ID(433) -#define T_VCD_FUNCTION_PHY_UE_CONFIG_SIB2 T_ID(434) -#define T_VCD_FUNCTION_PHY_CONFIG_SIB1_ENB T_ID(435) -#define T_VCD_FUNCTION_PHY_CONFIG_SIB2_ENB T_ID(436) -#define T_VCD_FUNCTION_PHY_CONFIG_DEDICATED_ENB T_ID(437) -#define T_VCD_FUNCTION_PHY_UE_COMPUTE_PRACH T_ID(438) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_MSG3 T_ID(439) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING0 T_ID(440) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING1 T_ID(441) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING2 T_ID(442) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING3 T_ID(443) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING4 T_ID(444) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING5 T_ID(445) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING6 T_ID(446) -#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING7 T_ID(447) -#define T_VCD_FUNCTION_PHY_ENB_SFGEN T_ID(448) -#define T_VCD_FUNCTION_PHY_ENB_PRACH_RX T_ID(449) -#define T_VCD_FUNCTION_PHY_RU_PRACH_RX T_ID(450) -#define T_VCD_FUNCTION_PHY_ENB_PDCCH_TX T_ID(451) -#define T_VCD_FUNCTION_PHY_ENB_RS_TX T_ID(452) -#define T_VCD_FUNCTION_UE_GENERATE_PRACH T_ID(453) -#define T_VCD_FUNCTION_UE_ULSCH_MODULATION T_ID(454) -#define T_VCD_FUNCTION_UE_ULSCH_ENCODING T_ID(455) -#define T_VCD_FUNCTION_UE_ULSCH_ENCODING_FILL_CQI T_ID(456) -#define T_VCD_FUNCTION_UE_ULSCH_SCRAMBLING T_ID(457) -#define T_VCD_FUNCTION_ENB_DLSCH_MODULATION T_ID(458) -#define T_VCD_FUNCTION_ENB_DLSCH_ENCODING T_ID(459) -#define T_VCD_FUNCTION_ENB_DLSCH_ENCODING_W T_ID(460) -#define T_VCD_FUNCTION_ENB_DLSCH_SCRAMBLING T_ID(461) -#define T_VCD_FUNCTION_ENB_BEAM_PRECODING T_ID(462) -#define T_VCD_FUNCTION_ENB_OFDM_MODULATION T_ID(463) -#define T_VCD_FUNCTION_MACPHY_INIT T_ID(464) -#define T_VCD_FUNCTION_MACPHY_EXIT T_ID(465) -#define T_VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER T_ID(466) -#define T_VCD_FUNCTION_FILL_RAR T_ID(467) -#define T_VCD_FUNCTION_TERMINATE_RA_PROC T_ID(468) -#define T_VCD_FUNCTION_INITIATE_RA_PROC T_ID(469) -#define T_VCD_FUNCTION_CANCEL_RA_PROC T_ID(470) -#define T_VCD_FUNCTION_GET_DCI_SDU T_ID(471) -#define T_VCD_FUNCTION_GET_DLSCH_SDU T_ID(472) -#define T_VCD_FUNCTION_RX_SDU T_ID(473) -#define T_VCD_FUNCTION_MRBCH_PHY_SYNC_FAILURE T_ID(474) -#define T_VCD_FUNCTION_SR_INDICATION T_ID(475) -#define T_VCD_FUNCTION_DLSCH_PREPROCESSOR T_ID(476) -#define T_VCD_FUNCTION_SCHEDULE_DLSCH T_ID(477) -#define T_VCD_FUNCTION_FILL_DLSCH_DCI T_ID(478) -#define T_VCD_FUNCTION_OUT_OF_SYNC_IND T_ID(479) -#define T_VCD_FUNCTION_UE_DECODE_SI T_ID(480) -#define T_VCD_FUNCTION_UE_DECODE_PCCH T_ID(481) -#define T_VCD_FUNCTION_UE_DECODE_CCCH T_ID(482) -#define T_VCD_FUNCTION_UE_DECODE_BCCH T_ID(483) -#define T_VCD_FUNCTION_UE_SEND_SDU T_ID(484) -#define T_VCD_FUNCTION_UE_GET_SDU T_ID(485) -#define T_VCD_FUNCTION_UE_GET_RACH T_ID(486) -#define T_VCD_FUNCTION_UE_PROCESS_RAR T_ID(487) -#define T_VCD_FUNCTION_UE_SCHEDULER T_ID(488) -#define T_VCD_FUNCTION_UE_GET_SR T_ID(489) -#define T_VCD_FUNCTION_UE_SEND_MCH_SDU T_ID(490) -#define T_VCD_FUNCTION_RLC_DATA_REQ T_ID(491) -#define T_VCD_FUNCTION_MAC_RLC_STATUS_IND T_ID(492) -#define T_VCD_FUNCTION_MAC_RLC_DATA_REQ T_ID(493) -#define T_VCD_FUNCTION_MAC_RLC_DATA_IND T_ID(494) -#define T_VCD_FUNCTION_RLC_UM_TRY_REASSEMBLY T_ID(495) -#define T_VCD_FUNCTION_RLC_UM_CHECK_TIMER_DAR_TIME_OUT T_ID(496) -#define T_VCD_FUNCTION_RLC_UM_RECEIVE_PROCESS_DAR T_ID(497) -#define T_VCD_FUNCTION_PDCP_RUN T_ID(498) -#define T_VCD_FUNCTION_PDCP_DATA_REQ T_ID(499) -#define T_VCD_FUNCTION_PDCP_DATA_IND T_ID(500) -#define T_VCD_FUNCTION_PDCP_APPLY_SECURITY T_ID(501) -#define T_VCD_FUNCTION_PDCP_VALIDATE_SECURITY T_ID(502) -#define T_VCD_FUNCTION_PDCP_FIFO_READ T_ID(503) -#define T_VCD_FUNCTION_PDCP_FIFO_READ_BUFFER T_ID(504) -#define T_VCD_FUNCTION_PDCP_FIFO_FLUSH T_ID(505) -#define T_VCD_FUNCTION_PDCP_FIFO_FLUSH_BUFFER T_ID(506) -#define T_VCD_FUNCTION_RRC_RX_TX T_ID(507) -#define T_VCD_FUNCTION_RRC_MAC_CONFIG T_ID(508) -#define T_VCD_FUNCTION_RRC_UE_DECODE_SIB1 T_ID(509) -#define T_VCD_FUNCTION_RRC_UE_DECODE_SI T_ID(510) -#define T_VCD_FUNCTION_GTPV1U_ENB_TASK T_ID(511) -#define T_VCD_FUNCTION_GTPV1U_PROCESS_UDP_REQ T_ID(512) -#define T_VCD_FUNCTION_GTPV1U_PROCESS_TUNNEL_DATA_REQ T_ID(513) -#define T_VCD_FUNCTION_UDP_ENB_TASK T_ID(514) -#define T_VCD_FUNCTION_EMU_TRANSPORT T_ID(515) -#define T_VCD_FUNCTION_LOG_RECORD T_ID(516) -#define T_VCD_FUNCTION_ITTI_ENQUEUE_MESSAGE T_ID(517) -#define T_VCD_FUNCTION_ITTI_DUMP_ENQUEUE_MESSAGE T_ID(518) -#define T_VCD_FUNCTION_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC T_ID(519) -#define T_VCD_FUNCTION_ITTI_RELAY_THREAD T_ID(520) -#define T_VCD_FUNCTION_TEST T_ID(521) -#define T_VCD_FUNCTION_SEND_IF4 T_ID(522) -#define T_VCD_FUNCTION_RECV_IF4 T_ID(523) -#define T_VCD_FUNCTION_SEND_IF5 T_ID(524) -#define T_VCD_FUNCTION_RECV_IF5 T_ID(525) -#define T_VCD_FUNCTION_TRX_COMPR_IF T_ID(526) -#define T_VCD_FUNCTION_TRX_DECOMPR_IF T_ID(527) -#define T_VCD_FUNCTION_NFAPI T_ID(528) -#define T_VCD_FUNCTION_GENERATE_PCFICH T_ID(529) -#define T_VCD_FUNCTION_GENERATE_DCI0 T_ID(530) -#define T_VCD_FUNCTION_GENERATE_DLSCH T_ID(531) -#define T_VCD_FUNCTION_GENERATE_PHICH T_ID(532) -#define T_VCD_FUNCTION_PDCCH_SCRAMBLING T_ID(533) -#define T_VCD_FUNCTION_PDCCH_MODULATION T_ID(534) -#define T_VCD_FUNCTION_PDCCH_INTERLEAVING T_ID(535) -#define T_VCD_FUNCTION_PDCCH_TX T_ID(536) -#define T_NUMBER_OF_IDS 537 - -#define T_LEGACY_PROTO_AGENT_DEBUG T_ID(538) -#define T_LEGACY_PROTO_AGENT_INFO T_ID(539) -#define T_LEGACY_PROTO_AGENT_ERROR T_ID(540) -#define T_LEGACY_F1U_ERROR T_ID(541) -#define T_LEGACY_F1U_DEBUG T_ID(542) +#define T_LEGACY_PROTO_AGENT_DEBUG T_ID(199) +#define T_LEGACY_PROTO_AGENT_INFO T_ID(200) +#define T_LEGACY_PROTO_AGENT_ERROR T_ID(201) +#define T_LEGACY_F1U_DEBUG T_ID(202) +#define T_LEGACY_F1U_INFO T_ID(203) +#define T_LEGACY_F1U_ERROR T_ID(204) +#define T_UE_MASTER_TICK T_ID(205) +#define T_UE_PHY_UL_TICK T_ID(206) +#define T_UE_PHY_DL_TICK T_ID(207) +#define T_UE_PHY_DLSCH_UE_DCI T_ID(208) +#define T_UE_PHY_DLSCH_UE_ACK T_ID(209) +#define T_UE_PHY_DLSCH_UE_NACK T_ID(210) +#define T_UE_PHY_ULSCH_UE_DCI T_ID(211) +#define T_UE_PHY_ULSCH_UE_ACK T_ID(212) +#define T_UE_PHY_ULSCH_UE_NACK T_ID(213) +#define T_UE_PHY_INPUT_SIGNAL T_ID(214) +#define T_UE_PHY_DL_CHANNEL_ESTIMATE T_ID(215) +#define T_UE_PHY_PDCCH_IQ T_ID(216) +#define T_UE_PHY_PDCCH_ENERGY T_ID(217) +#define T_UE_PHY_PDSCH_IQ T_ID(218) +#define T_UE_PHY_PDSCH_ENERGY T_ID(219) +#define T_UE_PHY_PUSCH_TX_POWER T_ID(220) +#define T_UE_PHY_PUCCH_TX_POWER T_ID(221) +#define T_UE_PHY_MEAS T_ID(222) +#define T_first T_ID(223) +#define T_buf_test T_ID(224) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_ENB T_ID(225) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_ENB T_ID(226) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_ENB T_ID(227) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_ENB T_ID(228) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_ENB T_ID(229) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_ENB T_ID(230) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_ENB T_ID(231) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_ENB T_ID(232) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_RU T_ID(233) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_RU T_ID(234) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_RU T_ID(235) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_RU T_ID(236) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_RU T_ID(237) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_RU T_ID(238) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_RU T_ID(239) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_RU T_ID(240) +#define T_VCD_VARIABLE_RUNTIME_TX_ENB T_ID(241) +#define T_VCD_VARIABLE_RUNTIME_RX_ENB T_ID(242) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX0_UE T_ID(243) +#define T_VCD_VARIABLE_FRAME_NUMBER_TX1_UE T_ID(244) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX0_UE T_ID(245) +#define T_VCD_VARIABLE_FRAME_NUMBER_RX1_UE T_ID(246) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX0_UE T_ID(247) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_TX1_UE T_ID(248) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX0_UE T_ID(249) +#define T_VCD_VARIABLE_SUBFRAME_NUMBER_RX1_UE T_ID(250) +#define T_VCD_VARIABLE_UE_RX_OFFSET T_ID(251) +#define T_VCD_VARIABLE_DIFF T_ID(252) +#define T_VCD_VARIABLE_HW_SUBFRAME T_ID(253) +#define T_VCD_VARIABLE_HW_FRAME T_ID(254) +#define T_VCD_VARIABLE_HW_SUBFRAME_RX T_ID(255) +#define T_VCD_VARIABLE_HW_FRAME_RX T_ID(256) +#define T_VCD_VARIABLE_TXCNT T_ID(257) +#define T_VCD_VARIABLE_RXCNT T_ID(258) +#define T_VCD_VARIABLE_TRX_TS T_ID(259) +#define T_VCD_VARIABLE_TRX_TST T_ID(260) +#define T_VCD_VARIABLE_TRX_TS_UE T_ID(261) +#define T_VCD_VARIABLE_TRX_TST_UE T_ID(262) +#define T_VCD_VARIABLE_TRX_WRITE_FLAGS T_ID(263) +#define T_VCD_VARIABLE_TX_TS T_ID(264) +#define T_VCD_VARIABLE_RX_TS T_ID(265) +#define T_VCD_VARIABLE_RX_HWCNT T_ID(266) +#define T_VCD_VARIABLE_RX_LHWCNT T_ID(267) +#define T_VCD_VARIABLE_TX_HWCNT T_ID(268) +#define T_VCD_VARIABLE_TX_LHWCNT T_ID(269) +#define T_VCD_VARIABLE_RX_PCK T_ID(270) +#define T_VCD_VARIABLE_TX_PCK T_ID(271) +#define T_VCD_VARIABLE_RX_SEQ_NUM T_ID(272) +#define T_VCD_VARIABLE_RX_SEQ_NUM_PRV T_ID(273) +#define T_VCD_VARIABLE_TX_SEQ_NUM T_ID(274) +#define T_VCD_VARIABLE_CNT T_ID(275) +#define T_VCD_VARIABLE_DUMMY_DUMP T_ID(276) +#define T_VCD_VARIABLE_ITTI_SEND_MSG T_ID(277) +#define T_VCD_VARIABLE_ITTI_POLL_MSG T_ID(278) +#define T_VCD_VARIABLE_ITTI_RECV_MSG T_ID(279) +#define T_VCD_VARIABLE_ITTI_ALLOC_MSG T_ID(280) +#define T_VCD_VARIABLE_MP_ALLOC T_ID(281) +#define T_VCD_VARIABLE_MP_FREE T_ID(282) +#define T_VCD_VARIABLE_UE_INST_CNT_RX T_ID(283) +#define T_VCD_VARIABLE_UE_INST_CNT_TX T_ID(284) +#define T_VCD_VARIABLE_DCI_INFO T_ID(285) +#define T_VCD_VARIABLE_UE0_BSR T_ID(286) +#define T_VCD_VARIABLE_UE0_BO T_ID(287) +#define T_VCD_VARIABLE_UE0_SCHEDULED T_ID(288) +#define T_VCD_VARIABLE_UE0_TIMING_ADVANCE T_ID(289) +#define T_VCD_VARIABLE_UE0_SR_ENERGY T_ID(290) +#define T_VCD_VARIABLE_UE0_SR_THRES T_ID(291) +#define T_VCD_VARIABLE_UE0_RSSI0 T_ID(292) +#define T_VCD_VARIABLE_UE0_RSSI1 T_ID(293) +#define T_VCD_VARIABLE_UE0_RSSI2 T_ID(294) +#define T_VCD_VARIABLE_UE0_RSSI3 T_ID(295) +#define T_VCD_VARIABLE_UE0_RSSI4 T_ID(296) +#define T_VCD_VARIABLE_UE0_RSSI5 T_ID(297) +#define T_VCD_VARIABLE_UE0_RSSI6 T_ID(298) +#define T_VCD_VARIABLE_UE0_RSSI7 T_ID(299) +#define T_VCD_VARIABLE_UE0_RES0 T_ID(300) +#define T_VCD_VARIABLE_UE0_RES1 T_ID(301) +#define T_VCD_VARIABLE_UE0_RES2 T_ID(302) +#define T_VCD_VARIABLE_UE0_RES3 T_ID(303) +#define T_VCD_VARIABLE_UE0_RES4 T_ID(304) +#define T_VCD_VARIABLE_UE0_RES5 T_ID(305) +#define T_VCD_VARIABLE_UE0_RES6 T_ID(306) +#define T_VCD_VARIABLE_UE0_RES7 T_ID(307) +#define T_VCD_VARIABLE_UE0_MCS0 T_ID(308) +#define T_VCD_VARIABLE_UE0_MCS1 T_ID(309) +#define T_VCD_VARIABLE_UE0_MCS2 T_ID(310) +#define T_VCD_VARIABLE_UE0_MCS3 T_ID(311) +#define T_VCD_VARIABLE_UE0_MCS4 T_ID(312) +#define T_VCD_VARIABLE_UE0_MCS5 T_ID(313) +#define T_VCD_VARIABLE_UE0_MCS6 T_ID(314) +#define T_VCD_VARIABLE_UE0_MCS7 T_ID(315) +#define T_VCD_VARIABLE_UE0_RB0 T_ID(316) +#define T_VCD_VARIABLE_UE0_RB1 T_ID(317) +#define T_VCD_VARIABLE_UE0_RB2 T_ID(318) +#define T_VCD_VARIABLE_UE0_RB3 T_ID(319) +#define T_VCD_VARIABLE_UE0_RB4 T_ID(320) +#define T_VCD_VARIABLE_UE0_RB5 T_ID(321) +#define T_VCD_VARIABLE_UE0_RB6 T_ID(322) +#define T_VCD_VARIABLE_UE0_RB7 T_ID(323) +#define T_VCD_VARIABLE_UE0_ROUND0 T_ID(324) +#define T_VCD_VARIABLE_UE0_ROUND1 T_ID(325) +#define T_VCD_VARIABLE_UE0_ROUND2 T_ID(326) +#define T_VCD_VARIABLE_UE0_ROUND3 T_ID(327) +#define T_VCD_VARIABLE_UE0_ROUND4 T_ID(328) +#define T_VCD_VARIABLE_UE0_ROUND5 T_ID(329) +#define T_VCD_VARIABLE_UE0_ROUND6 T_ID(330) +#define T_VCD_VARIABLE_UE0_ROUND7 T_ID(331) +#define T_VCD_VARIABLE_UE0_SFN0 T_ID(332) +#define T_VCD_VARIABLE_UE0_SFN1 T_ID(333) +#define T_VCD_VARIABLE_UE0_SFN2 T_ID(334) +#define T_VCD_VARIABLE_UE0_SFN3 T_ID(335) +#define T_VCD_VARIABLE_UE0_SFN4 T_ID(336) +#define T_VCD_VARIABLE_UE0_SFN5 T_ID(337) +#define T_VCD_VARIABLE_UE0_SFN6 T_ID(338) +#define T_VCD_VARIABLE_UE0_SFN7 T_ID(339) +#define T_VCD_VARIABLE_SEND_IF4_SYMBOL T_ID(340) +#define T_VCD_VARIABLE_RECV_IF4_SYMBOL T_ID(341) +#define T_VCD_VARIABLE_SEND_IF5_PKT_ID T_ID(342) +#define T_VCD_VARIABLE_RECV_IF5_PKT_ID T_ID(343) +#define T_VCD_VARIABLE_UE_PDCP_FLUSH_SIZE T_ID(344) +#define T_VCD_VARIABLE_UE_PDCP_FLUSH_ERR T_ID(345) +#define T_VCD_VARIABLE_UE0_TRX_READ_NS T_ID(346) +#define T_VCD_VARIABLE_UE0_TRX_WRITE_NS T_ID(347) +#define T_VCD_VARIABLE_UE0_TRX_READ_NS_MISSING T_ID(348) +#define T_VCD_VARIABLE_UE0_TRX_WRITE_NS_MISSING T_ID(349) +#define T_VCD_VARIABLE_CPUID_ENB_THREAD_RXTX T_ID(350) +#define T_VCD_VARIABLE_CPUID_RU_THREAD T_ID(351) +#define T_VCD_VARIABLE_CPUID_RU_THREAD_TX T_ID(352) +#define T_VCD_FUNCTION_RT_SLEEP T_ID(353) +#define T_VCD_FUNCTION_TRX_READ T_ID(354) +#define T_VCD_FUNCTION_TRX_WRITE T_ID(355) +#define T_VCD_FUNCTION_TRX_READ_UE T_ID(356) +#define T_VCD_FUNCTION_TRX_WRITE_UE T_ID(357) +#define T_VCD_FUNCTION_TRX_READ_IF T_ID(358) +#define T_VCD_FUNCTION_TRX_WRITE_IF T_ID(359) +#define T_VCD_FUNCTION_eNB_PROC_RXTX0 T_ID(360) +#define T_VCD_FUNCTION_eNB_PROC_RXTX1 T_ID(361) +#define T_VCD_FUNCTION_UE_THREAD_SYNCH T_ID(362) +#define T_VCD_FUNCTION_UE_THREAD_RXTX0 T_ID(363) +#define T_VCD_FUNCTION_UE_THREAD_RXTX1 T_ID(364) +#define T_VCD_FUNCTION_TRX_READ_SF9 T_ID(365) +#define T_VCD_FUNCTION_TRX_WRITE_SF9 T_ID(366) +#define T_VCD_FUNCTION_UE_SIGNAL_COND_RXTX0 T_ID(367) +#define T_VCD_FUNCTION_UE_SIGNAL_COND_RXTX1 T_ID(368) +#define T_VCD_FUNCTION_UE_WAIT_COND_RXTX0 T_ID(369) +#define T_VCD_FUNCTION_UE_WAIT_COND_RXTX1 T_ID(370) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0 T_ID(371) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1 T_ID(372) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0 T_ID(373) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1 T_ID(374) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0 T_ID(375) +#define T_VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1 T_ID(376) +#define T_VCD_FUNCTION_SIM_DO_DL_SIGNAL T_ID(377) +#define T_VCD_FUNCTION_SIM_DO_UL_SIGNAL T_ID(378) +#define T_VCD_FUNCTION_SIM_UE_TRX_READ T_ID(379) +#define T_VCD_FUNCTION_eNB_TX T_ID(380) +#define T_VCD_FUNCTION_eNB_RX T_ID(381) +#define T_VCD_FUNCTION_eNB_TRX T_ID(382) +#define T_VCD_FUNCTION_eNB_TM T_ID(383) +#define T_VCD_FUNCTION_eNB_RX_SLEEP T_ID(384) +#define T_VCD_FUNCTION_eNB_TX_SLEEP T_ID(385) +#define T_VCD_FUNCTION_eNB_PROC_SLEEP T_ID(386) +#define T_VCD_FUNCTION_TRX_READ_RF T_ID(387) +#define T_VCD_FUNCTION_TRX_WRITE_RF T_ID(388) +#define T_VCD_FUNCTION_UE_SYNCH T_ID(389) +#define T_VCD_FUNCTION_UE_SLOT_FEP T_ID(390) +#define T_VCD_FUNCTION_UE_RRC_MEASUREMENTS T_ID(391) +#define T_VCD_FUNCTION_UE_GAIN_CONTROL T_ID(392) +#define T_VCD_FUNCTION_UE_ADJUST_SYNCH T_ID(393) +#define T_VCD_FUNCTION_UE_MEASUREMENT_PROCEDURES T_ID(394) +#define T_VCD_FUNCTION_UE_PDCCH_PROCEDURES T_ID(395) +#define T_VCD_FUNCTION_UE_PBCH_PROCEDURES T_ID(396) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_TX T_ID(397) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_TX1 T_ID(398) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX T_ID(399) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX1 T_ID(400) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM T_ID(401) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM1 T_ID(402) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC T_ID(403) +#define T_VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC1 T_ID(404) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC T_ID(405) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC1 T_ID(406) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX T_ID(407) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_RX T_ID(408) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC T_ID(409) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PUCCH T_ID(410) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_COMMON T_ID(411) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PRACH T_ID(412) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_RAR T_ID(413) +#define T_VCD_FUNCTION_PHY_PROCEDURES_ENB_LTE T_ID(414) +#define T_VCD_FUNCTION_PHY_PROCEDURES_UE_LTE T_ID(415) +#define T_VCD_FUNCTION_PDSCH_THREAD T_ID(416) +#define T_VCD_FUNCTION_DLSCH_THREAD0 T_ID(417) +#define T_VCD_FUNCTION_DLSCH_THREAD1 T_ID(418) +#define T_VCD_FUNCTION_DLSCH_THREAD2 T_ID(419) +#define T_VCD_FUNCTION_DLSCH_THREAD3 T_ID(420) +#define T_VCD_FUNCTION_DLSCH_THREAD4 T_ID(421) +#define T_VCD_FUNCTION_DLSCH_THREAD5 T_ID(422) +#define T_VCD_FUNCTION_DLSCH_THREAD6 T_ID(423) +#define T_VCD_FUNCTION_DLSCH_THREAD7 T_ID(424) +#define T_VCD_FUNCTION_DLSCH_DECODING0 T_ID(425) +#define T_VCD_FUNCTION_DLSCH_DECODING1 T_ID(426) +#define T_VCD_FUNCTION_DLSCH_DECODING2 T_ID(427) +#define T_VCD_FUNCTION_DLSCH_DECODING3 T_ID(428) +#define T_VCD_FUNCTION_DLSCH_DECODING4 T_ID(429) +#define T_VCD_FUNCTION_DLSCH_DECODING5 T_ID(430) +#define T_VCD_FUNCTION_DLSCH_DECODING6 T_ID(431) +#define T_VCD_FUNCTION_DLSCH_DECODING7 T_ID(432) +#define T_VCD_FUNCTION_RX_PDCCH T_ID(433) +#define T_VCD_FUNCTION_DCI_DECODING T_ID(434) +#define T_VCD_FUNCTION_RX_PHICH T_ID(435) +#define T_VCD_FUNCTION_PDSCH_PROC T_ID(436) +#define T_VCD_FUNCTION_PDSCH_PROC_SI T_ID(437) +#define T_VCD_FUNCTION_PDSCH_PROC_P T_ID(438) +#define T_VCD_FUNCTION_PDSCH_PROC_RA T_ID(439) +#define T_VCD_FUNCTION_PHY_UE_CONFIG_SIB2 T_ID(440) +#define T_VCD_FUNCTION_PHY_CONFIG_SIB1_ENB T_ID(441) +#define T_VCD_FUNCTION_PHY_CONFIG_SIB2_ENB T_ID(442) +#define T_VCD_FUNCTION_PHY_CONFIG_DEDICATED_ENB T_ID(443) +#define T_VCD_FUNCTION_PHY_UE_COMPUTE_PRACH T_ID(444) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_MSG3 T_ID(445) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING0 T_ID(446) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING1 T_ID(447) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING2 T_ID(448) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING3 T_ID(449) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING4 T_ID(450) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING5 T_ID(451) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING6 T_ID(452) +#define T_VCD_FUNCTION_PHY_ENB_ULSCH_DECODING7 T_ID(453) +#define T_VCD_FUNCTION_PHY_ENB_SFGEN T_ID(454) +#define T_VCD_FUNCTION_PHY_ENB_PRACH_RX T_ID(455) +#define T_VCD_FUNCTION_PHY_RU_PRACH_RX T_ID(456) +#define T_VCD_FUNCTION_PHY_ENB_PDCCH_TX T_ID(457) +#define T_VCD_FUNCTION_PHY_ENB_RS_TX T_ID(458) +#define T_VCD_FUNCTION_UE_GENERATE_PRACH T_ID(459) +#define T_VCD_FUNCTION_UE_ULSCH_MODULATION T_ID(460) +#define T_VCD_FUNCTION_UE_ULSCH_ENCODING T_ID(461) +#define T_VCD_FUNCTION_UE_ULSCH_ENCODING_FILL_CQI T_ID(462) +#define T_VCD_FUNCTION_UE_ULSCH_SCRAMBLING T_ID(463) +#define T_VCD_FUNCTION_ENB_DLSCH_MODULATION T_ID(464) +#define T_VCD_FUNCTION_ENB_DLSCH_ENCODING T_ID(465) +#define T_VCD_FUNCTION_ENB_DLSCH_ENCODING_W T_ID(466) +#define T_VCD_FUNCTION_ENB_DLSCH_SCRAMBLING T_ID(467) +#define T_VCD_FUNCTION_ENB_BEAM_PRECODING T_ID(468) +#define T_VCD_FUNCTION_ENB_OFDM_MODULATION T_ID(469) +#define T_VCD_FUNCTION_MACPHY_INIT T_ID(470) +#define T_VCD_FUNCTION_MACPHY_EXIT T_ID(471) +#define T_VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER T_ID(472) +#define T_VCD_FUNCTION_FILL_RAR T_ID(473) +#define T_VCD_FUNCTION_TERMINATE_RA_PROC T_ID(474) +#define T_VCD_FUNCTION_INITIATE_RA_PROC T_ID(475) +#define T_VCD_FUNCTION_CANCEL_RA_PROC T_ID(476) +#define T_VCD_FUNCTION_GET_DCI_SDU T_ID(477) +#define T_VCD_FUNCTION_GET_DLSCH_SDU T_ID(478) +#define T_VCD_FUNCTION_RX_SDU T_ID(479) +#define T_VCD_FUNCTION_MRBCH_PHY_SYNC_FAILURE T_ID(480) +#define T_VCD_FUNCTION_SR_INDICATION T_ID(481) +#define T_VCD_FUNCTION_DLSCH_PREPROCESSOR T_ID(482) +#define T_VCD_FUNCTION_SCHEDULE_DLSCH T_ID(483) +#define T_VCD_FUNCTION_FILL_DLSCH_DCI T_ID(484) +#define T_VCD_FUNCTION_OUT_OF_SYNC_IND T_ID(485) +#define T_VCD_FUNCTION_UE_DECODE_SI T_ID(486) +#define T_VCD_FUNCTION_UE_DECODE_PCCH T_ID(487) +#define T_VCD_FUNCTION_UE_DECODE_CCCH T_ID(488) +#define T_VCD_FUNCTION_UE_DECODE_BCCH T_ID(489) +#define T_VCD_FUNCTION_UE_SEND_SDU T_ID(490) +#define T_VCD_FUNCTION_UE_GET_SDU T_ID(491) +#define T_VCD_FUNCTION_UE_GET_RACH T_ID(492) +#define T_VCD_FUNCTION_UE_PROCESS_RAR T_ID(493) +#define T_VCD_FUNCTION_UE_SCHEDULER T_ID(494) +#define T_VCD_FUNCTION_UE_GET_SR T_ID(495) +#define T_VCD_FUNCTION_UE_SEND_MCH_SDU T_ID(496) +#define T_VCD_FUNCTION_RLC_DATA_REQ T_ID(497) +#define T_VCD_FUNCTION_MAC_RLC_STATUS_IND T_ID(498) +#define T_VCD_FUNCTION_MAC_RLC_DATA_REQ T_ID(499) +#define T_VCD_FUNCTION_MAC_RLC_DATA_IND T_ID(500) +#define T_VCD_FUNCTION_RLC_UM_TRY_REASSEMBLY T_ID(501) +#define T_VCD_FUNCTION_RLC_UM_CHECK_TIMER_DAR_TIME_OUT T_ID(502) +#define T_VCD_FUNCTION_RLC_UM_RECEIVE_PROCESS_DAR T_ID(503) +#define T_VCD_FUNCTION_PDCP_RUN T_ID(504) +#define T_VCD_FUNCTION_PDCP_DATA_REQ T_ID(505) +#define T_VCD_FUNCTION_PDCP_DATA_IND T_ID(506) +#define T_VCD_FUNCTION_PDCP_APPLY_SECURITY T_ID(507) +#define T_VCD_FUNCTION_PDCP_VALIDATE_SECURITY T_ID(508) +#define T_VCD_FUNCTION_PDCP_FIFO_READ T_ID(509) +#define T_VCD_FUNCTION_PDCP_FIFO_READ_BUFFER T_ID(510) +#define T_VCD_FUNCTION_PDCP_FIFO_FLUSH T_ID(511) +#define T_VCD_FUNCTION_PDCP_FIFO_FLUSH_BUFFER T_ID(512) +#define T_VCD_FUNCTION_RRC_RX_TX T_ID(513) +#define T_VCD_FUNCTION_RRC_MAC_CONFIG T_ID(514) +#define T_VCD_FUNCTION_RRC_UE_DECODE_SIB1 T_ID(515) +#define T_VCD_FUNCTION_RRC_UE_DECODE_SI T_ID(516) +#define T_VCD_FUNCTION_GTPV1U_ENB_TASK T_ID(517) +#define T_VCD_FUNCTION_GTPV1U_PROCESS_UDP_REQ T_ID(518) +#define T_VCD_FUNCTION_GTPV1U_PROCESS_TUNNEL_DATA_REQ T_ID(519) +#define T_VCD_FUNCTION_UDP_ENB_TASK T_ID(520) +#define T_VCD_FUNCTION_EMU_TRANSPORT T_ID(521) +#define T_VCD_FUNCTION_LOG_RECORD T_ID(522) +#define T_VCD_FUNCTION_ITTI_ENQUEUE_MESSAGE T_ID(523) +#define T_VCD_FUNCTION_ITTI_DUMP_ENQUEUE_MESSAGE T_ID(524) +#define T_VCD_FUNCTION_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC T_ID(525) +#define T_VCD_FUNCTION_ITTI_RELAY_THREAD T_ID(526) +#define T_VCD_FUNCTION_TEST T_ID(527) +#define T_VCD_FUNCTION_SEND_IF4 T_ID(528) +#define T_VCD_FUNCTION_RECV_IF4 T_ID(529) +#define T_VCD_FUNCTION_SEND_IF5 T_ID(530) +#define T_VCD_FUNCTION_RECV_IF5 T_ID(531) +#define T_VCD_FUNCTION_TRX_COMPR_IF T_ID(532) +#define T_VCD_FUNCTION_TRX_DECOMPR_IF T_ID(533) +#define T_VCD_FUNCTION_NFAPI T_ID(534) +#define T_VCD_FUNCTION_GENERATE_PCFICH T_ID(535) +#define T_VCD_FUNCTION_GENERATE_DCI0 T_ID(536) +#define T_VCD_FUNCTION_GENERATE_DLSCH T_ID(537) +#define T_VCD_FUNCTION_GENERATE_PHICH T_ID(538) +#define T_VCD_FUNCTION_PDCCH_SCRAMBLING T_ID(539) +#define T_VCD_FUNCTION_PDCCH_MODULATION T_ID(540) +#define T_VCD_FUNCTION_PDCCH_INTERLEAVING T_ID(541) +#define T_VCD_FUNCTION_PDCCH_TX T_ID(542) +#define T_NUMBER_OF_IDS 543 diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 676f329a0e..ccac7de253 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -621,7 +621,7 @@ ID = LEGACY_OCM_DEBUG FORMAT = string,log ID = LEGACY_OCM_TRACE DESC = OCM legacy logs - trace level - GROUP = ALL:LEGACY_OCM:LEGACY_GROUP_TRACE:LEGACY + OGROUP = ALL:LEGACY_OCM:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log ID = LEGACY_OIP_INFO @@ -838,6 +838,36 @@ ID = LEGACY_CLI_TRACE GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log +ID = LEGACY_PROTO_AGENT_DEBUG + DESC = PROTO AGENT DEBUG LEVEL + GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log + +ID = LEGACY_PROTO_AGENT_INFO + DESC = PROTO AGENT INFO LEVEL + GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log + +ID = LEGACY_PROTO_AGENT_ERROR + DESC = PROTO AGENT ERROR LEVEL + GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log + +ID = LEGACY_F1U_DEBUG + DESC = F1U DEBUG LEVEL + GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log + +ID = LEGACY_F1U_INFO + DESC = F1U INFO LEVEL + GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log + +ID = LEGACY_F1U_ERROR + DESC = F1U ERROR LEVEL + GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log + ################# #### UE LOGS #### ################# diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index d81bd87ed5..67a803face 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -19,59 +19,22 @@ * contact@openairinterface.org */ -/* Messages for S1AP logging */ -MESSAGE_DEF(S1AP_UPLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_uplink_nas_log) -MESSAGE_DEF(S1AP_UE_CAPABILITY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_capability_ind_log) -MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_initial_context_setup_log) -MESSAGE_DEF(S1AP_NAS_NON_DELIVERY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_nas_non_delivery_ind_log) -MESSAGE_DEF(S1AP_DOWNLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_downlink_nas_log) -MESSAGE_DEF(S1AP_S1_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_s1_setup_log) -MESSAGE_DEF(S1AP_INITIAL_UE_MESSAGE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_initial_ue_message_log) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_req_log) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_command_log) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_complete_log) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_log) -MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_setup_request_log) -MESSAGE_DEF(S1AP_E_RAB_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_setup_response_log) -MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_modify_request_log) -MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_modify_response_log) -MESSAGE_DEF(S1AP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_paging_log) -MESSAGE_DEF(S1AP_E_RAB_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_request_log) -MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_response_log) -MESSAGE_DEF(S1AP_E_RAB_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_error_indication_log) +/* eNB application layer -> F1AP messages */ +MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req) -/* eNB application layer -> S1AP messages */ -MESSAGE_DEF(S1AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, s1ap_register_enb_req_t , s1ap_register_enb_req) +/* F1AP -> eNB application layer messages */ +MESSAGE_DEF(F1AP_SETUP_RESP , MESSAGE_PRIORITY_MED, f1ap_setup_resp_t , f1ap_setup_resp) +MESSAGE_DEF(F1AP_SETUP_FAILURE , MESSAGE_PRIORITY_MED, f1ap_setup_failure_t , f1ap_setup_failure) -/* S1AP -> eNB application layer messages */ -MESSAGE_DEF(S1AP_REGISTER_ENB_CNF , MESSAGE_PRIORITY_MED, s1ap_register_enb_cnf_t , s1ap_register_enb_cnf) -MESSAGE_DEF(S1AP_DEREGISTERED_ENB_IND , MESSAGE_PRIORITY_MED, s1ap_deregistered_enb_ind_t , s1ap_deregistered_enb_ind) +/* MAC -> F1AP messages */ +MESSAGE_DEF(F1AP_INITIAL_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_initial_ul_rrc_message_t , f1ap_initial_ul_rrc_message) +MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_rrc_message_t , f1ap_ul_rrc_message) +//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_resp_t, f1ap_initial_context_setup_resp) +//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_FAILURE, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_failure_t, f1ap_initial_context_setup_failure) -/* RRC -> S1AP messages */ -MESSAGE_DEF(S1AP_NAS_FIRST_REQ , MESSAGE_PRIORITY_MED, s1ap_nas_first_req_t , s1ap_nas_first_req) -MESSAGE_DEF(S1AP_UPLINK_NAS , MESSAGE_PRIORITY_MED, s1ap_uplink_nas_t , s1ap_uplink_nas) -MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND , MESSAGE_PRIORITY_MED, s1ap_ue_cap_info_ind_t , s1ap_ue_cap_info_ind) -MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, s1ap_initial_context_setup_resp_t, s1ap_initial_context_setup_resp) -MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_FAIL, MESSAGE_PRIORITY_MED, s1ap_initial_context_setup_fail_t, s1ap_initial_context_setup_fail) -MESSAGE_DEF(S1AP_NAS_NON_DELIVERY_IND , MESSAGE_PRIORITY_MED, s1ap_nas_non_delivery_ind_t , s1ap_nas_non_delivery_ind) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_RESP , MESSAGE_PRIORITY_MED, s1ap_ue_release_resp_t , s1ap_ue_release_resp) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, s1ap_ue_release_complete_t , s1ap_ue_release_complete) -MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_resp_t , s1ap_ue_ctxt_modification_resp) -MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_fail_t , s1ap_ue_ctxt_modification_fail) -MESSAGE_DEF(S1AP_E_RAB_SETUP_RESP , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_resp_t , s1ap_e_rab_setup_resp) -MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_fail_t , s1ap_e_rab_setup_request_fail) -MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESP , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_resp_t , s1ap_e_rab_modify_resp) -MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_resp_t , s1ap_e_rab_release_resp) -/* S1AP -> RRC messages */ -MESSAGE_DEF(S1AP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, s1ap_downlink_nas_t , s1ap_downlink_nas ) -MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_initial_context_setup_req_t , s1ap_initial_context_setup_req ) -MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_req_t , s1ap_ue_ctxt_modification_req) -MESSAGE_DEF(S1AP_PAGING_IND , MESSAGE_PRIORITY_MED, s1ap_paging_ind_t , s1ap_paging_ind ) -MESSAGE_DEF(S1AP_E_RAB_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_t , s1ap_e_rab_setup_req ) -MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQ , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_req_t , s1ap_e_rab_modify_req ) -MESSAGE_DEF(S1AP_E_RAB_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_command_t , s1ap_e_rab_release_command) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, s1ap_ue_release_command_t , s1ap_ue_release_command) +/* RRC -> F1AP messages */ +MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_downlink_rrc_message ) +//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req ) + -/* S1AP <-> RRC messages (can be initiated either by MME or eNB) */ -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ , MESSAGE_PRIORITY_MED, s1ap_ue_release_req_t , s1ap_ue_release_req) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 4a5f492b0b..61854e2048 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -19,628 +19,187 @@ * contact@openairinterface.org */ -#ifndef S1AP_MESSAGES_TYPES_H_ -#define S1AP_MESSAGES_TYPES_H_ +#ifndef F1AP_MESSAGES_TYPES_H_ +#define F1AP_MESSAGES_TYPES_H_ //-------------------------------------------------------------------------------------------// // Defines to access message fields. -#define S1AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_register_enb_req - -#define S1AP_REGISTER_ENB_CNF(mSGpTR) (mSGpTR)->ittiMsg.s1ap_register_enb_cnf -#define S1AP_DEREGISTERED_ENB_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_deregistered_enb_ind - -#define S1AP_NAS_FIRST_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_nas_first_req -#define S1AP_UPLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.s1ap_uplink_nas -#define S1AP_UE_CAPABILITIES_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_cap_info_ind -#define S1AP_INITIAL_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_initial_context_setup_resp -#define S1AP_INITIAL_CONTEXT_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_initial_context_setup_fail -#define S1AP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_resp -#define S1AP_NAS_NON_DELIVERY_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_nas_non_delivery_ind -#define S1AP_UE_CTXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_resp -#define S1AP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_fail -#define S1AP_E_RAB_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_resp -#define S1AP_E_RAB_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req_fail -#define S1AP_E_RAB_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_modify_resp - -#define S1AP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.s1ap_downlink_nas -#define S1AP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_initial_context_setup_req -#define S1AP_UE_CTXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_req -#define S1AP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_command -#define S1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_complete -#define S1AP_E_RAB_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req -#define S1AP_E_RAB_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_modify_req -#define S1AP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_paging_ind - -#define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_req -#define S1AP_E_RAB_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_release_command -#define S1AP_E_RAB_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_release_resp +#define F1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_req +#define F1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_resp +#define F1AP_SETUP_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_failure -//-------------------------------------------------------------------------------------------// -/* Maximum number of e-rabs to be setup/deleted in a single message. - * Even if only one bearer will be modified by message. - */ -#define S1AP_MAX_E_RAB 11 +#define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message +#define F1AP_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ul_rrc_message +#define F1AP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_resp +#define F1AP_UE_CONTEXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_resp +#define F1AP_UE_CONTEXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_fail + +#define F1AP_DL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_dl_rrc_message +#define F1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_req +#define F1AP_UE_CONTEXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_req /* Length of the transport layer address string * 160 bits / 8 bits by char. */ -#define S1AP_TRANSPORT_LAYER_ADDRESS_SIZE (160 / 8) +#define F1AP_TRANSPORT_LAYER_ADDRESS_SIZE (160 / 8) -#define S1AP_MAX_NB_MME_IP_ADDRESS 10 -#define S1AP_IMSI_LENGTH 16 +#define F1AP_MAX_NB_CU_IP_ADDRESS 10 -/* Security key length used within eNB - * Even if only 16 bytes will be effectively used, - * the key length is 32 bytes (256 bits) - */ -#define SECURITY_KEY_LENGTH 32 -#ifndef OCP_FRAMEWORK -typedef enum cell_type_e { - CELL_MACRO_ENB, - CELL_HOME_ENB -} cell_type_t; - -typedef enum paging_drx_e { - PAGING_DRX_32 = 0x0, - PAGING_DRX_64 = 0x1, - PAGING_DRX_128 = 0x2, - PAGING_DRX_256 = 0x3 -} paging_drx_t; - -/* Lower value codepoint - * indicates higher priority. - */ -typedef enum paging_priority_s { - PAGING_PRIO_LEVEL1 = 0, - PAGING_PRIO_LEVEL2 = 1, - PAGING_PRIO_LEVEL3 = 2, - PAGING_PRIO_LEVEL4 = 3, - PAGING_PRIO_LEVEL5 = 4, - PAGING_PRIO_LEVEL6 = 5, - PAGING_PRIO_LEVEL7 = 6, - PAGING_PRIO_LEVEL8 = 7 -} paging_priority_t; - -typedef enum cn_domain_s { - CN_DOMAIN_PS = 1, - CN_DOMAIN_CS = 2 -} cn_domain_t; -#endif - -typedef struct net_ip_address_s { - unsigned ipv4:1; - unsigned ipv6:1; - char ipv4_address[16]; - char ipv6_address[46]; -} net_ip_address_t; - -typedef uint64_t bitrate_t; - -typedef struct ambr_s { - bitrate_t br_ul; - bitrate_t br_dl; -} ambr_t; - -#ifndef OCP_FRAMEWORK -typedef enum priority_level_s { - PRIORITY_LEVEL_SPARE = 0, - PRIORITY_LEVEL_HIGHEST = 1, - PRIORITY_LEVEL_LOWEST = 14, - PRIORITY_LEVEL_NO_PRIORITY = 15 -} priority_level_t; - -typedef enum pre_emp_capability_e { - PRE_EMPTION_CAPABILITY_ENABLED = 0, - PRE_EMPTION_CAPABILITY_DISABLED = 1, - PRE_EMPTION_CAPABILITY_MAX, -} pre_emp_capability_t; - -typedef enum pre_emp_vulnerability_e { - PRE_EMPTION_VULNERABILITY_ENABLED = 0, - PRE_EMPTION_VULNERABILITY_DISABLED = 1, - PRE_EMPTION_VULNERABILITY_MAX, -} pre_emp_vulnerability_t; -#endif - -typedef struct allocation_retention_priority_s { - priority_level_t priority_level; - pre_emp_capability_t pre_emp_capability; - pre_emp_vulnerability_t pre_emp_vulnerability; -} allocation_retention_priority_t; - -typedef struct security_capabilities_s { - uint16_t encryption_algorithms; - uint16_t integrity_algorithms; -} security_capabilities_t; - -/* Provides the establishment cause for the RRC connection request as provided - * by the upper layers. W.r.t. the cause value names: highPriorityAccess - * concerns AC11..AC15, ‘mt’ stands for ‘Mobile Terminating’ and ‘mo’ for - * 'Mobile Originating'. Defined in TS 36.331. - */ -typedef enum rrc_establishment_cause_e { - RRC_CAUSE_EMERGENCY = 0x0, - RRC_CAUSE_HIGH_PRIO_ACCESS = 0x1, - RRC_CAUSE_MT_ACCESS = 0x2, - RRC_CAUSE_MO_SIGNALLING = 0x3, - RRC_CAUSE_MO_DATA = 0x4, -#if defined(UPDATE_RELEASE_10) - RRC_CAUSE_DELAY_TOLERANT_ACCESS = 0x5, -#endif - RRC_CAUSE_LAST -} rrc_establishment_cause_t; - -typedef struct s1ap_gummei_s { - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_len; - uint8_t mme_code; - uint16_t mme_group_id; -} s1ap_gummei_t; - -typedef struct s1ap_imsi_s { - uint8_t buffer[S1AP_IMSI_LENGTH]; - uint8_t length; -} s1ap_imsi_t; - -typedef struct s_tmsi_s { - uint8_t mme_code; - uint32_t m_tmsi; -} s_tmsi_t; - -typedef enum ue_paging_identity_presenceMask_e { - UE_PAGING_IDENTITY_NONE = 0, - UE_PAGING_IDENTITY_imsi = (1 << 1), - UE_PAGING_IDENTITY_s_tmsi = (1 << 2), -} ue_paging_identity_presenceMask_t; - -typedef struct ue_paging_identity_s { - ue_paging_identity_presenceMask_t presenceMask; - union { - s1ap_imsi_t imsi; - s_tmsi_t s_tmsi; - } choice; -} ue_paging_identity_t; - -typedef enum ue_identities_presenceMask_e { - UE_IDENTITIES_NONE = 0, - UE_IDENTITIES_s_tmsi = 1 << 1, - UE_IDENTITIES_gummei = 1 << 2, -} ue_identities_presenceMask_t; - -typedef struct ue_identity_s { - ue_identities_presenceMask_t presenceMask; - s_tmsi_t s_tmsi; - s1ap_gummei_t gummei; -} ue_identity_t; - -typedef struct nas_pdu_s { - /* Octet string data */ - uint8_t *buffer; - /* Length of the octet string */ - uint32_t length; -} nas_pdu_t, ue_radio_cap_t; - -typedef struct transport_layer_addr_s { - /* Length of the transport layer address buffer in bits. S1AP layer received a - * bit string<1..160> containing one of the following addresses: ipv4, - * ipv6, or ipv4 and ipv6. The layer doesn't interpret the buffer but - * silently forward it to S1-U. - */ - uint8_t length; - uint8_t buffer[20]; // in network byte order -} transport_layer_addr_t; - -#define TRANSPORT_LAYER_ADDR_COPY(dEST,sOURCE) \ - do { \ - AssertFatal(sOURCE.len <= 20); \ - memcpy(dEST.buffer, sOURCE.buffer, sOURCE.len); \ - dEST.length = sOURCE.length; \ - } while (0) - -typedef struct e_rab_level_qos_parameter_s { - uint8_t qci; - - allocation_retention_priority_t allocation_retention_priority; -} e_rab_level_qos_parameter_t; - -typedef struct e_rab_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; - /* Quality of service for this e_rab */ - e_rab_level_qos_parameter_t qos; - /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */ - nas_pdu_t nas_pdu; - /* The transport layer address for the IP packets */ - transport_layer_addr_t sgw_addr; - /* S-GW Tunnel endpoint identifier */ - uint32_t gtp_teid; -} e_rab_t; - -typedef struct e_rab_setup_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; - - /* The transport layer address for the IP packets */ - transport_layer_addr_t eNB_addr; - - /* S-GW Tunnel endpoint identifier */ - uint32_t gtp_teid; -} e_rab_setup_t; - -typedef struct e_rab_modify_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; -} e_rab_modify_t; - -typedef enum S1ap_Cause_e { - S1AP_CAUSE_NOTHING, /* No components present */ - S1AP_CAUSE_RADIO_NETWORK, - S1AP_CAUSE_TRANSPORT, - S1AP_CAUSE_NAS, - S1AP_CAUSE_PROTOCOL, - S1AP_CAUSE_MISC, - /* Extensions may appear below */ - -} s1ap_Cause_t; - -typedef struct e_rab_failed_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; - /* Cause of the failure */ - // cause_t cause; - s1ap_Cause_t cause; - uint8_t cause_value; -} e_rab_failed_t; - -typedef enum s1ap_ue_ctxt_modification_present_s { - S1AP_UE_CONTEXT_MODIFICATION_SECURITY_KEY = (1 << 0), - S1AP_UE_CONTEXT_MODIFICATION_UE_AMBR = (1 << 1), - S1AP_UE_CONTEXT_MODIFICATION_UE_SECU_CAP = (1 << 2), -} s1ap_ue_ctxt_modification_present_t; - -typedef enum s1ap_paging_ind_present_s { - S1AP_PAGING_IND_PAGING_DRX = (1 << 0), - S1AP_PAGING_IND_PAGING_PRIORITY = (1 << 1), -} s1ap_paging_ind_present_t; +// Note this should be 512 from maxval in 38.473 +#define F1AP_MAX_NB_CELLS 2 -//-------------------------------------------------------------------------------------------// -// eNB application layer -> S1AP messages -typedef struct s1ap_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; +typedef struct f1ap_setup_req_s { - /* 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; - - /* Default Paging DRX of the eNB as defined in TS 36.304 */ - paging_drx_t default_drx; + // Midhaul networking parameters /* The eNB IP address to bind */ - net_ip_address_t enb_ip_address; - - /* Nb of MME to connect to */ - uint8_t nb_mme; - /* List of MME to connect to */ - net_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS]; + char CU_ipv4_address[16]; + int CU_port; /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; uint16_t sctp_out_streams; -} s1ap_register_enb_req_t; -//-------------------------------------------------------------------------------------------// -// S1AP -> eNB application layer messages -typedef struct s1ap_register_enb_cnf_s { - /* Nb of MME connected */ - uint8_t nb_mme; -} s1ap_register_enb_cnf_t; - -typedef struct s1ap_deregistered_enb_ind_s { - /* Nb of MME connected */ - uint8_t nb_mme; -} s1ap_deregistered_enb_ind_t; - -//-------------------------------------------------------------------------------------------// -// RRC -> S1AP messages - -/* The NAS First Req is the first message exchanged between RRC and S1AP - * for an UE. - * The rnti uniquely identifies an UE within a cell. Later the enb_ue_s1ap_id - * will be the unique identifier used between RRC and S1AP. - */ -typedef struct s1ap_nas_first_req_s { - /* UE id for initial connection to S1AP */ - uint16_t ue_initial_id; + // F1_Setup_Req payload + uint32_t gNB_DU_id; + char *gNB_DU_name; - /* Establishment cause as sent by UE */ - rrc_establishment_cause_t establishment_cause; + /// number of DU cells available + uint16_t num_cells_available; //0< num_cells_to_available <= 512; - /* NAS PDU */ - nas_pdu_t nas_pdu; + // Served Cell Information + /* Tracking area code */ + uint16_t tac[F1AP_MAX_NB_CELLS]; - /* If this flag is set S1AP layer is expecting the GUMMEI. If = 0, - * the temporary s-tmsi is used. + /* Mobile Country Codes + * Mobile Network Codes */ - ue_identity_t ue_identity; -} s1ap_nas_first_req_t; - -typedef struct s1ap_uplink_nas_s { - /* Unique UE identifier within an eNB */ - unsigned eNB_ue_s1ap_id:24; - - /* NAS pdu */ - nas_pdu_t nas_pdu; -} s1ap_uplink_nas_t; - -typedef struct s1ap_ue_cap_info_ind_s { - unsigned eNB_ue_s1ap_id:24; - ue_radio_cap_t ue_radio_cap; -} s1ap_ue_cap_info_ind_t; - -typedef struct s1ap_initial_context_setup_resp_s { - unsigned eNB_ue_s1ap_id:24; - - /* Number of e_rab setup-ed in the list */ - uint8_t nb_of_e_rabs; - /* list of e_rab setup-ed by RRC layers */ - e_rab_setup_t e_rabs[S1AP_MAX_E_RAB]; - - /* Number of e_rab failed to be setup in list */ - uint8_t nb_of_e_rabs_failed; - /* list of e_rabs that failed to be setup */ - e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB]; -} s1ap_initial_context_setup_resp_t; - -typedef struct s1ap_initial_context_setup_fail_s { - unsigned eNB_ue_s1ap_id:24; - - /* TODO add cause */ -} s1ap_initial_context_setup_fail_t, s1ap_ue_ctxt_modification_fail_t, s1ap_e_rab_setup_req_fail_t; - -typedef struct s1ap_nas_non_delivery_ind_s { - unsigned eNB_ue_s1ap_id:24; - nas_pdu_t nas_pdu; - /* TODO: add cause */ -} s1ap_nas_non_delivery_ind_t; - -typedef struct s1ap_ue_ctxt_modification_req_s { - unsigned eNB_ue_s1ap_id:24; - - /* Bit-mask of possible present parameters */ - s1ap_ue_ctxt_modification_present_t present; - - /* Following fields are optionnaly present */ - - /* Security key */ - uint8_t security_key[SECURITY_KEY_LENGTH]; - - /* UE aggregate maximum bitrate */ - ambr_t ue_ambr; - - /* Security capabilities */ - security_capabilities_t security_capabilities; -} s1ap_ue_ctxt_modification_req_t; - -typedef struct s1ap_ue_ctxt_modification_resp_s { - unsigned eNB_ue_s1ap_id:24; -} s1ap_ue_ctxt_modification_resp_t; - -typedef struct s1ap_ue_release_complete_s { - - unsigned eNB_ue_s1ap_id:24; - -} s1ap_ue_release_complete_t; - -//-------------------------------------------------------------------------------------------// -// S1AP -> RRC messages -typedef struct s1ap_downlink_nas_s { - /* UE id for initial connection to S1AP */ - uint16_t ue_initial_id; - - /* Unique UE identifier within an eNB */ - unsigned eNB_ue_s1ap_id:24; - - /* NAS pdu */ - nas_pdu_t nas_pdu; -} s1ap_downlink_nas_t; - - -typedef struct s1ap_initial_context_setup_req_s { - /* UE id for initial connection to S1AP */ - uint16_t ue_initial_id; - - /* eNB ue s1ap id as initialized by S1AP layer */ - unsigned eNB_ue_s1ap_id:24; + uint16_t mcc[F1AP_MAX_NB_CELLS]; + uint16_t mnc[F1AP_MAX_NB_CELLS]; + uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS]; + + // NR Physical Cell Ids + uint16_t nr_pci[F1AP_MAX_NB_CELLS]; + // NR Cell Ids + uint8_t nr_cellid[F1AP_MAX_NB_CELLS]; + // Number of slide support items (max 16, could be increased to as much as 1024) + uint16_t num_ssi[F1AP_MAX_NB_CELLS]; + uint8_t sst[F1AP_MAX_NB_CELLS][16]; + uint8_t sd[F1AP_MAX_NB_CELLS][16]; - /* UE aggregate maximum bitrate */ - ambr_t ue_ambr; - - /* Security algorithms */ - security_capabilities_t security_capabilities; - - /* Security key */ - uint8_t security_key[SECURITY_KEY_LENGTH]; - - /* Number of e_rab to be setup in the list */ - uint8_t nb_of_e_rabs; - /* list of e_rab to be setup by RRC layers */ - e_rab_t e_rab_param[S1AP_MAX_E_RAB]; -} s1ap_initial_context_setup_req_t; - -typedef struct tai_plmn_identity_s { + union { + struct { + uint32_t ul_nr_arfcn; + uint8_t ul_scs; + uint8_t ul_nrb; + + uint32_t dl_nr_arfcn; + uint8_t dl_scs; + uint8_t dl_nrb; + + uint32_t sul_active; + uint32_t sul_nr_arfcn; + uint8_t sul_scs; + uint8_t sul_nrb; + + uint8_t num_frequency_bands; + uint16_t nr_band[32]; + uint8_t num_sul_frequency_bands; + uint16_t nr_sul_band[32]; + } fdd; + struct { + + uint32_t nr_arfcn; + uint8_t scs; + uint8_t nrb; + + uint32_t sul_active; + uint32_t sul_nr_arfcn; + uint8_t sul_scs; + uint8_t sul_nrb; + + uint8_t num_frequency_bands; + uint16_t nr_band[32]; + uint8_t num_sul_frequency_bands; + uint16_t nr_sul_band[32]; + + } tdd; + } nr_mode_info[F1AP_MAX_NB_CELLS]; + + char *measurement_timing_information[F1AP_MAX_NB_CELLS]; + uint8_t ranac[F1AP_MAX_NB_CELLS]; + + // System Information + uint8_t *mib[F1AP_MAX_NB_CELLS]; + uint8_t *sib1[F1AP_MAX_NB_CELLS]; + + + +} f1ap_setup_req_t; + +typedef struct f1ap_setup_resp_s { + /// string holding gNB_CU_name + char *gNB_CU_name; + /// number of DU cells to activate + uint16_t num_cells_to_activate; //0< num_cells_to_activate <= 512; + /// mcc of DU cells + uint16_t mcc[F1AP_MAX_NB_CELLS]; + /// mnc of DU cells + uint16_t mnc[F1AP_MAX_NB_CELLS]; + /// mnc digit length of DU cells + uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS]; + /// NRPCI + uint16_t nrpci[F1AP_MAX_NB_CELLS]; + /// num SI messages per DU cell + uint8_t num_SI[F1AP_MAX_NB_CELLS]; + /// SI message containers (up to 21 messages per cell) + uint8_t *SI_container[F1AP_MAX_NB_CELLS][21]; +} f1ap_setup_resp_t; + +typedef struct f1ap_setup_failure_s { + uint16_t cause; + uint16_t time_to_wait; + uint16_t criticality_diagnostics; +} f1ap_setup_failure_t; + +typedef struct f1ap_dl_rrc_message_s { + + uint32_t gNB_CU_ue_id; + uint32_t gNB_DU_ue_id; + uint32_t old_gNB_DU_ue_id; + uint8_t srb_id; + uint8_t execute_duplication; + uint8_t *rrc_container; + union { + // both map 0..255 => 1..256 + uint8_t en_dc; + uint8_t ngran; + } RAT_frequency_priority_information; +} f1ap_dl_rrc_message_t; + +typedef struct f1ap_initial_ul_rrc_message_s { + uint32_t gNB_DU_ue_id; + /// mcc of DU cell uint16_t mcc; + /// mnc of DU cell uint16_t mnc; - uint8_t mnc_digit_length; -} plmn_identity_t; - -typedef struct s1ap_paging_ind_s { - /* UE identity index value. - * Specified in 3GPP TS 36.304 - */ - unsigned ue_index_value:10; - - /* UE paging identity */ - ue_paging_identity_t ue_paging_identity; - - /* Indicates origin of paging */ - cn_domain_t cn_domain; - - /* PLMN_identity in TAI of Paging*/ - plmn_identity_t plmn_identity[256]; - - /* TAC in TAIList of Paging*/ - int16_t tac[256]; - - /* size of TAIList*/ - int16_t tai_size; - - /* Optional fields */ - paging_drx_t paging_drx; - - paging_priority_t paging_priority; -} s1ap_paging_ind_t; - -typedef struct s1ap_e_rab_setup_req_s { - /* UE id for initial connection to S1AP */ - uint16_t ue_initial_id; - - /* MME UE id */ - uint16_t mme_ue_s1ap_id; - - /* eNB ue s1ap id as initialized by S1AP layer */ - unsigned eNB_ue_s1ap_id:24; - - /* Number of e_rab to be setup in the list */ - uint8_t nb_e_rabs_tosetup; - - /* E RAB setup request */ - e_rab_t e_rab_setup_params[S1AP_MAX_E_RAB]; - -} s1ap_e_rab_setup_req_t; - -typedef struct s1ap_e_rab_setup_resp_s { - unsigned eNB_ue_s1ap_id:24; - - /* Number of e_rab setup-ed in the list */ - uint8_t nb_of_e_rabs; - /* list of e_rab setup-ed by RRC layers */ - e_rab_setup_t e_rabs[S1AP_MAX_E_RAB]; - - /* Number of e_rab failed to be setup in list */ - uint8_t nb_of_e_rabs_failed; - /* list of e_rabs that failed to be setup */ - e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB]; -} s1ap_e_rab_setup_resp_t; - - -// S1AP --> RRC messages -typedef struct s1ap_ue_release_command_s { - - unsigned eNB_ue_s1ap_id:24; - -} s1ap_ue_release_command_t; - - -//-------------------------------------------------------------------------------------------// -// S1AP <-- RRC messages -typedef struct s1ap_ue_release_req_s { - unsigned eNB_ue_s1ap_id:24; - s1ap_Cause_t cause; - long cause_value; -} s1ap_ue_release_req_t, s1ap_ue_release_resp_t; - -typedef struct s1ap_e_rab_modify_req_s { - /* UE id for initial connection to S1AP */ - uint16_t ue_initial_id; - - /* MME UE id */ - uint16_t mme_ue_s1ap_id; - - /* eNB ue s1ap id as initialized by S1AP layer */ - unsigned eNB_ue_s1ap_id:24; - - /* Number of e_rab to be modify in the list */ - uint8_t nb_e_rabs_tomodify; - - /* E RAB modify request */ - e_rab_t e_rab_modify_params[S1AP_MAX_E_RAB]; -} s1ap_e_rab_modify_req_t; - -typedef struct s1ap_e_rab_modify_resp_s { - unsigned eNB_ue_s1ap_id:24; - - /* Number of e_rab modify-ed in the list */ - uint8_t nb_of_e_rabs; - /* list of e_rab modify-ed by RRC layers */ - e_rab_modify_t e_rabs[S1AP_MAX_E_RAB]; - - /* Number of e_rab failed to be modify in list */ - uint8_t nb_of_e_rabs_failed; - /* list of e_rabs that failed to be modify */ - e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB]; -} s1ap_e_rab_modify_resp_t; - -typedef struct e_rab_release_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; -} e_rab_release_t; - -typedef struct s1ap_e_rab_release_command_s { - /* MME UE id */ - uint16_t mme_ue_s1ap_id; - - /* eNB ue s1ap id as initialized by S1AP layer */ - unsigned eNB_ue_s1ap_id:24; - - /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */ - nas_pdu_t nas_pdu; - - /* Number of e_rab to be released in the list */ - uint8_t nb_e_rabs_torelease; - - /* E RAB release command */ - e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB]; - -} s1ap_e_rab_release_command_t; - -typedef struct s1ap_e_rab_release_resp_s { - /* MME UE id */ - uint16_t mme_ue_s1ap_id; - - /* eNB ue s1ap id as initialized by S1AP layer */ - unsigned eNB_ue_s1ap_id:24; - - /* Number of e_rab released in the list */ - uint8_t nb_of_e_rabs_released; - - /* list of e_rabs released */ - e_rab_release_t e_rab_release[S1AP_MAX_E_RAB]; - - /* Number of e_rab failed to be released in list */ - uint8_t nb_of_e_rabs_failed; - /* list of e_rabs that failed to be released */ - e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB]; - -} s1ap_e_rab_release_resp_t; - -#endif /* S1AP_MESSAGES_TYPES_H_ */ + /// mnc digit length of DU cells + uint8_t mnc_digit_length; + uint16_t crnti; + uint8_t *rrc_container; + uint8_t *du2cu_rrc_container; +} f1ap_initial_ul_rrc_message_t; + +typedef struct f1ap_ul_rrc_message_s { + uint32_t gNB_CU_ue_id; + uint32_t gNB_DU_ue_id; + uint8_t srb_id; + uint8_t *rrc_container; +} f1ap_ul_rrc_message_t; + +/*typedef struct f1ap_ue_context_setup_req_s { + + } f1ap_ue_context_setup_req_t;*/ + +#endif /* F1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h index d902de15d9..f175f9ddf8 100644 --- a/openair2/COMMON/mac_rrc_primitives.h +++ b/openair2/COMMON/mac_rrc_primitives.h @@ -390,7 +390,7 @@ typedef struct { -#define IDLE 0 +//#define IDLE 0 #define NEED_RADIO_CONFIG 3 #define RADIO_CONFIG_TX 2 #define RADIO_CONFIG_OK 1 diff --git a/openair2/COMMON/messages_def.h b/openair2/COMMON/messages_def.h index 2434d15776..be7c2afabd 100644 --- a/openair2/COMMON/messages_def.h +++ b/openair2/COMMON/messages_def.h @@ -34,6 +34,7 @@ #include "ral_messages_def.h" #endif #include "s1ap_messages_def.h" +#include "f1ap_messages_def.h" #include "x2ap_messages_def.h" #include "sctp_messages_def.h" #include "udp_messages_def.h" diff --git a/openair2/COMMON/messages_types.h b/openair2/COMMON/messages_types.h index 5e5fdadd2a..f5ca697f50 100644 --- a/openair2/COMMON/messages_types.h +++ b/openair2/COMMON/messages_types.h @@ -40,8 +40,9 @@ #include "nas_messages_types.h" #if ENABLE_RAL #include "ral_messages_types.h" -#endif +#endif #include "s1ap_messages_types.h" +#include "f1ap_messages_types.h" #include "x2ap_messages_types.h" #include "sctp_messages_types.h" #include "udp_messages_types.h" diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 4a0137d4b6..62bc535e70 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -32,6 +32,7 @@ #include "as_message.h" #include "rrc_types.h" #include "s1ap_messages_types.h" +#include "f1ap_messages_types.h" #ifdef CMAKER #include "SystemInformationBlockType2.h" #else diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 379ef311c7..0008361d93 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -113,7 +113,7 @@ static void configure_rrc(uint32_t enb_id) /*------------------------------------------------------------------------------*/ # 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(ngran_node_t node_type,uint32_t enb_id_start, uint32_t enb_id_end)//, const Enb_properties_array_t *enb_properties) { uint32_t enb_id; MessageDef *msg_p; @@ -121,20 +121,38 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { { - /* note: there is an implicit relationship between the data structure and the message name */ - msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); + if (node_type == ngran_eNB_DU) { // F1AP registration - RCconfig_S1(msg_p, enb_id); + // configure F1AP here for F1C + LOG_I(ENB_APP,"ngran_eNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); + msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); + RCconfig_DU_F1(msg_p, enb_id); - if (enb_id == 0) RCconfig_gtpu(); - - LOG_I(ENB_APP,"default drx %d\n",((S1AP_REGISTER_ENB_REQ(msg_p)).default_drx)); - - LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); + LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); + AssertFatal(1==0,"No ITTI ask for F1AP yet\n"); + // itti_send_msg_to_task (TASK_F1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + // configure GTPu here for F1U + } + else { // S1AP registration + /* note: there is an implicit relationship between the data structure and the message name */ + msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); + + RCconfig_S1(msg_p, enb_id); + + if (node_type == ngran_eNB_CU || node_type == ngran_ng_eNB_CU) RCconfig_CU_F1(enb_id); + + if (enb_id == 0) RCconfig_gtpu(); + + LOG_I(ENB_APP,"default drx %d\n",((S1AP_REGISTER_ENB_REQ(msg_p)).default_drx)); + + LOG_I(ENB_APP,"[eNB %d] eNB_app_register via S1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); + itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + } - itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + register_enb_pending++; + } } @@ -161,6 +179,9 @@ void *eNB_app_task(void *args_p) int result; /* for no gcc warnings */ (void)instance; + int mac_has_f1[MAX_MAC_INST]; + + memset(mac_has_f1,0,MAX_MAC_INST*sizeof(int)); itti_mark_task_ready (TASK_ENB_APP); @@ -168,12 +189,15 @@ void *eNB_app_task(void *args_p) RCconfig_L1(); - RCconfig_macrlc(); + RCconfig_macrlc(mac_has_f1); + + LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_macrlc_inst); LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst); if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n"); + AssertFatal (enb_nb <= RC.nb_inst, "Number of eNB is greater than eNB defined in configuration file (%d/%d)!", enb_nb, RC.nb_inst); @@ -183,17 +207,26 @@ void *eNB_app_task(void *args_p) RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *)); LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc); + if (RC.nb_macrlc_inst>0) AssertFatal(RC.nb_macrlc_inst == enb_id_end-enb_id_start, + "Number of MACRLC instances %d != number of RRC instances %d\n", + RC.nb_macrlc_inst,enb_id_end-enb_id_start); for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST)); LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end); memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); configure_rrc(enb_id); + + if (RC.nb_macrlc_inst >0 && mac_has_f1[enb_id]==1) RC.rrc[enb_id]->node_type = ngran_eNB_DU; + + pdcp_layer_init(); } + # if defined(ENABLE_USE_MME) /* Try to register each eNB */ registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); + // This assumes that node_type of all RRC instances is the same + register_enb_pending = eNB_app_register (RC.rrc[0]->node_type,enb_id_start, enb_id_end);//, enb_properties_p); # else /* Start L2L1 task */ msg_p = itti_alloc_new_message(TASK_ENB_APP, INITIALIZE_MESSAGE); @@ -251,7 +284,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_p); + register_enb_pending = eNB_app_register (RC.rrc[0]->node_type,enb_id_start, enb_id_end);//, enb_properties_p); } } } @@ -271,7 +304,7 @@ void *eNB_app_task(void *args_p) if (TIMER_HAS_EXPIRED (msg_p).timer_id == enb_register_retry_timer_id) { /* Restart the registration process */ registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); + register_enb_pending = eNB_app_register (RC.rrc[0]->node_type,enb_id_start, enb_id_end);//, enb_properties_p); } break; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index b24c61df94..9cbb6cc9c8 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -42,6 +42,7 @@ # include "sctp_eNB_task.h" # endif #endif +#include "common/ran_context.h" #include "sctp_default_values.h" #include "SystemInformationBlockType2.h" #include "LAYER2/MAC/mac_extern.h" @@ -329,21 +330,24 @@ void RCconfig_L1(void) { } } -void RCconfig_macrlc() { - int j; +void RCconfig_macrlc(int *mac_has_f1) { + int j; paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC; paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0}; config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL); - + if ( MacRLC_ParamList.numelt > 0) { + RC.nb_macrlc_inst=MacRLC_ParamList.numelt; mac_top_init_eNB(); RC.nb_mac_CC = (int*)malloc(RC.nb_macrlc_inst*sizeof(int)); + printf("Configuring %d MACRLC entities\n",RC.nb_macrlc_inst); + for (j=0;j<RC.nb_macrlc_inst;j++) { RC.mac[j]->puSch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCH10xSNR_IDX ].iptr); RC.mac[j]->puCch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCH10xSNR_IDX ].iptr); @@ -353,8 +357,9 @@ void RCconfig_macrlc() { if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) { // check number of instances is same as RRC/PDCP - - } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) { + printf("Configuring local RRC for MACRLC\n"); + } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) { + printf("Configuring F1 interfaces for MACRLC\n"); RC.mac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr)); RC.mac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr)); RC.mac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr)); @@ -363,6 +368,7 @@ void RCconfig_macrlc() { RC.mac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr); RC.mac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);; RC.mac[j]->eth_params_n.transp_preference = ETH_UDP_MODE; + mac_has_f1[j] = 1; } else { // other midhaul AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr)); } @@ -399,10 +405,10 @@ void RCconfig_macrlc() { printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr)); } }// j=0..num_inst - } else {// MacRLC_ParamList.numelt > 0 + }/* else {// MacRLC_ParamList.numelt > 0 AssertFatal (0, "No " CONFIG_STRING_MACRLC_LIST " configuration found"); - } + }*/ } @@ -713,6 +719,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { paramdef_t SRB1Params[] = SRB1PARAMS_DESC; + /* map parameter checking array instances to parameter definition array instances */ for (int I=0; I< ( sizeof(CCsParams)/ sizeof(paramdef_t) ) ; I++) { CCsParams[I].chkPptr = &(config_check_CCparams[I]); @@ -768,39 +775,47 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { } - printf("RRC %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr)); + LOG_I(RRC,"Instance %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr)); if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { - - + rrc->node_type = ngran_eNB; } - else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) { + else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) { rrc->eth_params_s.local_if_name = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_IF_NAME_IDX].strptr)); + LOG_I(RRC,"Configuring CU-DU interfaces for MACRLC on %s\n",rrc->eth_params_s.local_if_name); rrc->eth_params_s.my_addr = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_ADDRESS_IDX].strptr)); + LOG_I(RRC,"local address: %s\n",rrc->eth_params_s.my_addr); rrc->eth_params_s.remote_addr = strdup(*(ENBParamList.paramarray[i][ENB_REMOTE_S_ADDRESS_IDX].strptr)); + LOG_I(RRC,"remote address: %s\n",rrc->eth_params_s.remote_addr); rrc->eth_params_s.my_portc = *(ENBParamList.paramarray[i][ENB_LOCAL_S_PORTC_IDX].uptr); + LOG_I(RRC,"local port (F1AP) %d\n",rrc->eth_params_s.my_portc); rrc->eth_params_s.remote_portc = *(ENBParamList.paramarray[i][ENB_REMOTE_S_PORTC_IDX].uptr); + LOG_I(RRC,"remote port (F1AP) %d\n",rrc->eth_params_s.remote_portc); rrc->eth_params_s.my_portd = *(ENBParamList.paramarray[i][ENB_LOCAL_S_PORTD_IDX].uptr); + LOG_I(RRC,"local port (F1U) %d\n",rrc->eth_params_s.my_portd); rrc->eth_params_s.remote_portd = *(ENBParamList.paramarray[i][ENB_REMOTE_S_PORTD_IDX].uptr); + LOG_I(RRC,"remote port (F1U) %d\n",rrc->eth_params_s.remote_portd); rrc->eth_params_s.transp_preference = ETH_UDP_MODE; + rrc->node_type = ngran_eNB_CU; } - else { // other midhaul + else { // no F1 + // set to ngran_eNB for now, it will get set to ngran_DU if macrlc entity which uses F1 is present + rrc->node_type = ngran_eNB; } // search if in active list - - - - - + LOG_I(RRC,"RRC instances %d\n",num_enbs); for (k=0; k <num_enbs ; k++) { if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) { char enbpath[MAX_OPTNAME_SIZE + 8]; - - RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id; + + if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU) { + LOG_I(RRC,"Configuring Cell Information\n"); + // PLMN information for SIB1 in DU + RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id; /* if (strcmp(*(ENBParamList.paramarray[i][ENB_CELL_TYPE_IDX].strptr), "CELL_MACRO_ENB") == 0) { @@ -815,20 +830,22 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { enb_properties_loc.properties[enb_properties_loc_index]->eNB_name = strdup(enb_name); */ - RRC_CONFIGURATION_REQ (msg_p).tac = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); - RRC_CONFIGURATION_REQ (msg_p).mcc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); - RRC_CONFIGURATION_REQ (msg_p).mnc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); - RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); - AssertFatal((RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 2) || - (RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 3), - "BAD MNC DIGIT LENGTH %d", - RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length); - + RRC_CONFIGURATION_REQ (msg_p).tac = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mcc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mnc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + AssertFatal((RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 2) || + (RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 3), + "BAD MNC DIGIT LENGTH %d", + RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length); + - // Parse optional physical parameters - sprintf(enbpath,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k), - config_getlist( &CCsParamList,NULL,0,enbpath); - + // Parse optional physical parameters + sprintf(enbpath,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k), + config_getlist( &CCsParamList,NULL,0,enbpath); + } + + LOG_I(RRC,"num component carriers %d \n",CCsParamList.numelt); if ( CCsParamList.numelt> 0) { char ccspath[MAX_OPTNAME_SIZE*2 + 16]; @@ -846,224 +863,195 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { nb_cc++; + if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU) { + // Cell params, MIB/SIB1 in DU + RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config; - RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config; - - AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6, - "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!", - RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6); + AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6, + "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!", + RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6); - RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s; - AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, - "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!", - RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8); - - if (!prefix_type) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n", - RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE); - else if (strcmp(prefix_type, "NORMAL") == 0) { - RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; - } else if (strcmp(prefix_type, "EXTENDED") == 0) { - RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; - } else { - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", - RC.config_file_name, i, prefix_type); - } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - if (!pbch_repetition) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: TRUE,FALSE!\n", - RC.config_file_name, i, ENB_CONFIG_STRING_PBCH_REPETITION); - else if (strcmp(pbch_repetition, "TRUE") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 1; - } else if (strcmp(pbch_repetition, "FALSE") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 0; - } else { - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pbch_repetition choice: TRUE or FALSE !\n", - RC.config_file_name, i, pbch_repetition); - } -#endif - - RRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band; - RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency; - RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset; - RRC_CONFIGURATION_REQ (msg_p).Nid_cell[j]= Nid_cell; - - if (Nid_cell>503) { - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n", - RC.config_file_name, i, Nid_cell); - } - - RRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= N_RB_DL; - - if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) { - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n", - RC.config_file_name, i, N_RB_DL); - } - - if (strcmp(frame_type, "FDD") == 0) { - RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = FDD; - } else if (strcmp(frame_type, "TDD") == 0) { - RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = TDD; - } else { - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n", - RC.config_file_name, i, frame_type); - } - - - RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config; - AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6, - "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!", - RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6); - - - RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s; - AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, - "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!", - RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8); - - - - if (!prefix_type) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n", - RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE); - else if (strcmp(prefix_type, "NORMAL") == 0) { - RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; - } else if (strcmp(prefix_type, "EXTENDED") == 0) { - RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; - } else { - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", - RC.config_file_name, i, prefix_type); - } - - - - RRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band; - // printf( "\teutra band:\t%d\n",RRC_CONFIGURATION_REQ (msg_p).eutra_band); + RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s; + AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, + "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!", + RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8); + + if (!prefix_type) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE); + else if (strcmp(prefix_type, "NORMAL") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; + } else if (strcmp(prefix_type, "EXTENDED") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, prefix_type); + } + + RRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band; + RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency; + RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset; + + if (config_check_band_frequencies(j, + RRC_CONFIGURATION_REQ (msg_p).eutra_band[j], + RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j], + RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j], + RRC_CONFIGURATION_REQ (msg_p).frame_type[j])) { + AssertFatal(0, "error calling enb_check_band_frequencies\n"); + } + + RRC_CONFIGURATION_REQ (msg_p).Nid_cell[j]= Nid_cell; + if (Nid_cell>503) { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n", + RC.config_file_name, i, Nid_cell); + } + + RRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= N_RB_DL; + + if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n", + RC.config_file_name, i, N_RB_DL); + } + + if (strcmp(frame_type, "FDD") == 0) { + RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = FDD; + } else if (strcmp(frame_type, "TDD") == 0) { + RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = TDD; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n", + RC.config_file_name, i, frame_type); + } + - RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency; - //printf( "\tdownlink freq:\t%u\n",RRC_CONFIGURATION_REQ (msg_p).downlink_frequency); - RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset; - if (config_check_band_frequencies(j, - RRC_CONFIGURATION_REQ (msg_p).eutra_band[j], - RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j], - RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j], - RRC_CONFIGURATION_REQ (msg_p).frame_type[j])) { - AssertFatal(0, "error calling enb_check_band_frequencies\n"); + if ((nb_antenna_ports <1) || (nb_antenna_ports > 2)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n", + RC.config_file_name, i, nb_antenna_ports); + + RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = nb_antenna_ports; + } + else {//this is CU, SIB2-20 in CU - if ((nb_antenna_ports <1) || (nb_antenna_ports > 2)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n", - RC.config_file_name, i, nb_antenna_ports); - - RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = nb_antenna_ports; - - - RRC_CONFIGURATION_REQ (msg_p).prach_root[j] = prach_root; - - if ((prach_root <0) || (prach_root > 1023)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_root choice: 0..1023 !\n", - RC.config_file_name, i, prach_root); - - RRC_CONFIGURATION_REQ (msg_p).prach_config_index[j] = prach_config_index; - - if ((prach_config_index <0) || (prach_config_index > 63)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_config_index choice: 0..1023 !\n", - RC.config_file_name, i, prach_config_index); - - if (!prach_high_speed) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", - RC.config_file_name, i, ENB_CONFIG_STRING_PRACH_HIGH_SPEED); - else if (strcmp(prach_high_speed, "ENABLE") == 0) { - RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[j] = TRUE; - } else if (strcmp(prach_high_speed, "DISABLE") == 0) { - RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[j] = FALSE; - } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prach_config choice: ENABLE,DISABLE !\n", - RC.config_file_name, i, prach_high_speed); - - RRC_CONFIGURATION_REQ (msg_p).prach_zero_correlation[j] =prach_zero_correlation; - - if ((prach_zero_correlation <0) || (prach_zero_correlation > 15)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n", - RC.config_file_name, i, prach_zero_correlation); - - RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[j] = prach_freq_offset; - if ((prach_freq_offset <0) || (prach_freq_offset > 94)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n", - RC.config_file_name, i, prach_freq_offset); - - RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[j] = pucch_delta_shift-1; - - if ((pucch_delta_shift <1) || (pucch_delta_shift > 3)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_delta_shift choice: 1..3!\n", - RC.config_file_name, i, pucch_delta_shift); - +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + if (!pbch_repetition) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: TRUE,FALSE!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PBCH_REPETITION); + else if (strcmp(pbch_repetition, "TRUE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 1; + } else if (strcmp(pbch_repetition, "FALSE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 0; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pbch_repetition choice: TRUE or FALSE !\n", + RC.config_file_name, i, pbch_repetition); + } +#endif + + + + RRC_CONFIGURATION_REQ (msg_p).prach_root[j] = prach_root; + + if ((prach_root <0) || (prach_root > 1023)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_root choice: 0..1023 !\n", + RC.config_file_name, i, prach_root); + + RRC_CONFIGURATION_REQ (msg_p).prach_config_index[j] = prach_config_index; + + if ((prach_config_index <0) || (prach_config_index > 63)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_config_index choice: 0..1023 !\n", + RC.config_file_name, i, prach_config_index); + + if (!prach_high_speed) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PRACH_HIGH_SPEED); + else if (strcmp(prach_high_speed, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[j] = TRUE; + } else if (strcmp(prach_high_speed, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prach_config choice: ENABLE,DISABLE !\n", + RC.config_file_name, i, prach_high_speed); + + RRC_CONFIGURATION_REQ (msg_p).prach_zero_correlation[j] =prach_zero_correlation; + + if ((prach_zero_correlation <0) || (prach_zero_correlation > 15)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n", + RC.config_file_name, i, prach_zero_correlation); + + RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[j] = prach_freq_offset; + if ((prach_freq_offset <0) || (prach_freq_offset > 94)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n", + RC.config_file_name, i, prach_freq_offset); + + RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[j] = pucch_delta_shift-1; + + if ((pucch_delta_shift <1) || (pucch_delta_shift > 3)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_delta_shift choice: 1..3!\n", + RC.config_file_name, i, pucch_delta_shift); + RRC_CONFIGURATION_REQ (msg_p).pucch_nRB_CQI[j] = pucch_nRB_CQI; - + if ((pucch_nRB_CQI <0) || (pucch_nRB_CQI > 98)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nRB_CQI choice: 0..98!\n", RC.config_file_name, i, pucch_nRB_CQI); - + RRC_CONFIGURATION_REQ (msg_p).pucch_nCS_AN[j] = pucch_nCS_AN; - + if ((pucch_nCS_AN <0) || (pucch_nCS_AN > 7)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n", RC.config_file_name, i, pucch_nCS_AN); - -//#if (RRC_VERSION < MAKE_VERSION(10, 0, 0)) + + //#if (RRC_VERSION < MAKE_VERSION(10, 0, 0)) RRC_CONFIGURATION_REQ (msg_p).pucch_n1_AN[j] = pucch_n1_AN; - + if ((pucch_n1_AN <0) || (pucch_n1_AN > 2047)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_n1_AN choice: 0..2047!\n", RC.config_file_name, i, pucch_n1_AN); - -//#endif + + //#endif RRC_CONFIGURATION_REQ (msg_p).pdsch_referenceSignalPower[j] = pdsch_referenceSignalPower; - + if ((pdsch_referenceSignalPower <-60) || (pdsch_referenceSignalPower > 50)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_referenceSignalPower choice:-60..50!\n", RC.config_file_name, i, pdsch_referenceSignalPower); - + RRC_CONFIGURATION_REQ (msg_p).pdsch_p_b[j] = pdsch_p_b; - + if ((pdsch_p_b <0) || (pdsch_p_b > 3)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_p_b choice: 0..3!\n", RC.config_file_name, i, pdsch_p_b); - + RRC_CONFIGURATION_REQ (msg_p).pusch_n_SB[j] = pusch_n_SB; - + if ((pusch_n_SB <1) || (pusch_n_SB > 4)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_n_SB choice: 1..4!\n", RC.config_file_name, i, pusch_n_SB); - + if (!pusch_hoppingMode) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d define %s: interSubframe,intraAndInterSubframe!\n", @@ -1076,14 +1064,14 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingMode choice: interSubframe,intraAndInterSubframe!\n", RC.config_file_name, i, pusch_hoppingMode); - + RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingOffset[j] = pusch_hoppingOffset; - + if ((pusch_hoppingOffset<0) || (pusch_hoppingOffset>98)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingOffset choice: 0..98!\n", RC.config_file_name, i, pusch_hoppingMode); - + if (!pusch_enable64QAM) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", @@ -1096,7 +1084,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_enable64QAM choice: ENABLE,DISABLE!\n", RC.config_file_name, i, pusch_enable64QAM); - + if (!pusch_groupHoppingEnabled) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", @@ -1109,15 +1097,15 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_groupHoppingEnabled choice: ENABLE,DISABLE!\n", RC.config_file_name, i, pusch_groupHoppingEnabled); - - + + RRC_CONFIGURATION_REQ (msg_p).pusch_groupAssignment[j] = pusch_groupAssignment; - + if ((pusch_groupAssignment<0)||(pusch_groupAssignment>29)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_groupAssignment choice: 0..29!\n", RC.config_file_name, i, pusch_groupAssignment); - + if (!pusch_sequenceHoppingEnabled) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", @@ -1130,14 +1118,14 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_sequenceHoppingEnabled choice: ENABLE,DISABLE!\n", RC.config_file_name, i, pusch_sequenceHoppingEnabled); - + RRC_CONFIGURATION_REQ (msg_p).pusch_nDMRS1[j] = pusch_nDMRS1; //cyclic_shift in RRC! - + if ((pusch_nDMRS1 <0) || (pusch_nDMRS1>7)) AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_nDMRS1 choice: 0..7!\n", RC.config_file_name, i, pusch_nDMRS1); - + if (strcmp(phich_duration,"NORMAL")==0) { RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_normal; } else if (strcmp(phich_duration,"EXTENDED")==0) { @@ -1146,7 +1134,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_duration choice: NORMAL,EXTENDED!\n", RC.config_file_name, i, phich_duration); - + if (strcmp(phich_resource,"ONESIXTH")==0) { RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_oneSixth ; } else if (strcmp(phich_resource,"HALF")==0) { @@ -1206,7 +1194,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_MaxUpPts choice: ENABLE,DISABLE !\n", RC.config_file_name, i, srs_MaxUpPts); } - + RRC_CONFIGURATION_REQ (msg_p).pusch_p0_Nominal[j] = pusch_p0_Nominal; if ((pusch_p0_Nominal<-126) || (pusch_p0_Nominal>24)) @@ -1233,7 +1221,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al1; } #endif - + #if (RRC_VERSION >= MAKE_VERSION(12, 0, 0)) if (strcmp(pusch_alpha,"AL0")==0) { RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al0; @@ -1271,7 +1259,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for msg3_delta_Preamble choice: -1..6 !\n", RC.config_file_name, i, msg3_delta_Preamble); - + if (strcmp(pucch_deltaF_Format1,"deltaF_2")==0) { RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF_2; @@ -1332,7 +1320,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RC.config_file_name, i, pucch_deltaF_Format2b); - + RRC_CONFIGURATION_REQ (msg_p).rach_numberOfRA_Preambles[j] = (rach_numberOfRA_Preambles/4)-1; @@ -1435,7 +1423,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RC.config_file_name, i, rach_powerRampingStep); - + switch (rach_preambleTransMax) { #if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) case 3: @@ -1668,639 +1656,641 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { break; } - RRC_CONFIGURATION_REQ (msg_p).ue_multiple_max[j] = ue_multiple_max; - - switch (N_RB_DL) { - case 25: - if ((ue_multiple_max < 1) || (ue_multiple_max > 4)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..4!\n", - RC.config_file_name, i, ue_multiple_max); - break; - case 50: - if ((ue_multiple_max < 1) || (ue_multiple_max > 8)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..8!\n", - RC.config_file_name, i, ue_multiple_max); - break; - case 100: - if ((ue_multiple_max < 1) || (ue_multiple_max > 16)) - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..16!\n", - RC.config_file_name, i, ue_multiple_max); - break; - default: - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 25,50,100 !\n", - RC.config_file_name, i, N_RB_DL); - break; - } + RRC_CONFIGURATION_REQ (msg_p).ue_multiple_max[j] = ue_multiple_max; + switch (N_RB_DL) { + case 25: + if ((ue_multiple_max < 1) || (ue_multiple_max > 4)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..4!\n", + RC.config_file_name, i, ue_multiple_max); + break; + case 50: + if ((ue_multiple_max < 1) || (ue_multiple_max > 8)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..8!\n", + RC.config_file_name, i, ue_multiple_max); + break; + case 100: + if ((ue_multiple_max < 1) || (ue_multiple_max > 16)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..16!\n", + RC.config_file_name, i, ue_multiple_max); + break; + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 25,50,100 !\n", + RC.config_file_name, i, N_RB_DL); + break; + } + //TTN - for D2D //SIB18 if (strcmp(rxPool_sc_CP_Len,"normal")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_CP_Len[j] = SL_CP_Len_r12_normal; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_CP_Len[j] = SL_CP_Len_r12_normal; } else if (strcmp(rxPool_sc_CP_Len,"extended")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_CP_Len[j] = SL_CP_Len_r12_extended; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_CP_Len[j] = SL_CP_Len_r12_extended; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_sc_CP_Len choice: normal,extended!\n", - RC.config_file_name, i, rxPool_sc_CP_Len); - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_sc_CP_Len choice: normal,extended!\n", + RC.config_file_name, i, rxPool_sc_CP_Len); + if (strcmp(rxPool_sc_Period,"sf40")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf40; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf40; } else if (strcmp(rxPool_sc_Period,"sf60")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf60; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf60; } else if (strcmp(rxPool_sc_Period,"sf70")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf70; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf70; } else if (strcmp(rxPool_sc_Period,"sf80")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf80; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf80; } else if (strcmp(rxPool_sc_Period,"sf120")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf120; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf120; } else if (strcmp(rxPool_sc_Period,"sf140")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf140; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf140; } else if (strcmp(rxPool_sc_Period,"sf160")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf160; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf160; } else if (strcmp(rxPool_sc_Period,"sf240")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf240; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf240; } else if (strcmp(rxPool_sc_Period,"sf280")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf280; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf280; } else if (strcmp(rxPool_sc_Period,"sf320")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf320; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf320; } else if (strcmp(rxPool_sc_Period,"spare6")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare6; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare6; } else if (strcmp(rxPool_sc_Period,"spare5")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare5; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare5; } else if (strcmp(rxPool_sc_Period,"spare4")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare4; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare4; } else if (strcmp(rxPool_sc_Period,"spare3")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare3; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare3; } else if (strcmp(rxPool_sc_Period,"spare2")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare2; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare2; } else if (strcmp(rxPool_sc_Period,"spare")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_sc_Period choice: sf40,sf60,sf70,sf80,sf120,sf140,sf160,sf240,sf280,sf320,spare6,spare5,spare4,spare3,spare2,spare!\n", - RC.config_file_name, i, rxPool_sc_Period); - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_sc_Period choice: sf40,sf60,sf70,sf80,sf120,sf140,sf160,sf240,sf280,sf320,spare6,spare5,spare4,spare3,spare2,spare!\n", + RC.config_file_name, i, rxPool_sc_Period); + if (strcmp(rxPool_data_CP_Len,"normal")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_data_CP_Len[j] = SL_CP_Len_r12_normal; + RRC_CONFIGURATION_REQ (msg_p).rxPool_data_CP_Len[j] = SL_CP_Len_r12_normal; } else if (strcmp(rxPool_data_CP_Len,"extended")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_data_CP_Len[j] = SL_CP_Len_r12_extended; + RRC_CONFIGURATION_REQ (msg_p).rxPool_data_CP_Len[j] = SL_CP_Len_r12_extended; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_data_CP_Len choice: normal,extended!\n", - RC.config_file_name, i, rxPool_data_CP_Len); - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_data_CP_Len choice: normal,extended!\n", + RC.config_file_name, i, rxPool_data_CP_Len); + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_prb_Num[j] = rxPool_ResourceConfig_prb_Num; RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_prb_Start[j] = rxPool_ResourceConfig_prb_Start; RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_prb_End[j] = rxPool_ResourceConfig_prb_End; - + if (strcmp(rxPool_ResourceConfig_offsetIndicator_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; } else if (strcmp(rxPool_ResourceConfig_offsetIndicator_present,"prSmall")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; } else if (strcmp(rxPool_ResourceConfig_offsetIndicator_present,"prLarge")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", - RC.config_file_name, i, rxPool_ResourceConfig_offsetIndicator_present); - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", + RC.config_file_name, i, rxPool_ResourceConfig_offsetIndicator_present); + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_choice[j] = rxPool_ResourceConfig_offsetIndicator_choice; - + if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs4")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs8")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs12")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs16")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs30")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs40")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs42")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", - RC.config_file_name, i, rxPool_ResourceConfig_subframeBitmap_present); - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", + RC.config_file_name, i, rxPool_ResourceConfig_subframeBitmap_present); + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[j] = rxPool_ResourceConfig_subframeBitmap_choice_bs_buf; RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_choice_bs_size[j] = rxPool_ResourceConfig_subframeBitmap_choice_bs_size; RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[j] = rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused; - + //SIB19 - for discRxPool if (strcmp(discRxPool_cp_Len,"normal")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_cp_Len[j] = SL_CP_Len_r12_normal; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_cp_Len[j] = SL_CP_Len_r12_normal; } else if (strcmp(discRxPool_cp_Len,"extended")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_cp_Len[j] = SL_CP_Len_r12_extended; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_cp_Len[j] = SL_CP_Len_r12_extended; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_cp_Len choice: normal,extended!\n", - RC.config_file_name, i, discRxPool_cp_Len); - - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_cp_Len choice: normal,extended!\n", + RC.config_file_name, i, discRxPool_cp_Len); + + if (strcmp(discRxPool_discPeriod,"rf32")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf32; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf32; } else if (strcmp(discRxPool_discPeriod,"rf64")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf64; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf64; } else if (strcmp(discRxPool_discPeriod,"rf128")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf128; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf128; } else if (strcmp(discRxPool_discPeriod,"rf256")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf256; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf256; } else if (strcmp(discRxPool_discPeriod,"rf512")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf512; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf512; } else if (strcmp(discRxPool_discPeriod,"rf1024")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf1024; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf1024; } else if (strcmp(discRxPool_discPeriod,"rf16")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf16_v1310; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf16_v1310; } else if (strcmp(discRxPool_discPeriod,"spare")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_spare; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_spare; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_discPeriod choice: rf32,rf64,rf128,rf512,rf1024,rf16,spare!\n", - RC.config_file_name, i, discRxPool_discPeriod); - - - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_discPeriod choice: rf32,rf64,rf128,rf512,rf1024,rf16,spare!\n", + RC.config_file_name, i, discRxPool_discPeriod); + + + RRC_CONFIGURATION_REQ (msg_p).discRxPool_numRetx[j] = discRxPool_numRetx; RRC_CONFIGURATION_REQ (msg_p).discRxPool_numRepetition[j] = discRxPool_numRepetition; - - + + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_prb_Num[j] = discRxPool_ResourceConfig_prb_Num; RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_prb_Start[j] = discRxPool_ResourceConfig_prb_Start; RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_prb_End[j] = discRxPool_ResourceConfig_prb_End; - + if (strcmp(discRxPool_ResourceConfig_offsetIndicator_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; } else if (strcmp(discRxPool_ResourceConfig_offsetIndicator_present,"prSmall")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; } else if (strcmp(discRxPool_ResourceConfig_offsetIndicator_present,"prLarge")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", - RC.config_file_name, i, discRxPool_ResourceConfig_offsetIndicator_present); - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", + RC.config_file_name, i, discRxPool_ResourceConfig_offsetIndicator_present); + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_choice[j] = discRxPool_ResourceConfig_offsetIndicator_choice; - + if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs4")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs8")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs12")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs16")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs30")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs40")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs42")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", - RC.config_file_name, i, discRxPool_ResourceConfig_subframeBitmap_present); - + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", + RC.config_file_name, i, discRxPool_ResourceConfig_subframeBitmap_present); + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[j] = discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf; RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[j] = discRxPool_ResourceConfig_subframeBitmap_choice_bs_size; RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[j] = discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused; - + //SIB19 - For discRxPoolPS - if (strcmp(discRxPoolPS_cp_Len,"normal")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_cp_Len[j] = SL_CP_Len_r12_normal; - } else if (strcmp(discRxPoolPS_cp_Len,"extended")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_cp_Len[j] = SL_CP_Len_r12_extended; - } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_cp_Len choice: normal,extended!\n", - RC.config_file_name, i, discRxPoolPS_cp_Len); - - - if (strcmp(discRxPoolPS_discPeriod,"rf32")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf32; - } else if (strcmp(discRxPoolPS_discPeriod,"rf64")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf64; - } else if (strcmp(discRxPoolPS_discPeriod,"rf128")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf128; - } else if (strcmp(discRxPoolPS_discPeriod,"rf256")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf256; - } else if (strcmp(discRxPoolPS_discPeriod,"rf512")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf512; - } else if (strcmp(discRxPoolPS_discPeriod,"rf1024")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf1024; - } else if (strcmp(discRxPoolPS_discPeriod,"rf16")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf16_v1310; - } else if (strcmp(discRxPoolPS_discPeriod,"spare")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_spare; - } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_discPeriod choice: rf32,rf64,rf128,rf512,rf1024,rf16,spare!\n", - RC.config_file_name, i, discRxPoolPS_discPeriod); - - - - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_numRetx[j] = discRxPoolPS_numRetx; - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_numRepetition[j] = discRxPoolPS_numRepetition; - - - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_prb_Num[j] = discRxPoolPS_ResourceConfig_prb_Num; - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_prb_Start[j] = discRxPoolPS_ResourceConfig_prb_Start; - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_prb_End[j] = discRxPoolPS_ResourceConfig_prb_End; - - if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; - } else if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prSmall")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; - } else if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prLarge")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; - } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", - RC.config_file_name, i, discRxPoolPS_ResourceConfig_offsetIndicator_present); - - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_choice[j] = discRxPoolPS_ResourceConfig_offsetIndicator_choice; - - if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; - } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs4")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; - } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs8")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; - } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs12")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; - } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs16")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; - } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs30")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; - } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs40")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; - } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs42")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; - } else - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", - RC.config_file_name, i, discRxPoolPS_ResourceConfig_subframeBitmap_present); - - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[j] = discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf; - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[j] = discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size; - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[j] = discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused; - - + if (strcmp(discRxPoolPS_cp_Len,"normal")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_cp_Len[j] = SL_CP_Len_r12_normal; + } else if (strcmp(discRxPoolPS_cp_Len,"extended")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_cp_Len[j] = SL_CP_Len_r12_extended; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_cp_Len choice: normal,extended!\n", + RC.config_file_name, i, discRxPoolPS_cp_Len); + + + if (strcmp(discRxPoolPS_discPeriod,"rf32")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf32; + } else if (strcmp(discRxPoolPS_discPeriod,"rf64")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf64; + } else if (strcmp(discRxPoolPS_discPeriod,"rf128")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf128; + } else if (strcmp(discRxPoolPS_discPeriod,"rf256")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf256; + } else if (strcmp(discRxPoolPS_discPeriod,"rf512")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf512; + } else if (strcmp(discRxPoolPS_discPeriod,"rf1024")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf1024; + } else if (strcmp(discRxPoolPS_discPeriod,"rf16")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf16_v1310; + } else if (strcmp(discRxPoolPS_discPeriod,"spare")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_spare; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_discPeriod choice: rf32,rf64,rf128,rf512,rf1024,rf16,spare!\n", + RC.config_file_name, i, discRxPoolPS_discPeriod); + + + + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_numRetx[j] = discRxPoolPS_numRetx; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_numRepetition[j] = discRxPoolPS_numRepetition; + + + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_prb_Num[j] = discRxPoolPS_ResourceConfig_prb_Num; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_prb_Start[j] = discRxPoolPS_ResourceConfig_prb_Start; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_prb_End[j] = discRxPoolPS_ResourceConfig_prb_End; + + if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prNothing")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; + } else if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prSmall")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; + } else if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prLarge")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", + RC.config_file_name, i, discRxPoolPS_ResourceConfig_offsetIndicator_present); + + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_choice[j] = discRxPoolPS_ResourceConfig_offsetIndicator_choice; + + if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prNothing")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; + } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs4")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; + } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs8")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; + } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs12")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; + } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs16")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; + } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs30")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; + } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs40")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; + } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs42")==0) { + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", + RC.config_file_name, i, discRxPoolPS_ResourceConfig_subframeBitmap_present); + + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[j] = discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[j] = discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[j] = discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused; + + } } - char srb1path[MAX_OPTNAME_SIZE*2 + 8]; - sprintf(srb1path,"%s.%s",enbpath,ENB_CONFIG_STRING_SRB1); - int npar = config_get( SRB1Params,sizeof(SRB1Params)/sizeof(paramdef_t), srb1path); - if (npar == sizeof(SRB1Params)/sizeof(paramdef_t)) { - switch (srb1_max_retx_threshold) { - case 1: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t1; - break; - - case 2: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t2; - break; - - case 3: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t3; - break; - - case 4: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t4; - break; - - case 6: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t6; - break; - - case 8: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; - break; - - case 16: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t16; - break; - - case 32: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t32; - break; - - default: - AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_max_retx_threshold %u!\n", - RC.config_file_name, i, srb1_max_retx_threshold); - } - - - switch (srb1_poll_pdu) { - case 4: - rrc->srb1_poll_pdu = PollPDU_p4; - break; - - case 8: - rrc->srb1_poll_pdu = PollPDU_p8; - break; - - case 16: - rrc->srb1_poll_pdu = PollPDU_p16; - break; - - case 32: - rrc->srb1_poll_pdu = PollPDU_p32; - break; - - case 64: - rrc->srb1_poll_pdu = PollPDU_p64; - break; - - case 128: - rrc->srb1_poll_pdu = PollPDU_p128; - break; - - case 256: - rrc->srb1_poll_pdu = PollPDU_p256; - break; - - default: - if (srb1_poll_pdu >= 10000) - rrc->srb1_poll_pdu = PollPDU_pInfinity; - else + if (rrc->node_type == ngran_eNB_CU || rrc->node_type == ngran_ng_eNB_CU) { + char srb1path[MAX_OPTNAME_SIZE*2 + 8]; + sprintf(srb1path,"%s.%s",enbpath,ENB_CONFIG_STRING_SRB1); + int npar = config_get( SRB1Params,sizeof(SRB1Params)/sizeof(paramdef_t), srb1path); + if (npar == sizeof(SRB1Params)/sizeof(paramdef_t)) { + switch (srb1_max_retx_threshold) { + case 1: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t1; + break; + + case 2: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t2; + break; + + case 3: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t3; + break; + + case 4: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t4; + break; + + case 6: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t6; + break; + + case 8: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; + break; + + case 16: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t16; + break; + + case 32: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t32; + break; + + default: AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_pdu %u!\n", - RC.config_file_name, i, srb1_poll_pdu); - } - - rrc->srb1_poll_byte = srb1_poll_byte; - - switch (srb1_poll_byte) { - case 25: - rrc->srb1_poll_byte = PollByte_kB25; - break; - - case 50: - rrc->srb1_poll_byte = PollByte_kB50; - break; - - case 75: - rrc->srb1_poll_byte = PollByte_kB75; - break; - - case 100: - rrc->srb1_poll_byte = PollByte_kB100; - break; - - case 125: - rrc->srb1_poll_byte = PollByte_kB125; - break; - - case 250: - rrc->srb1_poll_byte = PollByte_kB250; - break; - - case 375: - rrc->srb1_poll_byte = PollByte_kB375; - break; - - case 500: - rrc->srb1_poll_byte = PollByte_kB500; - break; - - case 750: - rrc->srb1_poll_byte = PollByte_kB750; - break; - - case 1000: - rrc->srb1_poll_byte = PollByte_kB1000; - break; - - case 1250: - rrc->srb1_poll_byte = PollByte_kB1250; - break; - - case 1500: - rrc->srb1_poll_byte = PollByte_kB1500; - break; - - case 2000: - rrc->srb1_poll_byte = PollByte_kB2000; - break; - - case 3000: - rrc->srb1_poll_byte = PollByte_kB3000; - break; + "Bad config value when parsing eNB configuration file %s, enb %d srb1_max_retx_threshold %u!\n", + RC.config_file_name, i, srb1_max_retx_threshold); + } + + + switch (srb1_poll_pdu) { + case 4: + rrc->srb1_poll_pdu = PollPDU_p4; + break; + + case 8: + rrc->srb1_poll_pdu = PollPDU_p8; + break; + + case 16: + rrc->srb1_poll_pdu = PollPDU_p16; + break; + + case 32: + rrc->srb1_poll_pdu = PollPDU_p32; + break; + + case 64: + rrc->srb1_poll_pdu = PollPDU_p64; + break; + + case 128: + rrc->srb1_poll_pdu = PollPDU_p128; + break; + + case 256: + rrc->srb1_poll_pdu = PollPDU_p256; + break; + + default: + if (srb1_poll_pdu >= 10000) + rrc->srb1_poll_pdu = PollPDU_pInfinity; + else + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_pdu %u!\n", + RC.config_file_name, i, srb1_poll_pdu); + } + + rrc->srb1_poll_byte = srb1_poll_byte; + + switch (srb1_poll_byte) { + case 25: + rrc->srb1_poll_byte = PollByte_kB25; + break; + + case 50: + rrc->srb1_poll_byte = PollByte_kB50; + break; + + case 75: + rrc->srb1_poll_byte = PollByte_kB75; + break; + + case 100: + rrc->srb1_poll_byte = PollByte_kB100; + break; + + case 125: + rrc->srb1_poll_byte = PollByte_kB125; + break; + + case 250: + rrc->srb1_poll_byte = PollByte_kB250; + break; + + case 375: + rrc->srb1_poll_byte = PollByte_kB375; + break; + + case 500: + rrc->srb1_poll_byte = PollByte_kB500; + break; + + case 750: + rrc->srb1_poll_byte = PollByte_kB750; + break; - default: - if (srb1_poll_byte >= 10000) - rrc->srb1_poll_byte = PollByte_kBinfinity; - else + case 1000: + rrc->srb1_poll_byte = PollByte_kB1000; + break; + + case 1250: + rrc->srb1_poll_byte = PollByte_kB1250; + break; + + case 1500: + rrc->srb1_poll_byte = PollByte_kB1500; + break; + + case 2000: + rrc->srb1_poll_byte = PollByte_kB2000; + break; + + case 3000: + rrc->srb1_poll_byte = PollByte_kB3000; + break; + + default: + if (srb1_poll_byte >= 10000) + rrc->srb1_poll_byte = PollByte_kBinfinity; + else + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_byte %u!\n", + RC.config_file_name, i, srb1_poll_byte); + } + + if (srb1_timer_poll_retransmit <= 250) { + rrc->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 5)/5; + } else if (srb1_timer_poll_retransmit <= 500) { + rrc->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 300)/50 + 50; + } else { AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_byte %u!\n", - RC.config_file_name, i, srb1_poll_byte); - } - - if (srb1_timer_poll_retransmit <= 250) { - rrc->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 5)/5; - } else if (srb1_timer_poll_retransmit <= 500) { - rrc->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 300)/50 + 50; + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_poll_retransmit %u!\n", + RC.config_file_name, i, srb1_timer_poll_retransmit); + } + + if (srb1_timer_status_prohibit <= 250) { + rrc->srb1_timer_status_prohibit = srb1_timer_status_prohibit/5; + } else if ((srb1_timer_poll_retransmit >= 300) && (srb1_timer_poll_retransmit <= 500)) { + rrc->srb1_timer_status_prohibit = (srb1_timer_status_prohibit - 300)/50 + 51; + } else { + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_status_prohibit %u!\n", + RC.config_file_name, i, srb1_timer_status_prohibit); + } + + switch (srb1_timer_reordering) { + case 0: + rrc->srb1_timer_reordering = T_Reordering_ms0; + break; + + case 5: + rrc->srb1_timer_reordering = T_Reordering_ms5; + break; + + case 10: + rrc->srb1_timer_reordering = T_Reordering_ms10; + break; + + case 15: + rrc->srb1_timer_reordering = T_Reordering_ms15; + break; + + case 20: + rrc->srb1_timer_reordering = T_Reordering_ms20; + break; + + case 25: + rrc->srb1_timer_reordering = T_Reordering_ms25; + break; + + case 30: + rrc->srb1_timer_reordering = T_Reordering_ms30; + break; + + case 35: + rrc->srb1_timer_reordering = T_Reordering_ms35; + break; + + case 40: + rrc->srb1_timer_reordering = T_Reordering_ms40; + break; + + case 45: + rrc->srb1_timer_reordering = T_Reordering_ms45; + break; + + case 50: + rrc->srb1_timer_reordering = T_Reordering_ms50; + break; + + case 55: + rrc->srb1_timer_reordering = T_Reordering_ms55; + break; + + case 60: + rrc->srb1_timer_reordering = T_Reordering_ms60; + break; + + case 65: + rrc->srb1_timer_reordering = T_Reordering_ms65; + break; + + case 70: + rrc->srb1_timer_reordering = T_Reordering_ms70; + break; + + case 75: + rrc->srb1_timer_reordering = T_Reordering_ms75; + break; + + case 80: + rrc->srb1_timer_reordering = T_Reordering_ms80; + break; + + case 85: + rrc->srb1_timer_reordering = T_Reordering_ms85; + break; + + case 90: + rrc->srb1_timer_reordering = T_Reordering_ms90; + break; + + case 95: + rrc->srb1_timer_reordering = T_Reordering_ms95; + break; + + case 100: + rrc->srb1_timer_reordering = T_Reordering_ms100; + break; + + case 110: + rrc->srb1_timer_reordering = T_Reordering_ms110; + break; + + case 120: + rrc->srb1_timer_reordering = T_Reordering_ms120; + break; + + case 130: + rrc->srb1_timer_reordering = T_Reordering_ms130; + break; + + case 140: + rrc->srb1_timer_reordering = T_Reordering_ms140; + break; + + case 150: + rrc->srb1_timer_reordering = T_Reordering_ms150; + break; + + case 160: + rrc->srb1_timer_reordering = T_Reordering_ms160; + break; + + case 170: + rrc->srb1_timer_reordering = T_Reordering_ms170; + break; + + case 180: + rrc->srb1_timer_reordering = T_Reordering_ms180; + break; + + case 190: + rrc->srb1_timer_reordering = T_Reordering_ms190; + break; + + case 200: + rrc->srb1_timer_reordering = T_Reordering_ms200; + break; + + default: + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_reordering %u!\n", + RC.config_file_name, i, srb1_timer_reordering); + } + } else { - AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_poll_retransmit %u!\n", - RC.config_file_name, i, srb1_timer_poll_retransmit); + rrc->srb1_timer_poll_retransmit = T_PollRetransmit_ms80; + rrc->srb1_timer_reordering = T_Reordering_ms35; + rrc->srb1_timer_status_prohibit = T_StatusProhibit_ms0; + rrc->srb1_poll_pdu = PollPDU_p4; + rrc->srb1_poll_byte = PollByte_kBinfinity; + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; } - - if (srb1_timer_status_prohibit <= 250) { - rrc->srb1_timer_status_prohibit = srb1_timer_status_prohibit/5; - } else if ((srb1_timer_poll_retransmit >= 300) && (srb1_timer_poll_retransmit <= 500)) { - rrc->srb1_timer_status_prohibit = (srb1_timer_status_prohibit - 300)/50 + 51; - } else { - AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_status_prohibit %u!\n", - RC.config_file_name, i, srb1_timer_status_prohibit); + + /* + // Network Controller + subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG); + + if (subsetting != NULL) { + if ( ( + config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME, + (const char **)&flexran_agent_interface_name) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS, + (const char **)&flexran_agent_ipv4_address) + && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT, + &flexran_agent_port) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE, + (const char **)&flexran_agent_cache) + ) + ) { + enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_interface_name = strdup(flexran_agent_interface_name); + cidr = flexran_agent_ipv4_address; + address = strtok(cidr, "/"); + //enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address = strdup(address); + if (address) { + IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); } - - switch (srb1_timer_reordering) { - case 0: - rrc->srb1_timer_reordering = T_Reordering_ms0; - break; - - case 5: - rrc->srb1_timer_reordering = T_Reordering_ms5; - break; - - case 10: - rrc->srb1_timer_reordering = T_Reordering_ms10; - break; - - case 15: - rrc->srb1_timer_reordering = T_Reordering_ms15; - break; - - case 20: - rrc->srb1_timer_reordering = T_Reordering_ms20; - break; - - case 25: - rrc->srb1_timer_reordering = T_Reordering_ms25; - break; - - case 30: - rrc->srb1_timer_reordering = T_Reordering_ms30; - break; - - case 35: - rrc->srb1_timer_reordering = T_Reordering_ms35; - break; - - case 40: - rrc->srb1_timer_reordering = T_Reordering_ms40; - break; - - case 45: - rrc->srb1_timer_reordering = T_Reordering_ms45; - break; - - case 50: - rrc->srb1_timer_reordering = T_Reordering_ms50; - break; - - case 55: - rrc->srb1_timer_reordering = T_Reordering_ms55; - break; - - case 60: - rrc->srb1_timer_reordering = T_Reordering_ms60; - break; - - case 65: - rrc->srb1_timer_reordering = T_Reordering_ms65; - break; - - case 70: - rrc->srb1_timer_reordering = T_Reordering_ms70; - break; - - case 75: - rrc->srb1_timer_reordering = T_Reordering_ms75; - break; - - case 80: - rrc->srb1_timer_reordering = T_Reordering_ms80; - break; - - case 85: - rrc->srb1_timer_reordering = T_Reordering_ms85; - break; - - case 90: - rrc->srb1_timer_reordering = T_Reordering_ms90; - break; - - case 95: - rrc->srb1_timer_reordering = T_Reordering_ms95; - break; - - case 100: - rrc->srb1_timer_reordering = T_Reordering_ms100; - break; - - case 110: - rrc->srb1_timer_reordering = T_Reordering_ms110; - break; - - case 120: - rrc->srb1_timer_reordering = T_Reordering_ms120; - break; - - case 130: - rrc->srb1_timer_reordering = T_Reordering_ms130; - break; - - case 140: - rrc->srb1_timer_reordering = T_Reordering_ms140; - break; - - case 150: - rrc->srb1_timer_reordering = T_Reordering_ms150; - break; - - case 160: - rrc->srb1_timer_reordering = T_Reordering_ms160; - break; - - case 170: - rrc->srb1_timer_reordering = T_Reordering_ms170; - break; - - case 180: - rrc->srb1_timer_reordering = T_Reordering_ms180; - break; - - case 190: - rrc->srb1_timer_reordering = T_Reordering_ms190; - break; - - case 200: - rrc->srb1_timer_reordering = T_Reordering_ms200; - break; - - default: - AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_reordering %u!\n", - RC.config_file_name, i, srb1_timer_reordering); + + enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_port = flexran_agent_port; + enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_cache = strdup(flexran_agent_cache); } - - } else { - rrc->srb1_timer_poll_retransmit = T_PollRetransmit_ms80; - rrc->srb1_timer_reordering = T_Reordering_ms35; - rrc->srb1_timer_status_prohibit = T_StatusProhibit_ms0; - rrc->srb1_poll_pdu = PollPDU_p4; - rrc->srb1_poll_byte = PollByte_kBinfinity; - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; - } - - /* - // Network Controller - subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG); - - if (subsetting != NULL) { - if ( ( - config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME, - (const char **)&flexran_agent_interface_name) - && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS, - (const char **)&flexran_agent_ipv4_address) - && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT, - &flexran_agent_port) - && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE, - (const char **)&flexran_agent_cache) - ) - ) { - enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_interface_name = strdup(flexran_agent_interface_name); - cidr = flexran_agent_ipv4_address; - address = strtok(cidr, "/"); - //enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address = strdup(address); - if (address) { - IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); - } - - enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_port = flexran_agent_port; - enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_cache = strdup(flexran_agent_cache); } + */ + break; } - */ - break; + } } - - } + } } return 0; } @@ -2350,6 +2340,131 @@ int RCconfig_gtpu(void ) { return 0; } +int RCconfig_CU_F1(uint32_t i) { + + AssertFatal(1==0,"Shouldn't get here yet\n"); +} + +int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { + + int k; + + paramdef_t ENBSParams[] = ENBSPARAMS_DESC; + + paramdef_t ENBParams[] = ENBPARAMS_DESC; + paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0}; + + config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); + int num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; + AssertFatal (i<num_enbs, + "Failed to parse config file no %ith element in %s \n",i, ENB_CONFIG_STRING_ACTIVE_ENBS); + + if (num_enbs>0) { + // Output a list of all eNBs. + config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL); + AssertFatal(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr != NULL, + "eNB id %d is not defined in configuration file\n",i); + for (k=0; k <num_enbs ; k++) { + if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) { + + paramdef_t SCTPParams[] = SCTPPARAMS_DESC; + paramdef_t NETParams[] = NETPARAMS_DESC; + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + + F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); + LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); + + F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name); + + F1AP_SETUP_REQ (msg_p).tac[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).tac[k]); + + F1AP_SETUP_REQ (msg_p).mcc[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mcc[k]); + + F1AP_SETUP_REQ (msg_p).mnc[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc[k]); + + F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); + + AssertFatal((F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 2) || + (F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 3), + "BAD MNC DIGIT LENGTH %d", + F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); + + LOG_I(ENB_APP,"F1AP: CU_ip4_address %s\n",RC.mac[k]->eth_params_n.remote_addr); + LOG_I(ENB_APP,"FIAP: CU_ip4_address %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.remote_addr)); + + strcpy(F1AP_SETUP_REQ (msg_p).CU_ipv4_address, + RC.mac[k]->eth_params_n.remote_addr); + //strcpy(F1AP_SETUP_REQ (msg_p).CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); + F1AP_SETUP_REQ (msg_p).CU_port = RC.mac[k]->eth_params_n.remote_portc; + + sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG); + config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); + F1AP_SETUP_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr); + F1AP_SETUP_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr); + + eNB_RRC_INST *rrc = RC.rrc[k]; + // wait until RRC cell information is configured + int cell_info_configured=0; + do { + LOG_I(ENB_APP,"ngran_eNB_DU: Waiting for basic cell configuration\n"); + usleep(100000); + pthread_mutex_lock(&rrc->cell_info_mutex); + cell_info_configured = rrc->cell_info_configured; + pthread_mutex_unlock(&rrc->cell_info_mutex); + } while (cell_info_configured ==0); + + + F1AP_SETUP_REQ (msg_p).nr_pci[k] = rrc->carrier[0].physCellId; + F1AP_SETUP_REQ (msg_p).nr_cellid[k] = 0; + F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0; + if (rrc->carrier[0].sib1->tdd_Config) { + + LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, + rrc->carrier[0].dl_CarrierFreq); + // For LTE use scs field to carry prefix type and number of antennas + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.scs = (rrc->carrier[0].Ncp<<2)+rrc->carrier[0].p_eNB;; + // use nrb field to hold LTE N_RB_DL (0...5) + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->carrier[0].mib.message.dl_Bandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->carrier[0].mib.message.dl_Bandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; + } + else { + LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); + + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, + rrc->carrier[0].dl_CarrierFreq); + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_arfcn = F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn; + // For LTE use scs field to carry prefix type and number of antennas + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_scs = (rrc->carrier[0].Ncp<<2)+rrc->carrier[0].p_eNB;; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_scs = rrc->carrier[0].Ncp; + // use nrb field to hold LTE N_RB_DL (0...5) + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = rrc->carrier[0].mib.message.dl_Bandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = rrc->carrier[0].mib.message.dl_Bandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; + } + F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = NULL; + F1AP_SETUP_REQ (msg_p).ranac[k] = 0; + F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier[0].MIB; + F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier[0].SIB1; + + break; + } + } + } + + return 0; + +} int RCconfig_S1(MessageDef *msg_p, uint32_t i) { @@ -2556,7 +2671,7 @@ void RCConfig(void) { char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - RCconfig_cudu(); + // RCconfig_cudu(); /* get global parameters, defined outside any section in the config file */ @@ -2579,6 +2694,9 @@ void RCConfig(void) { config_getlist( &MACRLCParamList,NULL,0, NULL); RC.nb_macrlc_inst = MACRLCParamList.numelt; + AssertFatal(RC.nb_macrlc_inst <= MAX_MAC_INST, + "Too many macrlc instances %d\n",RC.nb_macrlc_inst); + // Get num L1 instances config_getlist( &L1ParamList,NULL,0, NULL); RC.nb_L1_inst = L1ParamList.numelt; diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 3e645b458c..33076c6e3f 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -40,6 +40,7 @@ #include "PHY/impl_defs_lte.h" #include "PHY/defs_eNB.h" #include "s1ap_messages_types.h" +#include "f1ap_messages_types.h" #ifdef CMAKER #include "SystemInformationBlockType2.h" #include "rrc_messages_types.h" @@ -134,7 +135,7 @@ typedef struct ru_config_s { extern void RCconfig_RU(void); extern void RCconfig_flexran(void); extern void RCconfig_L1(void); -extern void RCconfig_macrlc(void); +extern void RCconfig_macrlc(int*); extern void UE_config_stub_pnf(void); extern int RCconfig_gtpu(void ); extern void RCConfig(void); @@ -144,6 +145,9 @@ void ru_config_display(void); int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc); int RCconfig_S1(MessageDef *msg_p, uint32_t i); +int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i); +int RCconfig_CU_F1(uint32_t i); + void RCconfig_cudu(void); cudu_params_t *get_cudu_config(void); diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 4d9f0cc5f8..a610d6ed55 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -36,6 +36,9 @@ #include "platform_types.h" #include "log.h" + + + /* This structure describes association of a DU to a CU */ typedef struct f1ap_info { diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 884e3dcfe7..22dc981565 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -394,6 +394,14 @@ extern int asn1_xer_print; //Forward declaration //struct f1ap_message_s; +typedef struct net_ip_address_s { + unsigned ipv4:1; + unsigned ipv6:1; + char ipv4_address[16]; + char ipv6_address[46]; +} net_ip_address_t; + + typedef struct f1ap_message_s { F1AP_ProtocolIE_ID_t id; F1AP_Criticality_t criticality; diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index d9e914f087..7e43c86d14 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -82,6 +82,7 @@ * @{ */ +#define MAX_MAC_INST 16 #define BCCH_PAYLOAD_SIZE_MAX 128 #define CCCH_PAYLOAD_SIZE_MAX 128 #define PCCH_PAYLOAD_SIZE_MAX 128 diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index da2d977875..1532bbd7c2 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -104,9 +104,9 @@ void mac_top_init_eNB(void) "Could not initialize RLC layer\n"); // These should be out of here later - pdcp_layer_init(); + //pdcp_layer_init(); - rrc_init_global_param(); + // rrc_init_global_param(); } else { RC.mac = NULL; diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index e21cb9255a..9767cc6ee9 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -36,6 +36,7 @@ #include <string.h> #include "collection/tree.h" +#include "common/ngran_types.h" #include "rrc_types.h" //#include "PHY/phy_defs.h" #include "LAYER2/RLC/rlc.h" @@ -673,8 +674,10 @@ typedef struct { uint32_t sizeof_paging[MAX_MOBILES_PER_ENB]; } rrc_eNB_carrier_data_t; + typedef struct eNB_RRC_INST_s { /// southbound midhaul configuration + ngran_node_t node_type; eth_params_t eth_params_s; rrc_eNB_carrier_data_t carrier[MAX_NUM_CCs]; uid_allocator_t uid_allocator; // for rrc_ue_head @@ -715,6 +718,8 @@ typedef struct eNB_RRC_INST_s { int srb1_timer_reordering; int srb1_timer_status_prohibit; int srs_enable[MAX_NUM_CCs]; + int cell_info_configured; + pthread_mutex_t cell_info_mutex; } eNB_RRC_INST; #define MAX_UE_CAPABILITY_SIZE 255 diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index b0b444084c..bed228a499 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -156,273 +156,338 @@ init_SI( #endif LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); + eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id]; + rrc_eNB_carrier_data_t *carrier=&rrc->carrier[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4); - // copy basic parameters - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; + carrier->MIB = (uint8_t*) malloc16(4); + carrier->sizeof_SIB1 = 0; + carrier->sizeof_SIB23 = 0; + carrier->SIB1 = (uint8_t*) malloc16(32); + + AssertFatal(carrier->SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + + if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU) { + // copy basic Cell parameters + carrier->physCellId = configuration->Nid_cell[CC_id]; + carrier->p_eNB = configuration->nb_antenna_ports[CC_id]; + carrier->Ncp = configuration->prefix_type[CC_id]; + carrier->dl_CarrierFreq = configuration->downlink_frequency[CC_id]; + carrier->ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition = configuration->pbch_repetition[CC_id]; + carrier->pbch_repetition = configuration->pbch_repetition[CC_id]; #endif - LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", - (int)configuration->N_RB_DL[CC_id], - (int)configuration->phich_resource[CC_id], - (int)configuration->phich_duration[CC_id]); - do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id], + + LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", + (int)configuration->N_RB_DL[CC_id], + (int)configuration->phich_resource[CC_id], + (int)configuration->phich_duration[CC_id]); + do_MIB(&rrc->carrier[CC_id], #ifdef ENABLE_ITTI - configuration->N_RB_DL[CC_id], - configuration->phich_resource[CC_id], - configuration->phich_duration[CC_id] + configuration->N_RB_DL[CC_id], + configuration->phich_resource[CC_id], + configuration->phich_duration[CC_id] #else - 50,0,0 + 50,0,0 #endif - ,0); - - - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t*) malloc16(32); - - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id + ,0); + + + carrier->sizeof_SIB1 = do_SIB1(&rrc->carrier[CC_id],ctxt_pP->module_id,CC_id #if defined(ENABLE_ITTI) - , configuration + , configuration #endif - ); - - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); + ); + + AssertFatal(carrier->sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t*) malloc16(64); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB"); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = do_SIB23( - ctxt_pP->module_id, - - CC_id + } + else if (rrc->node_type != ngran_eNB_DU) { + + carrier->SIB23 = (uint8_t*) malloc16(64); + AssertFatal(carrier->SIB23!=NULL,"cannot allocate memory for SIB"); + carrier->sizeof_SIB23 = do_SIB23( + ctxt_pP->module_id, + + CC_id #if defined(ENABLE_ITTI) - , configuration + , configuration #endif - ); - - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); - - - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.n_SB); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.hoppingMode); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.pusch_HoppingOffset); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.enable64QAM); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.groupHoppingEnabled); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.cyclicShift); - + ); + + AssertFatal(carrier->sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); + + + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.n_SB); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.hoppingMode); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.pusch_HoppingOffset); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.enable64QAM); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupHoppingEnabled); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.cyclicShift); + #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - - if (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag > 0) { - for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count; i++) { - // SIB 2 - // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n", + + if (carrier->MBMS_flag > 0) { + for (i = 0; i < carrier->sib2->mbsfn_SubframeConfigList->list.count; i++) { + // SIB 2 + // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + carrier->sib2->mbsfn_SubframeConfigList->list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); + } + +#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + // SIB13 + for (i = 0; i < carrier->sib13->mbsfn_AreaInfoList_r9.list.count; i++) { + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + carrier->sib13->mbsfn_AreaInfoList_r9.list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); + } +#endif + } + else memset((void*)&carrier->sib13,0,sizeof(carrier->sib13)); + + //TTN - SIB 18 + for (int j = 0; j < carrier->sib18->commConfig_r12->commRxPool_r12.list.count; j++) { + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB18 %d/%d \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + j+1, + carrier->sib18->commConfig_r12->commRxPool_r12.list.count); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 rxPool_sc_CP_Len: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_CP_Len_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 sc_Period_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_Period_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 data_CP_Len_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->data_CP_Len_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Num_r12: %ld \n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - i, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n", + carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Num_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Start_r12: %ld \n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n", + carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Start_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_End_r12: %ld \n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n", + carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_End_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 offsetIndicator: %ld \n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); + carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 subframeBitmap_choice_bs_buf: %s \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf); + } - -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - // SIB13 - for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) { - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n", + + //TTN - SIB 19 + for (int j = 0; j < carrier->sib19->discConfig_r12->discRxPool_r12.list.count; j++) { + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB19 %d/%d \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + j+1, + carrier->sib19->discConfig_r12->discRxPool_r12.list.count); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 cp_Len_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->cp_Len_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 discPeriod_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->discPeriod_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRetx_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRetx_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRepetition_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRepetition_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Num_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Num_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Start_r12: %ld \n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - i, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n", + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Start_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_End_r12: %ld \n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n", + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_End_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 offsetIndicator: %ld \n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 subframeBitmap_choice_bs_buf: %s \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + carrier->sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf); + } + #endif } - else memset((void*)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13)); - - //TTN - SIB 18 - for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count; j++) { - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB18 %d/%d \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - j+1, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 rxPool_sc_CP_Len: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_CP_Len_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 sc_Period_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_Period_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 data_CP_Len_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->data_CP_Len_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Num_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Num_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Start_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Start_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_End_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_End_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 offsetIndicator: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 subframeBitmap_choice_bs_buf: %s \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf); - - } - - //TTN - SIB 19 - for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count; j++) { - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB19 %d/%d \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - j+1, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 cp_Len_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->cp_Len_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 discPeriod_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->discPeriod_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRetx_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRetx_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRepetition_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRepetition_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Num_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Num_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Start_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Start_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_End_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_End_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 offsetIndicator: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 subframeBitmap_choice_bs_buf: %s \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf); - - } - -#endif - + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + // LTE-M stuff here (take out CU-DU for now) + if (rrc->node_type == ngran_eNB) { #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) && - (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) { - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL, + if ((carrier->mib.message.schedulingInfoSIB1_BR_r13>0) && + (carrier->sib1_BR!=NULL)) { + AssertFatal(carrier->sib1_BR->nonCriticalExtension!=NULL, "sib2_br->nonCriticalExtension is null (v8.9)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL, + AssertFatal(carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL, "sib2_br->nonCriticalExtension is null (v9.2)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + AssertFatal(carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, "sib2_br->nonCriticalExtension is null (v11.3)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + AssertFatal(carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, "sib2_br->nonCriticalExtension is null (v12.5)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + AssertFatal(carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, "sib2_br->nonCriticalExtension is null (v13.10)\n"); - sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension; - } + sib1_v13ext = carrier->sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension; + } #endif - - LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n"); - - rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, + + } + if (rrc->node_type == ngran_eNB_DU) { + LOG_D(RRC, "About to call rrc_mac_config_req_eNB for ngran_eNB_DU\n"); + + rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, + carrier->physCellId, + carrier->p_eNB, + carrier->Ncp, + carrier->sib1->freqBandIndicator, + carrier->dl_CarrierFreq, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition, + carrier->pbch_repetition, #endif - 0, // rnti - (BCCH_BCH_Message_t *) - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib, - (RadioResourceConfigCommonSIB_t *) & - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon, + 0, // rnti + (BCCH_BCH_Message_t *) + &carrier->mib, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) & - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (struct PhysicalConfigDedicated *)NULL, + (struct PhysicalConfigDedicated *)NULL, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + carrier->sib1->tdd_Config, + NULL, + &carrier->sib1->schedulingInfoList, + carrier->ul_CarrierFreq, + NULL, + NULL, + NULL +#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , + carrier->MBMS_flag, + NULL, + (PMCH_InfoList_r9_t *) NULL #endif - (MeasObjectToAddMod_t **) NULL, - (MAC_MainConfig_t *) NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *) NULL, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config, - NULL, - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth, - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, - (MBSFN_SubframeConfigList_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList +#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + NULL +#endif + ); + } + else if (rrc->node_type == ngran_eNB) { + LOG_D(RRC, "About to call rrc_mac_config_req_eNB for ngran_eNB\n"); + + rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, + carrier->physCellId, + carrier->p_eNB, + carrier->Ncp, + carrier->sib1->freqBandIndicator, + carrier->dl_CarrierFreq, +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + carrier->pbch_repetition, +#endif + 0, // rnti + (BCCH_BCH_Message_t *) + &carrier->mib, + (RadioResourceConfigCommonSIB_t *) & + carrier->sib2->radioResourceConfigCommon, +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (RadioResourceConfigCommonSIB_t *) & + carrier->sib2_BR->radioResourceConfigCommon, +#endif + (struct PhysicalConfigDedicated *)NULL, +#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + carrier->sib1->tdd_Config, + NULL, + &carrier->sib1->schedulingInfoList, + carrier->ul_CarrierFreq, + carrier->sib2->freqInfo.ul_Bandwidth, + &carrier->sib2->freqInfo.additionalSpectrumEmission, + (MBSFN_SubframeConfigList_t*) carrier->sib2->mbsfn_SubframeConfigList #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag, - (MBSFN_AreaInfoList_r9_t*) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, - (PMCH_InfoList_r9_t *) NULL + , + carrier->MBMS_flag, + (MBSFN_AreaInfoList_r9_t*) & carrier->sib13->mbsfn_AreaInfoList_r9, + (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - sib1_v13ext + , + sib1_v13ext #endif - ); + ); + } + // set flag to indicate that cell information is configured. This is required in DU to trigger F1AP_SETUP procedure. + pthread_mutex_lock(&rrc->cell_info_mutex); + rrc->cell_info_configured=1; + pthread_mutex_unlock(&rrc->cell_info_mutex); } #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) @@ -5849,6 +5914,10 @@ rrc_eNB_generate_RRCConnectionSetup( ue_context_pP->ue_context.ue_release_timer_thres=1000; } +void setup_ngran_CU(eNB_RRC_INST *rrc) { + + +} #if defined(ENABLE_ITTI) //----------------------------------------------------------------------------- @@ -5901,6 +5970,9 @@ openair_rrc_eNB_init( // } RC.rrc[ctxt.module_id]->Nb_ue = 0; + pthread_mutex_init(&RC.rrc[ctxt.module_id]->cell_info_mutex,NULL); + RC.rrc[ctxt.module_id]->cell_info_configured = 0; + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { RC.rrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0; } @@ -6008,8 +6080,12 @@ openair_rrc_eNB_init( openair_rrc_top_init_eNB(RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0); } + openair_rrc_on(&ctxt); - + + if (RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) + setup_ngran_CU(RC.rrc[ctxt.module_id]); + return 0; } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index e84f99e67f..bf07e93f39 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1062,7 +1062,7 @@ int main( int argc, char **argv ) #if defined(ENABLE_ITTI) if (RC.nb_inst > 0) { - // don't create if node doesn't connect to RRC/S1/GTP + // don't create if node doesn't connect to RRC/S1/F1/GTP if (create_tasks(1) < 0) { printf("cannot create ITTI tasks\n"); exit(-1); // need a softer mode -- GitLab From c8c803235885e7b62d28abd2b76a1f8934f5dbf5 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Tue, 4 Sep 2018 09:25:02 +0200 Subject: [PATCH 021/308] initial DU part for F1AP_setup_resp --- openair2/ENB_APP/enb_app.c | 52 +++++++++++++++++++++++++++++++++-- openair2/ENB_APP/enb_config.c | 20 ++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 0008361d93..f0dd39d3e6 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -217,8 +217,7 @@ void *eNB_app_task(void *args_p) configure_rrc(enb_id); if (RC.nb_macrlc_inst >0 && mac_has_f1[enb_id]==1) RC.rrc[enb_id]->node_type = ngran_eNB_DU; - - pdcp_layer_init(); + else pdcp_layer_init(); } @@ -252,8 +251,11 @@ void *eNB_app_task(void *args_p) # if defined(ENABLE_USE_MME) case S1AP_REGISTER_ENB_CNF: + AssertFatal(RC.rrc[0]->node_type != ngran_eNB_DU, "Should not have received S1AP_REGISTER_ENB_CNF\n"); + LOG_I(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), - S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); + S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); + DevAssert(register_enb_pending > 0); register_enb_pending--; @@ -291,6 +293,50 @@ void *eNB_app_task(void *args_p) break; + case F1AP_SETUP_RESP: + AssertFatal(RC.rrc[0]->node_type == ngran_eNB_DU, "Should not have received F1AP_REGISTER_ENB_CNF\n"); + + LOG_I(ENB_APP, "[eNB %d] Received %s: associated ngran_eNB_CU %s with %d cells to activate\n", instance, ITTI_MSG_NAME (msg_p), + F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate); + + handle_f1ap_setup_resp(&F1AP_SETUP_RESP(msg_p)); + + DevAssert(register_enb_pending > 0); + register_enb_pending--; + + /* Check if at least eNB is registered with one MME */ + if (F1AP_SETUP_RESP(msg_p).num_cells_to_activate > 0) { + registered_enb++; + } + + /* Check if all register eNB requests have been processed */ + if (register_enb_pending == 0) { + if (registered_enb == enb_nb) { + /* If all eNB cells are registered, start L2L1 task */ + MessageDef *msg_init_p; + + msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE); + itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); + + } else { + LOG_W(ENB_APP, " %d eNB not associated with a MME, retrying registration in %d seconds ...\n", + enb_nb - registered_enb, ENB_REGISTER_RETRY_DELAY); + + /* Restart the eNB registration process in ENB_REGISTER_RETRY_DELAY seconds */ + if (timer_setup (ENB_REGISTER_RETRY_DELAY, 0, TASK_ENB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, + NULL, &enb_register_retry_timer_id) < 0) { + LOG_E(ENB_APP, " Can not start eNB register retry timer, use \"sleep\" instead!\n"); + + sleep(ENB_REGISTER_RETRY_DELAY); + /* Restart the registration process */ + registered_enb = 0; + register_enb_pending = eNB_app_register (RC.rrc[0]->node_type,enb_id_start, enb_id_end);//, enb_properties_p); + } + } + } + + break; + case S1AP_DEREGISTERED_ENB_IND: LOG_W(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 9cbb6cc9c8..3511aa021f 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2706,3 +2706,23 @@ void RCConfig(void) { RC.nb_RU = RUParamList.numelt; } + +void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { + + + int i,j,si_ind; + AssertFatal(1==0, "Shouldn't get here yet\n"); + /* + for (j=0;j<resp->num_cells_to_activate;j++) { + for (i=0;i<RC.nb_inst;i++) { + rrc_eNB_carrier_data_t *carrier = &RC.rrc[i]->carrier[0]; + // identify local index of cell j by plmn identity + if (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && + resp->nrpci[j] == carrier->physCellId) { + // copy system information and decode it to perform MAC/L1 common configuration + for (si_ind=0;si_ind<resp->num_SI[j];si_ind++) { + + } + } + */ +} -- GitLab From b584ddeda819633f98ff6a0a32b0b336b4bf7038 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Tue, 4 Sep 2018 09:36:01 +0200 Subject: [PATCH 022/308] added configuration files for cu/du, ngran_types.h --- common/ngran_types.h | 47 +++++ .../PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf | 190 ++++++++++++++++++ .../CONF/du.lte.band7.10MHz.if4p5.conf | 108 ++++++++++ 3 files changed, 345 insertions(+) create mode 100644 common/ngran_types.h create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf diff --git a/common/ngran_types.h b/common/ngran_types.h new file mode 100644 index 0000000000..1fe48e372b --- /dev/null +++ b/common/ngran_types.h @@ -0,0 +1,47 @@ +/* + * 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 common/ngran_types.h +* \brief Definitions for NGRAN node types +* \author R. Knopp +* \date 2018 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ + +#ifndef __NGRAN_TYPES_H__ +#define __NGRAN_TYPES_H__ + +typedef enum { + ngran_eNB = 0, + ngran_ng_eNB = 1, + ngran_gNB = 2, + ngran_eNB_CU = 3, + ngran_ng_eNB_CU = 4, + ngran_gNB_CU = 5, + ngran_eNB_DU = 6, + ngran_gNB_DU = 7 +} ngran_node_t; + +#endif diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf new file mode 100644 index 0000000000..b740b02172 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf @@ -0,0 +1,190 @@ +Active_eNBs = ( "eNB-Eurecom-LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-CU-Eurecom-LTEBox"; + + tr_s_preference = "f1" + + local_s_if_name = "lo"; + remote_s_address = "127.0.0.1"; + local_s_address = "127.0.0.2"; + local_s_portc = 60001; + remote_s_portc = 60000; + local_s_portd = 60011; + remote_s_portd = 60010; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_eNO"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -27; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "127.0.0.3"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; + ENB_INTERFACE_NAME_FOR_S1U = "lo"; + ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +log_config = + { + global_log_level ="info"; + global_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf new file mode 100644 index 0000000000..bdf89ac364 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf @@ -0,0 +1,108 @@ +Active_eNBs = ( "eNB-Eurecom-DU"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_CU_ID = 0xe00; + + eNB_name = "eNB-Eurecom-DU"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "93"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_eNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2685000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + } + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "f1"; + local_n_if_name = "lo"; + remote_n_address = "127.0.0.2"; + local_n_address = "127.0.0.1"; + local_n_portc = 60000; + remote_n_portc = 60001; + local_n_portd = 60010; + remote_n_portd = 60011; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_if_name = "eth1"; + remote_address = "10.10.10.19"; + local_address = "10.10.10.18"; + local_portc = 50000; + remote_portc = 50000; + local_portd = 50001; + remote_portd = 50001; + local_rf = "no" + tr_preference = "udp_if4p5" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + eNB_instances = [0]; + } +); + +log_config = { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; +}; -- GitLab From e2dd22b6ae85cd050ec78137d3f1834cde1a45bf Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Tue, 4 Sep 2018 23:07:46 +0200 Subject: [PATCH 023/308] added parsing of F1AP_SETUP_RESP message and subsequent RAN configuration in DU --- openair2/COMMON/f1ap_messages_types.h | 8 +- openair2/ENB_APP/enb_config.c | 227 +++++++++++++++++++++++++- 2 files changed, 227 insertions(+), 8 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 61854e2048..3305ffd256 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -132,8 +132,9 @@ typedef struct f1ap_setup_req_s { // System Information uint8_t *mib[F1AP_MAX_NB_CELLS]; + int mib_length[F1AP_MAX_NB_CELLS]; uint8_t *sib1[F1AP_MAX_NB_CELLS]; - + int sib1_length[F1AP_MAX_NB_CELLS]; } f1ap_setup_req_t; @@ -155,6 +156,7 @@ typedef struct f1ap_setup_resp_s { uint8_t num_SI[F1AP_MAX_NB_CELLS]; /// SI message containers (up to 21 messages per cell) uint8_t *SI_container[F1AP_MAX_NB_CELLS][21]; + int SI_container_length[F1AP_MAX_NB_CELLS][21]; } f1ap_setup_resp_t; typedef struct f1ap_setup_failure_s { @@ -171,6 +173,7 @@ typedef struct f1ap_dl_rrc_message_s { uint8_t srb_id; uint8_t execute_duplication; uint8_t *rrc_container; + int rrc_container_length; union { // both map 0..255 => 1..256 uint8_t en_dc; @@ -188,7 +191,9 @@ typedef struct f1ap_initial_ul_rrc_message_s { uint8_t mnc_digit_length; uint16_t crnti; uint8_t *rrc_container; + int rrc_container_length; uint8_t *du2cu_rrc_container; + int du2cu_rrc_container_length; } f1ap_initial_ul_rrc_message_t; typedef struct f1ap_ul_rrc_message_s { @@ -196,6 +201,7 @@ typedef struct f1ap_ul_rrc_message_s { uint32_t gNB_DU_ue_id; uint8_t srb_id; uint8_t *rrc_container; + int rrc_container_length; } f1ap_ul_rrc_message_t; /*typedef struct f1ap_ue_context_setup_req_s { diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 3511aa021f..84bf7b0f29 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -59,6 +59,9 @@ #include "RRC_config_tools.h" #include "enb_paramdef.h" +#include "SystemInformationBlockType1.h" +#include "SIB-Type.h" + extern uint16_t sf_ahead; void RCconfig_flexran() @@ -2707,22 +2710,232 @@ void RCConfig(void) { } +int check_plmn_identity(rrc_eNB_carrier_data_t *carrier,uint16_t mcc,uint16_t mnc,uint8_t mnc_digit_length) { + + AssertFatal(carrier->sib1->cellAccessRelatedInfo.plmn_IdentityList.list.count > 0, + "plmn info isn't there\n"); + AssertFatal(mnc_digit_length ==2 || mnc_digit_length == 3, + "impossible mnc_digit_length %d\n",mnc_digit_length); + + PLMN_IdentityInfo_t *plmn_Identity_info = carrier->sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]; + + // check if mcc is different and return failure if so + if (mcc != + (*plmn_Identity_info->plmn_Identity.mcc->list.array[0]*100)+ + (*plmn_Identity_info->plmn_Identity.mcc->list.array[1]*10) + + (*plmn_Identity_info->plmn_Identity.mcc->list.array[2])) return(0); + + // check that mnc digit length is different and return failure if so + if (mnc_digit_length != plmn_Identity_info->plmn_Identity.mnc.list.count) return 0; + + // check that 2 digit mnc is different and return failure if so + if (mnc_digit_length == 2 && + (mnc != + (*plmn_Identity_info->plmn_Identity.mnc.list.array[0]*10) + + (*plmn_Identity_info->plmn_Identity.mnc.list.array[1]))) return(0); + else if (mnc_digit_length == 3 && + (mnc != + (*plmn_Identity_info->plmn_Identity.mnc.list.array[0]*100) + + (*plmn_Identity_info->plmn_Identity.mnc.list.array[1]*10) + + (*plmn_Identity_info->plmn_Identity.mnc.list.array[2]))) return(0); + + // if we're here, the mcc/mnc match so return success + return(1); + +} + +void extract_and_decode_SI(int inst,int si_ind,uint8_t *si_container,int si_container_length) { + + eNB_RRC_INST *rrc = RC.rrc[inst]; + rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0]; + BCCH_DL_SCH_Message_t *bcch_message ; + + AssertFatal(si_ind==0,"Can only handle a single SI block for now\n"); + + // point to first SI block + bcch_message = &carrier->systemInformation; + asn_dec_rval_t dec_rval = uper_decode_complete( NULL, + &asn_DEF_BCCH_DL_SCH_Message, + (void **)&bcch_message, + (const void *)si_container, + si_container_length); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + AssertFatal(1==0, "[ENB_APP][RRC inst %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", + inst, + dec_rval.consumed ); + + if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) { + switch (bcch_message->message.choice.c1.present) { + case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: + AssertFatal(1==0,"Should have received SIB1 from CU\n"); + break; + case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + { + SystemInformation_t *si = &bcch_message->message.choice.c1.choice.systemInformation; + + for (int i=0; i<si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { + struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; + typeandinfo = si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; + + switch(typeandinfo->present) { + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: + carrier->sib2 = &typeandinfo->choice.sib2; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: + carrier->sib3 = &typeandinfo->choice.sib3; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB3 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: + //carrier->sib4 = &typeandinfo->choice.sib4; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB4 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: + //carrier->sib5 = &typeandinfo->choice.sib5; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB5 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: + //carrier->sib6 = &typeandinfo->choice.sib6; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB6 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: + //carrier->sib7 = &typeandinfo->choice.sib7; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB7 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: + //carrier->sib8 = &typeandinfo->choice.sib8; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB8 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: + //carrier->sib9 = &typeandinfo->choice.sib9; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB9 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: + //carrier->sib10 = &typeandinfo->choice.sib10; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB10 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: + //carrier->sib11 = &typeandinfo->choice.sib11; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB11 in CU F1AP_SETUP_RESP message\n", inst); + break; + +#if (RRC_VERSION >= MAKE_VERSION(9, 2, 0)) + + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: + //carrier->sib12 = &typeandinfo->choice.sib12; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB12 in CU F1AP_SETUP_RESP message\n", inst); + break; + + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: + carrier->sib13 = &typeandinfo->choice.sib13_v920; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB13 in CU F1AP_SETUP_RESP message\n", inst); + break; +#endif +#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + //SIB18 + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250: + carrier->sib18 = &typeandinfo->choice.sib18_v1250; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB18 in CU F1AP_SETUP_RESP message\n", inst); + break; + //SIB19 + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250: + carrier->sib19 = &typeandinfo->choice.sib19_v1250; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB19 in CU F1AP_SETUP_RESP message\n", inst); + break; + //SIB21 + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430: + carrier->sib21 = &typeandinfo->choice.sib21_v1430; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB21 in CU F1AP_SETUP_RESP message\n", inst); + break; +#endif + default: + AssertFatal(1==0,"Shouldn't have received this SI %d\n",typeandinfo->present); + break; + } + } + break; + } + } + } + } + else AssertFatal(1==0,"No SI messages\n"); + + +} + +void configure_du_mac(int inst) { + + eNB_RRC_INST *rrc = RC.rrc[inst]; + rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0]; + + rrc_mac_config_req_eNB(inst, 0, + carrier->physCellId, + carrier->p_eNB, + carrier->Ncp, + carrier->sib1->freqBandIndicator, + carrier->dl_CarrierFreq, +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + carrier->pbch_repetition, +#endif + 0, // rnti + (BCCH_BCH_Message_t *) + NULL, + (RadioResourceConfigCommonSIB_t *) & + carrier->sib2->radioResourceConfigCommon, +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (RadioResourceConfigCommonSIB_t *) + NULL, +#endif + (struct PhysicalConfigDedicated *)NULL, +#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + NULL, + NULL, + &carrier->sib1->schedulingInfoList, + carrier->ul_CarrierFreq, + carrier->sib2->freqInfo.ul_Bandwidth, + &carrier->sib2->freqInfo.additionalSpectrumEmission, + (MBSFN_SubframeConfigList_t*) carrier->sib2->mbsfn_SubframeConfigList +#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , + carrier->MBMS_flag, + (MBSFN_AreaInfoList_r9_t*) & carrier->sib13->mbsfn_AreaInfoList_r9, + (PMCH_InfoList_r9_t *) NULL +#endif +#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + NULL +#endif + ); + +} + void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { int i,j,si_ind; - AssertFatal(1==0, "Shouldn't get here yet\n"); - /* + for (j=0;j<resp->num_cells_to_activate;j++) { for (i=0;i<RC.nb_inst;i++) { rrc_eNB_carrier_data_t *carrier = &RC.rrc[i]->carrier[0]; // identify local index of cell j by plmn identity if (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && resp->nrpci[j] == carrier->physCellId) { - // copy system information and decode it to perform MAC/L1 common configuration - for (si_ind=0;si_ind<resp->num_SI[j];si_ind++) { - - } + // copy system information and decode it + for (si_ind=0;si_ind<resp->num_SI[j];si_ind++) extract_and_decode_SI(i, + si_ind, + resp->SI_container[j][si_ind], + resp->SI_container_length[j][si_ind]); + // perform MAC/L1 common configuration + configure_du_mac(i); } - */ + } + } } -- GitLab From cdfca6c00a0cf7410a35e749df15f0e43bf10804 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Wed, 5 Sep 2018 11:14:35 +0200 Subject: [PATCH 024/308] F1: 1.create the f1ap handlers procedure 2.hide asn1c warning when in compile --- cmake_targets/CMakeLists.txt | 34 +- common/utils/T/T_messages.txt | 15 + openair2/F1AP/CU_F1AP.c | 119 +-- openair2/F1AP/DU_F1AP.c | 80 +- openair2/F1AP/f1ap_common.h | 14 +- openair2/F1AP/f1ap_decoder.c | 247 +++--- openair2/F1AP/f1ap_decoder.h | 13 +- openair2/F1AP/f1ap_handlers.c | 1348 ++------------------------------- openair2/F1AP/f1ap_handlers.h | 2 - openair2/F1AP/sctp_cu.c | 6 +- 10 files changed, 318 insertions(+), 1560 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 92ec6de90f..43ce9315f6 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -323,7 +323,9 @@ set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION}) message("calling asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}") execute_process(COMMAND mkdir -p ${RRC_FULL_DIR} COMMAND env asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR} - RESULT_VARIABLE ret) + RESULT_VARIABLE ret + OUTPUT_QUIET + ERROR_QUIET) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) @@ -384,7 +386,10 @@ set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${S1AP_RELEASE}) message("calling ASN1C_PREFIX=S1AP_ asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}") execute_process(COMMAND mkdir -p ${S1AP_C_DIR} COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} - RESULT_VARIABLE ret) + RESULT_VARIABLE ret + OUTPUT_QUIET + ERROR_QUIET) + if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) @@ -451,7 +456,9 @@ set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${X2AP_RELEASE}) message("calling ASN1C_PREFIX=X2AP_ asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}") execute_process(COMMAND mkdir -p ${X2AP_C_DIR} COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} - RESULT_VARIABLE ret) + RESULT_VARIABLE ret + OUTPUT_QUIET + ERROR_QUIET) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) @@ -498,10 +505,13 @@ set(F1AP_ASN_FILES ) set(F1AP_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR}) -set(ENV{ASN1C_PREFIX} F1AP_) -execute_process(COMMAND ${asn1c_call} ${F1AP_C_DIR} ${F1AP_ASN_FILES} - RESULT_VARIABLE reti) -unset(ENV{ASN1C_PREFIX}) +message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_C_DIR} ${F1AP_ASN_FILES}") +execute_process(COMMAND mkdir -p ${F1AP_C_DIR} + COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_C_DIR} ${F1AP_ASN_FILES} + RESULT_VARIABLE ret + OUTPUT_QUIET + ERROR_QUIET) + if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${asn1c_call}: error") endif (NOT ${ret} STREQUAL 0) @@ -533,6 +543,8 @@ add_library(F1AP #${F1AP_DIR}/test.c ${F1AP_DIR}/DU_F1AP.c ${F1AP_DIR}/CU_F1AP.c + ${F1AP_DIR}/f1ap_decoder.c + ${F1AP_DIR}/f1ap_handlers.c ${F1AP_DIR}/sctp_du.c ${F1AP_DIR}/sctp_cu.c ) @@ -540,21 +552,25 @@ add_library(F1AP add_executable(test_f1ap_du ${F1AP_DIR}/test_f1ap_du.c ${F1AP_DIR}/DU_F1AP.c + ${F1AP_DIR}/f1ap_decoder.c + ${F1AP_DIR}/f1ap_handlers.c ${F1AP_DIR}/sctp_du.c ) target_link_libraries(test_f1ap_du - -Wl,--start-group F1AP_LIB sctp pthread -Wl,--end-group + -Wl,--start-group F1AP_LIB ${T_LIB} sctp pthread -Wl,--end-group ) add_executable(test_f1ap_cu ${F1AP_DIR}/test_f1ap_cu.c ${F1AP_DIR}/CU_F1AP.c + ${F1AP_DIR}/f1ap_decoder.c + ${F1AP_DIR}/f1ap_handlers.c ${F1AP_DIR}/sctp_cu.c ) target_link_libraries(test_f1ap_cu - -Wl,--start-group F1AP_LIB sctp pthread -Wl,--end-group + -Wl,--start-group F1AP_LIB ${T_LIB} sctp pthread -Wl,--end-group ) # Hardware dependant options diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index ccac7de253..904fcb7355 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -868,6 +868,21 @@ ID = LEGACY_F1U_ERROR GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_ERROR:LEGACY FORMAT = string,log +ID = LEGACY_F1AP_DEBUG + DESC = F1AP DEBUG LEVEL + GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log + +ID = LEGACY_F1AP_INFO + DESC = F1AP INFO LEVEL + GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log + +ID = LEGACY_F1AP_ERROR + DESC = F1AP ERROR LEVEL + GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log + ################# #### UE LOGS #### ################# diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 8130f9b8e3..077dd4c858 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -52,7 +52,7 @@ typedef struct f1ap_info { /* This is the optional name provided by the MME */ char *GNB_CU_Name; - net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets + f1ap_net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets /* Number of input/ouput streams */ @@ -87,25 +87,38 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ void F1AP_CU_task() { printf("Start F1AP CU task!\n"); - //sctp_cu_init(); + sctp_cu_init(); - // while (1) { + // MessageDef *received_msg = NULL; + // int result; + + // F1AP_DEBUG("Starting F1AP layer\n"); - // switch () { + // f1ap_eNB_prepare_internal_data(); - //case F1AP_ProcedureCode_id_F1Setup: - CU_send_F1_SETUP_RESPONSE(); - //case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: - // CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER (); - //CU_send_DL_RRC_MESSAGE_TRANSFER(); // SRBID and RRCContainer get issue when decode. - //CU_send_UE_CONTEXT_SETUP_REQUEST(); - //CU_send_UE_CONTEXT_MODIFICATION_REQUEST(); - //CU_send_gNB_CU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); // some problem found - // break; + // itti_mark_task_ready(TASK_F1AP); + + // while (1) { + // switch (ITTI_MSG_ID(received_msg)) { + // case F1AP_SETUP_RESP: + // CU_send_F1_SETUP_RESPONSE(); + // break; + // case F1AP_INITIAL_UL_RRC_MESSAGE: + // CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(); + // break; + // case F1AP_DL_RRC_MESSAGE: + // CU_send_DL_RRC_MESSAGE_TRANSFER(); // SRBID and RRCContainer get issue when decode. + // break; + // //CU_send_UE_CONTEXT_SETUP_REQUEST(); + // case F1AP_UE_CONTEXT_MODIFICATION_REQ: + // CU_send_UE_CONTEXT_MODIFICATION_REQUEST(); + // break; + // //CU_send_gNB_CU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); // some problem found + // break; - // default: + // default: - // } // switch + // } // switch // } // while @@ -321,59 +334,59 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { } -int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { +// int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { - //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); - F1AP_F1AP_PDU_t pdu; - F1AP_F1AP_PDU_t *pdu_p = &pdu; - asn_dec_rval_t dec_ret; +// //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); +// F1AP_F1AP_PDU_t pdu; +// F1AP_F1AP_PDU_t *pdu_p = &pdu; +// asn_dec_rval_t dec_ret; - DevAssert(buffer != NULL); +// DevAssert(buffer != NULL); - printf("buffer = \n"); - int i_ret; - for (i_ret = 0; i_ret < length; i_ret++) { - printf("%x ", *(buffer+i_ret)); - } - printf("\n"); +// printf("buffer = \n"); +// int i_ret; +// for (i_ret = 0; i_ret < length; i_ret++) { +// printf("%x ", *(buffer+i_ret)); +// } +// printf("\n"); - memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t)); +// memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t)); - dec_ret = aper_decode(NULL, - &asn_DEF_F1AP_F1AP_PDU, - (void **)&pdu_p, - buffer, - length, - 0, - 0); +// dec_ret = aper_decode(NULL, +// &asn_DEF_F1AP_F1AP_PDU, +// (void **)&pdu_p, +// buffer, +// length, +// 0, +// 0); - xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); +// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); - printf("\n"); +// printf("\n"); - printf("dec_ret.code = %d \n", dec_ret.code); +// printf("dec_ret.code = %d \n", dec_ret.code); - AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n"); +// AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n"); - // switch(pdu_p->present) { - // case F1AP_F1AP_PDU_PR_initiatingpdu: - // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu); +// // switch(pdu_p->present) { +// // case F1AP_F1AP_PDU_PR_initiatingpdu: +// // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu); - // case F1AP_F1AP_PDU_PR_successfulOutcome: - // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome); +// // case F1AP_F1AP_PDU_PR_successfulOutcome: +// // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome); - // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: - // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome); +// // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: +// // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome); - // default: - // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/ - // break; - // } +// // default: +// // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/ +// // break; +// // } - //AssertFatal(1==0,"Shouldn't get here\n"); - return -1; -} +// //AssertFatal(1==0,"Shouldn't get here\n"); +// return -1; +// } void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure) { AssertFatal(1==0,"Not implemented yet\n"); diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index f80e72c566..b6915b7af2 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -53,7 +53,7 @@ typedef struct f1ap_info { /* This is the optional name provided by the MME */ char *GNB_DU_Name; - net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets + f1ap_net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets /* Number of input/ouput streams */ @@ -103,7 +103,7 @@ void F1AP_DU_task() { // switch () { // case F1AP_ProcedureCode_id_F1Setup: - //DU_send_F1_SETUP_REQUEST((module_id_t)1, (module_id_t)2); + DU_send_F1_SETUP_REQUEST((module_id_t)1, (module_id_t)2); // break; //DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(); //DU_send_UL_RRC_MESSAGE_TRANSFER(); // OK @@ -422,59 +422,59 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { } -int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { +// int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { - //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); - F1AP_F1AP_PDU_t pdu; - F1AP_F1AP_PDU_t *pdu_p = &pdu; - asn_dec_rval_t dec_ret; +// //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); +// F1AP_F1AP_PDU_t pdu; +// F1AP_F1AP_PDU_t *pdu_p = &pdu; +// asn_dec_rval_t dec_ret; - DevAssert(buffer != NULL); +// DevAssert(buffer != NULL); - printf("buffer = \n"); - int i_ret; - for (i_ret = 0; i_ret < length; i_ret++) { - printf("%x ", *(buffer+i_ret)); - } - printf("\n"); +// printf("buffer = \n"); +// int i_ret; +// for (i_ret = 0; i_ret < length; i_ret++) { +// printf("%x ", *(buffer+i_ret)); +// } +// printf("\n"); - memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t)); +// memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t)); - dec_ret = aper_decode(NULL, - &asn_DEF_F1AP_F1AP_PDU, - (void **)&pdu_p, - buffer, - length, - 0, - 0); +// dec_ret = aper_decode(NULL, +// &asn_DEF_F1AP_F1AP_PDU, +// (void **)&pdu_p, +// buffer, +// length, +// 0, +// 0); - xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); +// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); - printf("\n"); +// printf("\n"); - printf("dec_ret.code = %d \n", dec_ret.code); +// printf("dec_ret.code = %d \n", dec_ret.code); - AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n"); +// AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n"); - // switch(pdu_p->present) { - // case F1AP_F1AP_PDU_PR_initiatingpdu: - // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu); +// // switch(pdu_p->present) { +// // case F1AP_F1AP_PDU_PR_initiatingpdu: +// // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu); - // case F1AP_F1AP_PDU_PR_successfulOutcome: - // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome); +// // case F1AP_F1AP_PDU_PR_successfulOutcome: +// // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome); - // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: - // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome); +// // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: +// // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome); - // default: - // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/ - // break; - // } +// // default: +// // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/ +// // break; +// // } - //AssertFatal(1==0,"Shouldn't get here\n"); - return -1; -} +// //AssertFatal(1==0,"Shouldn't get here\n"); +// return -1; +// } // ssize_t s1ap_generate_initiating_pdu( diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 22dc981565..fb33333a41 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -375,7 +375,7 @@ extern int asn1_xer_print; #include "assertions.h" #if defined(ENB_MODE) -# include "log.h" +# include "common/utils/LOG/log.h" # include "f1ap_default_values.h" # define F1AP_ERROR(x, args...) LOG_E(F1AP, x, ##args) # define F1AP_WARN(x, args...) LOG_W(F1AP, x, ##args) @@ -394,30 +394,30 @@ extern int asn1_xer_print; //Forward declaration //struct f1ap_message_s; -typedef struct net_ip_address_s { +typedef struct f1ap_net_ip_address_s { unsigned ipv4:1; unsigned ipv6:1; char ipv4_address[16]; char ipv6_address[46]; -} net_ip_address_t; +} f1ap_net_ip_address_t; -typedef struct f1ap_message_s { +/*typedef struct f1ap_message_s { F1AP_ProtocolIE_ID_t id; F1AP_Criticality_t criticality; uint8_t direction; union { F1AP_F1SetupRequestIEs_t f1ap_F1SetupRequestIEs; } msg; -} f1ap_message; +} f1ap_message;*/ /** \brief Function callback prototype. **/ -/*typedef int (*f1ap_message_decoded_callback)( +typedef int (*f1ap_message_decoded_callback)( uint32_t assoc_id, uint32_t stream, struct f1ap_message_s *message_p -);*/ +); /** \brief Encode a successfull outcome message \param buffer pointer to buffer in which data will be encoded diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 9d89cf5172..fa861915f4 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -37,199 +37,142 @@ #include "intertask_interface.h" #include "f1ap_common.h" -#include "f1ap_ies_defs.h" #include "f1ap_decoder.h" -static int f1ap_decode_initiating_message(f1ap_message *message, - F1ap_InitiatingMessage_t *initiating_p) +static int f1ap_eNB_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) { - int ret = -1; MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; MessagesIds message_id; - - DevAssert(initiating_p != NULL); - - message_string = calloc(10000, sizeof(char)); - - f1ap_string_total_size = 0; - - message->procedureCode = initiating_p->procedureCode; - message->criticality = initiating_p->criticality; - - switch(initiating_p->procedureCode) { - - case F1ap_ProcedureCode_id_InitialContextSetup: - ret = f1ap_decode_f1ap_initialcontextsetuprequesties( - &message->msg.f1ap_InitialContextSetupRequestIEs, &initiating_p->value); - f1ap_xer_print_f1ap_initialcontextsetuprequest(f1ap_xer__print2sp, message_string, message); - message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_F1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; - - case F1ap_ProcedureCode_id_UEContextRelease: - ret = f1ap_decode_f1ap_uecontextreleasecommandies( - &message->msg.f1ap_UEContextReleaseCommandIEs, &initiating_p->value); - f1ap_xer_print_f1ap_uecontextreleasecommand(f1ap_xer__print2sp, message_string, message); - message_id = F1AP_UE_CONTEXT_RELEASE_COMMAND_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_F1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.f1ap_ue_context_release_command_log.size = message_string_size; - memcpy(&message_p->ittiMsg.f1ap_ue_context_release_command_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; - - case F1ap_ProcedureCode_id_ErrorIndication: - ret = f1ap_decode_f1ap_errorindicationies( - &message->msg.f1ap_ErrorIndicationIEs, &initiating_p->value); - f1ap_xer_print_f1ap_errorindication(f1ap_xer__print2sp, message_string, message); - message_id = F1AP_E_RAB_ERROR_INDICATION_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_F1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.f1ap_e_rab_release_request_log.size = message_string_size; - memcpy(&message_p->ittiMsg.f1ap_error_indication_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - F1AP_INFO("ErrorIndication initiating message\n"); - break; - - default: - F1AP_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); - return -1; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); + + switch(pdu->choice.initiatingMessage->procedureCode) { + + case F1AP_ProcedureCode_id_F1Setup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + printf("f1ap_eNB_decode_initiating_message!\n"); + break; + // case F1AP_ProcedureCode_id_InitialContextSetup: + // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + // message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; + // message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, + // res.result.encoded + sizeof (IttiMsgText)); + // message_p->ittiMsg.f1ap_initial_context_setup_log.size = res.result.encoded; + // memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, res.buffer, res.result.encoded); + // itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + // free(res.buffer); + // break; + + default: + // F1AP_ERROR("Unknown procedure ID (%d) for initiating message\n", + // (int)pdu->choice.initiatingMessage->procedureCode); + printf("Unknown procedure ID (%d) for initiating message\n", + (int)pdu->choice.initiatingMessage->procedureCode); + AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n", + (int)pdu->choice.initiatingMessage->procedureCode); + return -1; } - - return ret; + return 0; } -static int f1ap_decode_successful_outcome(f1ap_message *message, - F1ap_SuccessfulOutcome_t *successfullOutcome_p) +static int f1ap_eNB_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) { - int ret = -1; MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; MessagesIds message_id; - - DevAssert(successfullOutcome_p != NULL); - - message_string = malloc(sizeof(char) * 10000); - memset((void*)message_string,0,sizeof(char) * 10000); - - f1ap_string_total_size = 0; - - message->procedureCode = successfullOutcome_p->procedureCode; - message->criticality = successfullOutcome_p->criticality; - - switch(successfullOutcome_p->procedureCode) { - case F1ap_ProcedureCode_id_F1Setup: - ret = f1ap_decode_f1ap_f1setupresponseies( - &message->msg.f1ap_F1SetupResponseIEs, &successfullOutcome_p->value); - f1ap_xer_print_f1ap_f1setupresponse(f1ap_xer__print2sp, message_string, message); - message_id = F1AP_F1_SETUP_LOG; - break; - - default: - F1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n", - (int)successfullOutcome_p->procedureCode); - return -1; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); + + switch(pdu->choice.successfulOutcome->procedureCode) { + // case F1AP_ProcedureCode_id_F1Setup: + // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + // message_id = F1AP_F1_SETUP_LOG; + // message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + // message_p->ittiMsg.f1ap_s1_setup_log.size = res.result.encoded; + // memcpy(&message_p->ittiMsg.f1ap_s1_setup_log.text, res.buffer, res.result.encoded); + // itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + // free(res.buffer); + // break; + + default: + // F1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n", + // (int)pdu->choice.successfulOutcome->procedureCode); + printf("Unknown procedure ID (%d) for successfull outcome message\n", + (int)pdu->choice.successfulOutcome->procedureCode); + return -1; } - message_string_size = strlen(message_string); - - message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.f1ap_f1_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - - free(message_string); - - return ret; + return 0; } -static int f1ap_decode_unsuccessful_outcome(f1ap_message *message, - F1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p) +static int f1ap_eNB_decode_unsuccessful_outcome(F1AP_F1AP_PDU_t *pdu) { - int ret = -1; - DevAssert(unSuccessfullOutcome_p != NULL); - - message->procedureCode = unSuccessfullOutcome_p->procedureCode; - message->criticality = unSuccessfullOutcome_p->criticality; - - switch(unSuccessfullOutcome_p->procedureCode) { - case F1ap_ProcedureCode_id_F1Setup: - return f1ap_decode_f1ap_f1setupfailureies( - &message->msg.f1ap_F1SetupFailureIEs, &unSuccessfullOutcome_p->value); - - default: - F1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n", - (int)unSuccessfullOutcome_p->procedureCode); - break; + MessageDef *message_p; + MessagesIds message_id; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); + + switch(pdu->choice.unsuccessfulOutcome->procedureCode) { + // case F1AP_ProcedureCode_id_F1Setup: + // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + // message_id = F1AP_F1_SETUP_LOG; + // message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + // message_p->ittiMsg.f1ap_f1_setup_log.size = res.result.encoded; + // memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, res.buffer, res.result.encoded); + // itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + // free(res.buffer); + // break; + + default: + // F1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n", + // (int)pdu->choice.unsuccessfulOutcome->procedureCode); + printf("Unknown procedure ID (%d) for unsuccessfull outcome message\n", + (int)pdu->choice.unsuccessfulOutcome->procedureCode); + return -1; } - return ret; + return 0; } -int f1ap_decode_pdu(f1ap_message *message, const uint8_t * const buffer, +int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length) { - F1AP_PDU_t pdu; - F1AP_PDU_t *pdu_p = &pdu; asn_dec_rval_t dec_ret; DevAssert(buffer != NULL); - memset((void *)pdu_p, 0, sizeof(F1AP_PDU_t)); - dec_ret = aper_decode(NULL, - &asn_DEF_F1AP_PDU, - (void **)&pdu_p, + &asn_DEF_F1AP_F1AP_PDU, + (void **)&pdu, buffer, length, 0, 0); + //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); + if (dec_ret.code != RC_OK) { - F1AP_ERROR("Failed to decode pdu\n"); + //F1AP_ERROR("Failed to decode pdu\n"); + printf("Failed to decode pdu\n"); return -1; } - message->direction = pdu_p->present; + switch(pdu->present) { + case F1AP_F1AP_PDU_PR_initiatingMessage: + return f1ap_eNB_decode_initiating_message(pdu); - switch(pdu_p->present) { - case F1AP_F1AP_PDU_PR_initiatingMessage: - return f1ap_decode_initiating_message(message, - &pdu_p->choice.initiatingMessage); + case F1AP_F1AP_PDU_PR_successfulOutcome: + return f1ap_eNB_decode_successful_outcome(pdu); - case F1AP_F1AP_PDU_PR_successfulOutcome: - return f1ap_decode_successful_outcome(message, - &pdu_p->choice.successfulOutcome); + case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: + return f1ap_eNB_decode_unsuccessful_outcome(pdu); - case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: - return f1ap_decode_unsuccessful_outcome(message, - &pdu_p->choice.unsuccessfulOutcome); - - default: - F1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu_p->present); - break; + default: + //F1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu->present); + printf("Unknown presence (%d) or not implemented\n", (int)pdu->present); + break; } + return -1; } diff --git a/openair2/F1AP/f1ap_decoder.h b/openair2/F1AP/f1ap_decoder.h index 81a8e3512b..c16e880c33 100644 --- a/openair2/F1AP/f1ap_decoder.h +++ b/openair2/F1AP/f1ap_decoder.h @@ -30,13 +30,10 @@ * \warning */ -#include <stdint.h> -#include "f1ap_ies_defs.h" +#ifndef F1AP_ENB_ENCODER_H_ +#define F1AP_ENB_ENCODER_H_ -#ifndef F1AP_DECODER_H_ -#define F1AP_DECODER_H_ +int f1ap_eNB_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) +__attribute__ ((warn_unused_result)); -int f1ap_decode_pdu(f1ap_message *message, const uint8_t * const buffer, - const uint32_t length) __attribute__ ((warn_unused_result)); - -#endif /* F1AP_DECODER_H_ */ +#endif /* F1AP_ENB_ENCODER_H_ */ diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index e779364803..dd2be53943 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -37,17 +37,10 @@ #include "asn1_conversions.h" #include "f1ap_common.h" -#include "f1ap_ies_defs.h" // #include "f1ap_eNB.h" -#include "f1ap_defs.h" #include "f1ap_handlers.h" #include "f1ap_decoder.h" -#include "f1ap_ue_context.h" -#include "f1ap_trace.h" -#include "f1ap_nas_procedures.h" -#include "f1ap_management_procedures.h" - #include "f1ap_default_values.h" #include "assertions.h" @@ -55,1327 +48,106 @@ #include "msc.h" static -int f1ap_handle_f1_setup_response(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *message_p); -static -int f1ap_handle_f1_setup_failure(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *message_p); - -static -int f1ap_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *message_p); - -static -int f1ap_handle_initial_context_request(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *message_p); - -static -int f1ap_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p); +int f1ap_handle_f1_setup_request(uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); -static -int f1ap_handle_e_rab_setup_request(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p); - -static -int f1ap_handle_paging(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *message_p); - -static -int f1ap_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p); - -static -int f1ap_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p); - -/* Handlers matrix. Only eNB related procedure present here */ +/* Handlers matrix. Only f1 related procedure present here */ f1ap_message_decoded_callback messages_callback[][3] = { - { 0, 0, 0 }, /* HandoverPreparation */ - { 0, 0, 0 }, /* HandoverResourceAllocation */ - { 0, 0, 0 }, /* HandoverNotification */ - { 0, 0, 0 }, /* PathSwitchRequest */ - { 0, 0, 0 }, /* HandoverCancel */ - { f1ap_handle_e_rab_setup_request, 0, 0 }, /* E_RABSetup */ - { f1ap_handle_e_rab_modify_request, 0, 0 }, /* E_RABModify */ - { f1ap_handle_e_rab_release_command, 0, 0 }, /* E_RABRelease */ - { 0, 0, 0 }, /* E_RABReleaseIndication */ - { f1ap_handle_initial_context_request, 0, 0 }, /* InitialContextSetup */ - { f1ap_handle_paging, 0, 0 }, /* Paging */ - { f1ap_handle_nas_downlink, 0, 0 }, /* downlinkNASTransport */ - { 0, 0, 0 }, /* initialUEMessage */ - { 0, 0, 0 }, /* uplinkNASTransport */ + + { 0, 0, 0 }, /* Reset */ - { f1ap_handle_error_indication, 0, 0 }, /* ErrorIndication */ - { 0, 0, 0 }, /* NASNonDeliveryIndication */ - { 0, f1ap_handle_f1_setup_response, f1ap_handle_f1_setup_failure }, /* F1Setup */ + { f1ap_handle_f1_setup_request, 0, 0 }, /* F1Setup */ + { 0, 0, 0 }, /* ErrorIndication */ + { f1ap_handle_f1_setup_request, 0, 0 }, /* gNBDUConfigurationUpdate */ + { f1ap_handle_f1_setup_request, 0, 0 }, /* gNBCUConfigurationUpdate */ + { f1ap_handle_f1_setup_request, 0, 0 }, /* UEContextSetup */ + { 0, 0, 0 }, /* UEContextRelease */ + { f1ap_handle_f1_setup_request, 0, 0 }, /* UEContextModification */ + { 0, 0, 0 }, /* UEContextModificationRequired */ + { 0, 0, 0 }, /* UEMobilityCommand */ { 0, 0, 0 }, /* UEContextReleaseRequest */ - { 0, 0, 0 }, /* DownlinkF1cdma2000tunneling */ - { 0, 0, 0 }, /* UplinkF1cdma2000tunneling */ - { 0, 0, 0 }, /* UEContextModification */ - { 0, 0, 0 }, /* UECapabilityInfoIndication */ - { f1ap_handle_ue_context_release_command, 0, 0 }, /* UEContextRelease */ - { 0, 0, 0 }, /* eNBStatusTransfer */ - { 0, 0, 0 }, /* MMEStatusTransfer */ - { f1ap_handle_deactivate_trace, 0, 0 }, /* DeactivateTrace */ - { f1ap_handle_trace_start, 0, 0 }, /* TraceStart */ - { 0, 0, 0 }, /* TraceFailureIndication */ - { 0, 0, 0 }, /* ENBConfigurationUpdate */ - { 0, 0, 0 }, /* MMEConfigurationUpdate */ - { 0, 0, 0 }, /* LocationReportingControl */ - { 0, 0, 0 }, /* LocationReportingFailureIndication */ - { 0, 0, 0 }, /* LocationReport */ - { 0, 0, 0 }, /* OverloadStart */ - { 0, 0, 0 }, /* OverloadStop */ + { f1ap_handle_f1_setup_request, 0, 0 }, /* InitialULRRCMessageTransfer */ + { f1ap_handle_f1_setup_request, 0, 0 }, /* DLRRCMessageTransfer */ + { f1ap_handle_f1_setup_request, 0, 0 }, /* ULRRCMessageTransfer */ + { 0, 0, 0 }, /* privateMessage */ + { 0, 0, 0 }, /* UEInactivityNotification */ + { 0, 0, 0 }, /* GNBDUResourceCoordination */ + { 0, 0, 0 }, /* SystemInformationDeliveryCommand */ + { 0, 0, 0 }, /* Paging */ + { 0, 0, 0 }, /* Notify */ { 0, 0, 0 }, /* WriteReplaceWarning */ - { 0, 0, 0 }, /* eNBDirectInformationTransfer */ - { 0, 0, 0 }, /* MMEDirectInformationTransfer */ - { 0, 0, 0 }, /* PrivateMessage */ - { 0, 0, 0 }, /* eNBConfigurationTransfer */ - { 0, 0, 0 }, /* MMEConfigurationTransfer */ - { 0, 0, 0 }, /* CellTrafficTrace */ -#if (F1AP_VERSION >= MAKE_VERSION(9, 0, 0)) - { 0, 0, 0 }, /* Kill */ - { 0, 0, 0 }, /* DownlinkUEAssociatedLPPaTransport */ - { 0, 0, 0 }, /* UplinkUEAssociatedLPPaTransport */ - { 0, 0, 0 }, /* DownlinkNonUEAssociatedLPPaTransport */ - { 0, 0, 0 }, /* UplinkNonUEAssociatedLPPaTransport */ -#endif + { 0, 0, 0 }, /* PWSCancel */ + { 0, 0, 0 }, /* PWSRestartIndication */ + { 0, 0, 0 }, /* PWSFailureIndication */ }; -static const char *f1ap_direction2String[] = { +char *f1ap_direction2String(int f1ap_dir) { +static const char *f1ap_direction_String[] = { "", /* Nothing */ - "Originating message", /* originating message */ + "Initiating message", /* initiating message */ "Successfull outcome", /* successfull outcome */ "UnSuccessfull outcome", /* successfull outcome */ }; - -void f1ap_handle_f1_setup_message(f1ap_mme_data_t *mme_desc_p, int sctp_shutdown) -{ - if (sctp_shutdown) { - /* A previously connected MME has been shutdown */ - - /* TODO check if it was used by some eNB and send a message to inform these eNB if there is no more associated MME */ - if (mme_desc_p->state == F1AP_ENB_STATE_CONNECTED) { - mme_desc_p->state = F1AP_ENB_STATE_DISCONNECTED; - - if (mme_desc_p->f1ap_instance->f1ap_mme_associated_nb > 0) { - /* Decrease associated MME number */ - mme_desc_p->f1ap_instance->f1ap_mme_associated_nb --; - } - - /* If there are no more associated MME, inform eNB app */ - if (mme_desc_p->f1ap_instance->f1ap_mme_associated_nb == 0) { - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_F1AP, F1AP_DEREGISTERED_ENB_IND); - F1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; - itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->f1ap_instance->instance, message_p); - } - } - } else { - /* Check that at least one setup message is pending */ - DevCheck(mme_desc_p->f1ap_instance->f1ap_mme_pending_nb > 0, mme_desc_p->f1ap_instance->instance, - mme_desc_p->f1ap_instance->f1ap_mme_pending_nb, 0); - - if (mme_desc_p->f1ap_instance->f1ap_mme_pending_nb > 0) { - /* Decrease pending messages number */ - mme_desc_p->f1ap_instance->f1ap_mme_pending_nb --; - } - - /* If there are no more pending messages, inform eNB app */ - if (mme_desc_p->f1ap_instance->f1ap_mme_pending_nb == 0) { - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_F1AP, F1AP_REGISTER_ENB_CNF); - F1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->f1ap_instance->f1ap_mme_associated_nb; - itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->f1ap_instance->instance, message_p); - } - } +return(f1ap_direction_String[f1ap_dir]); } int f1ap_handle_message(uint32_t assoc_id, int32_t stream, const uint8_t * const data, const uint32_t data_length) { - struct f1ap_message_s message; + F1AP_F1AP_PDU_t pdu; + int ret; DevAssert(data != NULL); - memset(&message, 0, sizeof(struct f1ap_message_s)); + memset(&pdu, 0, sizeof(pdu)); - if (f1ap_decode_pdu(&message, data, data_length) < 0) { - F1AP_ERROR("Failed to decode PDU\n"); + if (f1ap_decode_pdu(&pdu, data, data_length) < 0) { + //F1AP_ERROR("Failed to decode PDU\n"); + printf("Failed to decode PDU\n"); return -1; } /* Checking procedure Code and direction of message */ - if (message.procedureCode > sizeof(messages_callback) / (3 * sizeof( + if (pdu.choice.initiatingMessage->procedureCode > sizeof(messages_callback) / (3 * sizeof( f1ap_message_decoded_callback)) - || (message.direction > F1AP_PDU_PR_unsuccessfulOutcome)) { - F1AP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", - assoc_id, message.procedureCode, message.direction); + || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) { + //F1AP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", + // assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); + printf("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", + assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return -1; } /* No handler present. * This can mean not implemented or no procedure for eNB (wrong direction). */ - if (messages_callback[message.procedureCode][message.direction-1] == NULL) { - F1AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n", - assoc_id, message.procedureCode, - f1ap_direction2String[message.direction]); + if (messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { + // F1AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n", + // assoc_id, pdu.choice.initiatingMessage->procedureCode, + // f1ap_direction2String(pdu.present - 1)); + printf("[SCTP %d] No handler for procedureCode %ld in %s\n", + assoc_id, pdu.choice.initiatingMessage->procedureCode, + f1ap_direction2String(pdu.present - 1)); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return -1; } /* Calling the right handler */ - return (*messages_callback[message.procedureCode][message.direction-1]) - (assoc_id, stream, &message); -} - -static -int f1ap_handle_f1_setup_failure(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *message_p) -{ - F1ap_F1SetupFailureIEs_t *f1_setup_failure_p; - f1ap_mme_data_t *mme_desc_p; - - DevAssert(message_p != NULL); - - f1_setup_failure_p = &message_p->msg.f1ap_F1SetupFailureIEs; - - /* F1 Setup Failure == Non UE-related procedure -> stream 0 */ - if (stream != 0) { - F1AP_WARN("[SCTP %d] Received f1 setup failure on stream != 0 (%d)\n", - assoc_id, stream); - } - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received F1 setup response for non existing " - "MME context\n", assoc_id); - return -1; - } - - if ((f1_setup_failure_p->cause.present == F1ap_Cause_PR_misc) && - (f1_setup_failure_p->cause.choice.misc == F1ap_CauseMisc_unspecified)) { - F1AP_WARN("Received f1 setup failure for MME... MME is not ready\n"); - } else { - F1AP_ERROR("Received f1 setup failure for MME... please check your parameters\n"); - } - - mme_desc_p->state = F1AP_ENB_STATE_WAITING; - f1ap_handle_f1_setup_message(mme_desc_p, 0); - - return 0; -} - -static -int f1ap_handle_f1_setup_response(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *message_p) -{ - F1ap_F1SetupResponseIEs_t *f1SetupResponse_p; - f1ap_mme_data_t *mme_desc_p; - int i; - - DevAssert(message_p != NULL); - - f1SetupResponse_p = &message_p->msg.f1ap_F1SetupResponseIEs; - - /* F1 Setup Response == Non UE-related procedure -> stream 0 */ - if (stream != 0) { - F1AP_ERROR("[SCTP %d] Received f1 setup response on stream != 0 (%d)\n", - assoc_id, stream); - return -1; - } - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received F1 setup response for non existing " - "MME context\n", assoc_id); - return -1; - } - - /* The list of served gummei can contain at most 8 elements. - * LTE related gummei is the first element in the list, i.e with an id of 0. - */ - F1AP_DEBUG("servedGUMMEIs.list.count %d\n",f1SetupResponse_p->servedGUMMEIs.list.count); - DevAssert(f1SetupResponse_p->servedGUMMEIs.list.count > 0); - DevAssert(f1SetupResponse_p->servedGUMMEIs.list.count <= 8); - - - for (i = 0; i < f1SetupResponse_p->servedGUMMEIs.list.count; i++) { - struct F1ap_ServedGUMMEIsItem *gummei_item_p; - struct served_gummei_s *new_gummei_p; - int j; - - gummei_item_p = (struct F1ap_ServedGUMMEIsItem *) - f1SetupResponse_p->servedGUMMEIs.list.array[i]; - new_gummei_p = calloc(1, sizeof(struct served_gummei_s)); - - STAILQ_INIT(&new_gummei_p->served_plmns); - STAILQ_INIT(&new_gummei_p->served_group_ids); - STAILQ_INIT(&new_gummei_p->mme_codes); - - F1AP_DEBUG("servedPLMNs.list.count %d\n",gummei_item_p->servedPLMNs.list.count); - for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) { - F1ap_PLMNidentity_t *plmn_identity_p; - struct plmn_identity_s *new_plmn_identity_p; - - plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j]; - new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); - TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, - new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length); - STAILQ_INSERT_TAIL(&new_gummei_p->served_plmns, new_plmn_identity_p, next); - new_gummei_p->nb_served_plmns++; - } - - for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) { - F1ap_MME_Group_ID_t *mme_group_id_p; - struct served_group_id_s *new_group_id_p; - - mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j]; - new_group_id_p = calloc(1, sizeof(struct served_group_id_s)); - OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id); - STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next); - new_gummei_p->nb_group_id++; - } - - for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) { - F1ap_MME_Code_t *mme_code_p; - struct mme_code_s *new_mme_code_p; - - mme_code_p = gummei_item_p->servedMMECs.list.array[j]; - new_mme_code_p = calloc(1, sizeof(struct mme_code_s)); - - OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code); - STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next); - new_gummei_p->nb_mme_code++; - } - - STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); - } - - /* Free contents of the list */ - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1ap_ServedGUMMEIs, - (void *)&f1SetupResponse_p->servedGUMMEIs); - /* Set the capacity of this MME */ - mme_desc_p->relative_mme_capacity = f1SetupResponse_p->relativeMMECapacity; - - /* Optionaly set the mme name */ - if (f1SetupResponse_p->presenceMask & F1AP_F1SETUPRESPONSEIES_MMENAME_PRESENT) { - mme_desc_p->mme_name = calloc(f1SetupResponse_p->mmEname.size + 1, sizeof(char)); - memcpy(mme_desc_p->mme_name, f1SetupResponse_p->mmEname.buf, - f1SetupResponse_p->mmEname.size); - /* Convert the mme name to a printable string */ - mme_desc_p->mme_name[f1SetupResponse_p->mmEname.size] = '\0'; - } - - /* The association is now ready as eNB and MME know parameters of each other. - * Mark the association as UP to enable UE contexts creation. - */ - mme_desc_p->state = F1AP_ENB_STATE_CONNECTED; - mme_desc_p->f1ap_instance->f1ap_mme_associated_nb ++; - f1ap_handle_f1_setup_message(mme_desc_p, 0); - -#if 0 - /* We call back our self - * -> generate a dummy initial UE message - */ - { - f1ap_nas_first_req_t f1ap_nas_first_req; - - memset(&f1ap_nas_first_req, 0, sizeof(f1ap_nas_first_req_t)); - - f1ap_nas_first_req.rnti = 0xC03A; - f1ap_nas_first_req.establishment_cause = RRC_CAUSE_MO_DATA; - f1ap_nas_first_req.ue_identity.presenceMask = UE_IDENTITIES_gummei; - - f1ap_nas_first_req.ue_identity.gummei.mcc = 208; - f1ap_nas_first_req.ue_identity.gummei.mnc = 34; - f1ap_nas_first_req.ue_identity.gummei.mme_code = 0; - f1ap_nas_first_req.ue_identity.gummei.mme_group_id = 0; - - /* NAS Attach request with IMSI */ - static uint8_t nas_attach_req_imsi[] = { - 0x07, 0x41, - /* EPS Mobile identity = IMSI */ - 0x71, 0x08, 0x29, 0x80, 0x43, 0x21, 0x43, 0x65, 0x87, - 0xF9, - /* End of EPS Mobile Identity */ - 0x02, 0xE0, 0xE0, 0x00, 0x20, 0x02, 0x03, - 0xD0, 0x11, 0x27, 0x1A, 0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, - 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x83, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x0A, 0x00, 0x52, 0x12, 0xF2, - 0x01, 0x27, 0x11, - }; - - /* NAS Attach request with GUTI */ - static uint8_t nas_attach_req_guti[] = { - 0x07, 0x41, - /* EPS Mobile identity = IMSI */ - 0x71, 0x0B, 0xF6, 0x12, 0xF2, 0x01, 0x80, 0x00, 0x01, 0xE0, 0x00, - 0xDA, 0x1F, - /* End of EPS Mobile Identity */ - 0x02, 0xE0, 0xE0, 0x00, 0x20, 0x02, 0x03, - 0xD0, 0x11, 0x27, 0x1A, 0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, - 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x83, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x0A, 0x00, 0x52, 0x12, 0xF2, - 0x01, 0x27, 0x11, - }; - - f1ap_nas_first_req.nas_pdu.buffer = nas_attach_req_guti; - f1ap_nas_first_req.nas_pdu.length = sizeof(nas_attach_req_guti); - - f1ap_handle_nas_first_req(mme_desc_p->f1ap_instance->instance, - &f1ap_nas_first_req); - } -#endif - - return 0; -} - - -static -int f1ap_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *message_p) -{ - F1ap_ErrorIndicationIEs_t *f1_error_indication_p; - f1ap_mme_data_t *mme_desc_p; - - DevAssert(message_p != NULL); - - f1_error_indication_p = &message_p->msg.f1ap_ErrorIndicationIEs; - - /* F1 Setup Failure == Non UE-related procedure -> stream 0 */ - if (stream != 0) { - F1AP_WARN("[SCTP %d] Received f1 Error indication on stream != 0 (%d)\n", - assoc_id, stream); - } - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received F1 Error indication for non existing " - "MME context\n", assoc_id); - return -1; - } - if ( f1_error_indication_p->presenceMask & F1AP_ERRORINDICATIONIES_MME_UE_F1AP_ID_PRESENT) { - F1AP_WARN("Received F1 Error indication MME UE F1AP ID 0x%lx\n", f1_error_indication_p->mme_ue_f1ap_id); - } - if ( f1_error_indication_p->presenceMask & F1AP_ERRORINDICATIONIES_ENB_UE_F1AP_ID_PRESENT) { - F1AP_WARN("Received F1 Error indication eNB UE F1AP ID 0x%lx\n", f1_error_indication_p->eNB_UE_F1AP_ID); - } - - if ( f1_error_indication_p->presenceMask & F1AP_ERRORINDICATIONIES_CAUSE_PRESENT) { - switch(f1_error_indication_p->cause.present) { - case F1ap_Cause_PR_NOTHING: - F1AP_WARN("Received F1 Error indication cause NOTHING\n"); - break; - case F1ap_Cause_PR_radioNetwork: - switch (f1_error_indication_p->cause.choice.radioNetwork) { - case F1ap_CauseRadioNetwork_unspecified: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unspecified\n"); - break; - case F1ap_CauseRadioNetwork_tx2relocoverall_expiry: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_tx2relocoverall_expiry\n"); - break; - case F1ap_CauseRadioNetwork_successful_handover: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_successful_handover\n"); - break; - case F1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason\n"); - break; - case F1ap_CauseRadioNetwork_handover_cancelled: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_handover_cancelled\n"); - break; - case F1ap_CauseRadioNetwork_partial_handover: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_partial_handover\n"); - break; - case F1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system\n"); - break; - case F1ap_CauseRadioNetwork_ho_target_not_allowed: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_ho_target_not_allowed\n"); - break; - case F1ap_CauseRadioNetwork_tF1relocoverall_expiry: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_tF1relocoverall_expiry\n"); - break; - case F1ap_CauseRadioNetwork_tF1relocprep_expiry: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_tF1relocprep_expiry\n"); - break; - case F1ap_CauseRadioNetwork_cell_not_available: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_cell_not_available\n"); - break; - case F1ap_CauseRadioNetwork_unknown_targetID: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_targetID\n"); - break; - case F1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n"); - break; - case F1ap_CauseRadioNetwork_unknown_mme_ue_f1ap_id: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_mme_ue_f1ap_id\n"); - break; - case F1ap_CauseRadioNetwork_unknown_enb_ue_f1ap_id: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_enb_ue_f1ap_id\n"); - break; - case F1ap_CauseRadioNetwork_unknown_pair_ue_f1ap_id: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_pair_ue_f1ap_id\n"); - break; - case F1ap_CauseRadioNetwork_handover_desirable_for_radio_reason: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_handover_desirable_for_radio_reason\n"); - break; - case F1ap_CauseRadioNetwork_time_critical_handover: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_time_critical_handover\n"); - break; - case F1ap_CauseRadioNetwork_resource_optimisation_handover: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_resource_optimisation_handover\n"); - break; - case F1ap_CauseRadioNetwork_reduce_load_in_serving_cell: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_reduce_load_in_serving_cell\n"); - break; - case F1ap_CauseRadioNetwork_user_inactivity: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_user_inactivity\n"); - break; - case F1ap_CauseRadioNetwork_radio_connection_with_ue_lost: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_radio_connection_with_ue_lost\n"); - break; - case F1ap_CauseRadioNetwork_load_balancing_tau_required: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_load_balancing_tau_required\n"); - break; - case F1ap_CauseRadioNetwork_cs_fallback_triggered: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_cs_fallback_triggered\n"); - break; - case F1ap_CauseRadioNetwork_ue_not_available_for_ps_service: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_ue_not_available_for_ps_service\n"); - break; - case F1ap_CauseRadioNetwork_radio_resources_not_available: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_radio_resources_not_available\n"); - break; - case F1ap_CauseRadioNetwork_failure_in_radio_interface_procedure: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_failure_in_radio_interface_procedure\n"); - break; - case F1ap_CauseRadioNetwork_invalf1ap_id_qos_combination: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_invalf1ap_id_qos_combination\n"); - break; - case F1ap_CauseRadioNetwork_interrat_redirection: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_interrat_redirection\n"); - break; - case F1ap_CauseRadioNetwork_interaction_with_other_procedure: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_interaction_with_other_procedure\n"); - break; - case F1ap_CauseRadioNetwork_unknown_E_RAB_ID: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_unknown_E_RAB_ID\n"); - break; - case F1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances\n"); - break; - case F1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n"); - break; - case F1ap_CauseRadioNetwork_f1_intra_system_handover_triggered: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_f1_intra_system_handover_triggered\n"); - break; - case F1ap_CauseRadioNetwork_f1_inter_system_handover_triggered: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_f1_inter_system_handover_triggered\n"); - break; - case F1ap_CauseRadioNetwork_x2_handover_triggered: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_x2_handover_triggered\n"); - break; - case F1ap_CauseRadioNetwork_redirection_towards_1xRTT: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_redirection_towards_1xRTT\n"); - break; - case F1ap_CauseRadioNetwork_not_supported_QCI_value: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_not_supported_QCI_value\n"); - break; - case F1ap_CauseRadioNetwork_invalf1ap_id_CSG_Id: - F1AP_WARN("Received F1 Error indication F1ap_CauseRadioNetwork_invalf1ap_id_CSG_Id\n"); - break; - default: - F1AP_WARN("Received F1 Error indication cause radio network case not handled\n"); - } - break; - - case F1ap_Cause_PR_transport: - switch (f1_error_indication_p->cause.choice.transport) { - case F1ap_CauseTransport_transport_resource_unavailable: - F1AP_WARN("Received F1 Error indication F1ap_CauseTransport_transport_resource_unavailable\n"); - break; - case F1ap_CauseTransport_unspecified: - F1AP_WARN("Received F1 Error indication F1ap_CauseTransport_unspecified\n"); - break; - default: - F1AP_WARN("Received F1 Error indication cause transport case not handled\n"); - } - break; - - case F1ap_Cause_PR_nas: - switch (f1_error_indication_p->cause.choice.nas) { - case F1ap_CauseNas_normal_release: - F1AP_WARN("Received F1 Error indication F1ap_CauseNas_normal_release\n"); - break; - case F1ap_CauseNas_authentication_failure: - F1AP_WARN("Received F1 Error indication F1ap_CauseNas_authentication_failure\n"); - break; - case F1ap_CauseNas_detach: - F1AP_WARN("Received F1 Error indication F1ap_CauseNas_detach\n"); - break; - case F1ap_CauseNas_unspecified: - F1AP_WARN("Received F1 Error indication F1ap_CauseNas_unspecified\n"); - break; - case F1ap_CauseNas_csg_subscription_expiry: - F1AP_WARN("Received F1 Error indication F1ap_CauseNas_csg_subscription_expiry\n"); - break; - default: - F1AP_WARN("Received F1 Error indication cause nas case not handled\n"); - } - break; - - case F1ap_Cause_PR_protocol: - switch (f1_error_indication_p->cause.choice.protocol) { - case F1ap_CauseProtocol_transfer_syntax_error: - F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_transfer_syntax_error\n"); - break; - case F1ap_CauseProtocol_abstract_syntax_error_reject: - F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_abstract_syntax_error_reject\n"); - break; - case F1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify: - F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify\n"); - break; - case F1ap_CauseProtocol_message_not_compatible_with_receiver_state: - F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_message_not_compatible_with_receiver_state\n"); - break; - case F1ap_CauseProtocol_semantic_error: - F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_semantic_error\n"); - break; - case F1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message: - F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message\n"); - break; - case F1ap_CauseProtocol_unspecified: - F1AP_WARN("Received F1 Error indication F1ap_CauseProtocol_unspecified\n"); - break; - default: - F1AP_WARN("Received F1 Error indication cause protocol case not handled\n"); - } - break; - - case F1ap_Cause_PR_misc: - switch (f1_error_indication_p->cause.choice.protocol) { - case F1ap_CauseMisc_control_processing_overload: - F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_control_processing_overload\n"); - break; - case F1ap_CauseMisc_not_enough_user_plane_processing_resources: - F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_not_enough_user_plane_processing_resources\n"); - break; - case F1ap_CauseMisc_hardware_failure: - F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_hardware_failure\n"); - break; - case F1ap_CauseMisc_om_intervention: - F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_om_intervention\n"); - break; - case F1ap_CauseMisc_unspecified: - F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_unspecified\n"); - break; - case F1ap_CauseMisc_unknown_PLMN: - F1AP_WARN("Received F1 Error indication F1ap_CauseMisc_unknown_PLMN\n"); - break; - default: - F1AP_WARN("Received F1 Error indication cause misc case not handled\n"); - } - break; - } - } - if ( f1_error_indication_p->presenceMask & F1AP_ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT) { - // TODO continue - } - // TODO continue - - return 0; -} - - -static -int f1ap_handle_initial_context_request(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p) -{ - int i; - - f1ap_mme_data_t *mme_desc_p = NULL; - f1ap_ue_context_t *ue_desc_p = NULL; - MessageDef *message_p = NULL; - - F1ap_InitialContextSetupRequestIEs_t *initialContextSetupRequest_p; - DevAssert(f1ap_message_p != NULL); - - initialContextSetupRequest_p = &f1ap_message_p->msg.f1ap_InitialContextSetupRequestIEs; - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received initial context setup request for non " - "existing MME context\n", assoc_id); - return -1; - } - - if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, - initialContextSetupRequest_p->eNB_UE_F1AP_ID)) == NULL) { - F1AP_ERROR("[SCTP %d] Received initial context setup request for non " - "existing UE context 0x%06lx\n", assoc_id, - initialContextSetupRequest_p->eNB_UE_F1AP_ID); - return -1; - } - - /* Initial context request = UE-related procedure -> stream != 0 */ - if (stream == 0) { - F1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", - assoc_id, stream); - return -1; - } - - ue_desc_p->rx_stream = stream; - - ue_desc_p->mme_ue_f1ap_id = initialContextSetupRequest_p->mme_ue_f1ap_id; - - message_p = itti_alloc_new_message(TASK_F1AP, F1AP_INITIAL_CONTEXT_SETUP_REQ); - - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; - ue_desc_p->ue_initial_id = 0; - - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).eNB_ue_f1ap_id = ue_desc_p->eNB_ue_f1ap_id; - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs = - initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.f1ap_E_RABToBeSetupItemCtxtSUReq.count; - - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul = 64;// TO DO(bitrate_t)(initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL); - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl = 1024;//(bitrate_t)(initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL); - - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.encryption_algorithms = - BIT_STRING_to_uint16(&initialContextSetupRequest_p->ueSecurityCapabilities.encryptionAlgorithms); - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = - BIT_STRING_to_uint16(&initialContextSetupRequest_p->ueSecurityCapabilities.integrityProtectionAlgorithms); - - /* Copy the security key */ - memcpy(&F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key, - initialContextSetupRequest_p->securityKey.buf, initialContextSetupRequest_p->securityKey.size); - - for (i = 0; i < initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.f1ap_E_RABToBeSetupItemCtxtSUReq.count; i++) { - F1ap_E_RABToBeSetupItemCtxtSUReq_t *item_p; - - item_p = (F1ap_E_RABToBeSetupItemCtxtSUReq_t *)initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.f1ap_E_RABToBeSetupItemCtxtSUReq.array[i]; - - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].e_rab_id = item_p->e_RAB_ID; - - if (item_p->nAS_PDU != NULL) { - /* Only copy NAS pdu if present */ - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = item_p->nAS_PDU->size; - - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = - malloc(sizeof(uint8_t) * item_p->nAS_PDU->size); - - memcpy(F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer, - item_p->nAS_PDU->buf, item_p->nAS_PDU->size); - F1AP_DEBUG("Received NAS message with the E_RAB setup procedure\n"); - } else { - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = 0; - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = NULL; - } - - /* Set the transport layer address */ - memcpy(F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.buffer, - item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.length = - item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; - - /* GTP tunnel endpoint ID */ - OCTET_STRING_TO_INT32(&item_p->gTP_TEID, F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].gtp_teid); - - /* Set the QOS informations */ - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; - - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.priority_level = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; - F1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; - } - - itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - - return 0; -} - - -static -int f1ap_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p) -{ - f1ap_mme_data_t *mme_desc_p = NULL; - f1ap_ue_context_t *ue_desc_p = NULL; - MessageDef *message_p = NULL; - - F1ap_UEContextReleaseCommandIEs_t *ueContextReleaseCommand_p; - DevAssert(f1ap_message_p != NULL); - - ueContextReleaseCommand_p = &f1ap_message_p->msg.f1ap_UEContextReleaseCommandIEs; - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received UE context release command for non " - "existing MME context\n", assoc_id); - return -1; - } - - F1ap_MME_UE_F1AP_ID_t mme_ue_f1ap_id; - F1ap_ENB_UE_F1AP_ID_t enb_ue_f1ap_id; - - switch (ueContextReleaseCommand_p->uE_F1AP_IDs.present) { - case F1ap_UE_F1AP_IDs_PR_uE_F1AP_ID_pair: - enb_ue_f1ap_id = ueContextReleaseCommand_p->uE_F1AP_IDs.choice.uE_F1AP_ID_pair.eNB_UE_F1AP_ID; - mme_ue_f1ap_id = ueContextReleaseCommand_p->uE_F1AP_IDs.choice.uE_F1AP_ID_pair.mME_UE_F1AP_ID; - - MSC_LOG_RX_MESSAGE( - MSC_F1AP_ENB, - MSC_F1AP_MME, - NULL,0, - "0 UEContextRelease/%s eNB_ue_f1ap_id "F1AP_UE_ID_FMT" mme_ue_f1ap_id "F1AP_UE_ID_FMT" len %u", - f1ap_direction2String[f1ap_message_p->direction], - enb_ue_f1ap_id, - mme_ue_f1ap_id); - - if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, - enb_ue_f1ap_id)) == NULL) { - F1AP_ERROR("[SCTP %d] Received UE context release command for non " - "existing UE context 0x%06lx\n", - assoc_id, - enb_ue_f1ap_id); - /*MessageDef *msg_complete_p; - msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_COMPLETE); - F1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_f1ap_id = enb_ue_f1ap_id; - itti_send_msg_to_task(TASK_F1AP, ue_desc_p->eNB_instance->instance <=> 0, msg_complete_p); - */ - return -1; - } else { - MSC_LOG_TX_MESSAGE( - MSC_F1AP_ENB, - MSC_RRC_ENB, - NULL,0, - "0 F1AP_UE_CONTEXT_RELEASE_COMMAND/%d eNB_ue_f1ap_id "F1AP_UE_ID_FMT" ", - enb_ue_f1ap_id); - - message_p = itti_alloc_new_message(TASK_F1AP, F1AP_UE_CONTEXT_RELEASE_COMMAND); - F1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_f1ap_id = enb_ue_f1ap_id; - itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; - } - - break; - -//#warning "TODO mapping mme_ue_f1ap_id enb_ue_f1ap_id?" - - case F1ap_UE_F1AP_IDs_PR_mME_UE_F1AP_ID: - mme_ue_f1ap_id = ueContextReleaseCommand_p->uE_F1AP_IDs.choice.mME_UE_F1AP_ID; - F1AP_ERROR("TO DO mapping mme_ue_f1ap_id enb_ue_f1ap_id"); - (void)mme_ue_f1ap_id; /* TODO: remove - it's to remove gcc warning about unused var */ - - case F1ap_UE_F1AP_IDs_PR_NOTHING: - default: - F1AP_ERROR("F1AP_UE_CONTEXT_RELEASE_COMMAND not processed, missing info elements"); - return -1; - } -} - -static -int f1ap_handle_e_rab_setup_request(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p) { - - int i; - - f1ap_mme_data_t *mme_desc_p = NULL; - f1ap_ue_context_t *ue_desc_p = NULL; - MessageDef *message_p = NULL; - - F1ap_E_RABSetupRequestIEs_t *f1ap_E_RABSetupRequest; - DevAssert(f1ap_message_p != NULL); - - f1ap_E_RABSetupRequest = &f1ap_message_p->msg.f1ap_E_RABSetupRequestIEs; - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received initial context setup request for non " - "existing MME context\n", assoc_id); - return -1; - } - - - if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, - f1ap_E_RABSetupRequest->eNB_UE_F1AP_ID)) == NULL) { - F1AP_ERROR("[SCTP %d] Received initial context setup request for non " - "existing UE context 0x%06lx\n", assoc_id, - f1ap_E_RABSetupRequest->eNB_UE_F1AP_ID); - return -1; - } - - /* Initial context request = UE-related procedure -> stream != 0 */ - if (stream == 0) { - F1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", - assoc_id, stream); - return -1; - } - - ue_desc_p->rx_stream = stream; - - if ( ue_desc_p->mme_ue_f1ap_id != f1ap_E_RABSetupRequest->mme_ue_f1ap_id){ - F1AP_WARN("UE context mme_ue_f1ap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_f1ap_id, f1ap_E_RABSetupRequest->mme_ue_f1ap_id); - - } - message_p = itti_alloc_new_message(TASK_F1AP, F1AP_E_RAB_SETUP_REQ); - - F1AP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; - - F1AP_E_RAB_SETUP_REQ(message_p).mme_ue_f1ap_id = f1ap_E_RABSetupRequest->mme_ue_f1ap_id; - F1AP_E_RAB_SETUP_REQ(message_p).eNB_ue_f1ap_id = f1ap_E_RABSetupRequest->eNB_UE_F1AP_ID; - - F1AP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup = - f1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.f1ap_E_RABToBeSetupItemBearerSUReq.count; - - for (i = 0; i < f1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.f1ap_E_RABToBeSetupItemBearerSUReq.count; i++) { - F1ap_E_RABToBeSetupItemBearerSUReq_t *item_p; - - item_p = (F1ap_E_RABToBeSetupItemBearerSUReq_t *)f1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.f1ap_E_RABToBeSetupItemBearerSUReq.array[i]; - - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].e_rab_id = item_p->e_RAB_ID; - - // check for the NAS PDU - if (item_p->nAS_PDU.size > 0 ) { - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size; - - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); - - memcpy(F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer, - item_p->nAS_PDU.buf, item_p->nAS_PDU.size); - // F1AP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]); - } else { - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = 0; - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = NULL; - - F1AP_WARN("NAS PDU is not provided, generate a E_RAB_SETUP Failure (TBD) back to MME \n"); - // return -1; - } - - /* Set the transport layer address */ - memcpy(F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, - item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length = - item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; - - /* F1AP_INFO("sgw addr %s len: %d (size %d, index %d)\n", - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length, - item_p->transportLayerAddress.size, i); - */ - /* GTP tunnel endpoint ID */ - OCTET_STRING_TO_INT32(&item_p->gTP_TEID, F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].gtp_teid); - - /* Set the QOS informations */ - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; - - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.priority_level = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_capability = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; - F1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; - } - - itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - - return 0; + ret = (*messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) + (assoc_id, stream, &pdu); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); + return ret; } static -int f1ap_handle_paging(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p) +int f1ap_handle_f1_setup_request(uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { - F1ap_PagingIEs_t *paging_p; - f1ap_mme_data_t *mme_desc_p = NULL; - f1ap_instance_t *f1ap_instance = NULL; - MessageDef *message_p = NULL; - - DevAssert(f1ap_message_p != NULL); - // received Paging Message from MME - F1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id); - - paging_p = &f1ap_message_p->msg.f1ap_PagingIEs; + printf("OOOOOOOOOOOOOOOOOOOOOOOOOOO\n"); - /* Paging procedure -> stream != 0 */ - if (stream == 0) { - F1AP_ERROR("[SCTP %d] Received Paging procedure on stream (%d)\n", - assoc_id, stream); - return -1; - } - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received Paging for non " - "existing MME context\n", assoc_id); - return -1; - } - - f1ap_instance = mme_desc_p->f1ap_instance; - if (f1ap_instance == NULL) { - F1AP_ERROR("[SCTP %d] Received Paging for non existing MME context : f1ap_instance is NULL\n", - assoc_id); - return -1; - } - - message_p = itti_alloc_new_message(TASK_F1AP, F1AP_PAGING_IND); - - /* convert F1ap_PagingIEs_t to f1ap_paging_ind_t */ - /* convert UE Identity Index value */ - F1AP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&paging_p->ueIdentityIndexValue); - F1AP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n", - assoc_id,(uint32_t)F1AP_PAGING_IND(message_p).ue_index_value); - - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0; - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0; - - /* convert UE Paging Identity */ - if (paging_p->uePagingID.present == F1ap_UEPagingID_PR_s_TMSI) { - F1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi; - OCTET_STRING_TO_INT8(&paging_p->uePagingID.choice.s_TMSI.mMEC, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code); - OCTET_STRING_TO_INT32(&paging_p->uePagingID.choice.s_TMSI.m_TMSI, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi); - } else if (paging_p->uePagingID.present == F1ap_UEPagingID_PR_iMSI) { - F1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_imsi; - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length = 0; - for (int i = 0; i < paging_p->uePagingID.choice.iMSI.size; i++) { - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i] = (uint8_t)(paging_p->uePagingID.choice.iMSI.buf[i] & 0x0F ); - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++; - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] = (uint8_t)((paging_p->uePagingID.choice.iMSI.buf[i]>>4) & 0x0F); - LOG_D(F1AP,"paging : i %d %d imsi %d %d \n",2*i,2*i+1,F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i], F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1]); - if (F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] == 0x0F) { - if(i != paging_p->uePagingID.choice.iMSI.size - 1){ - /* invalid paging_p->uePagingID.choise.iMSI.buffer */ - F1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI error(i %d 0x0F)\n", assoc_id,i); - return -1; - } - } else { - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++; - } - } - if (F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length >= F1AP_IMSI_LENGTH) { - /* invalid paging_p->uePagingID.choise.iMSI.size */ - F1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI.size(%d) is over IMSI length(%d)\n", assoc_id, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, F1AP_IMSI_LENGTH); - return -1; - } -} else { - /* invalid paging_p->uePagingID.present */ - F1AP_ERROR("[SCTP %d] Received Paging : uePagingID.present(%d) is unknown\n", assoc_id, paging_p->uePagingID.present); - return -1; - } - -#if 0 - /* convert Paging DRX(optional) */ - if (paging_p->presenceMask & F1AP_PAGINGIES_PAGINGDRX_PRESENT) { - switch(paging_p->pagingDRX) { - case F1ap_PagingDRX_v32: - F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_32; - break; - case F1ap_PagingDRX_v64: - F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_64; - break; - case F1ap_PagingDRX_v128: - F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_128; - break; - case F1ap_PagingDRX_v256: - F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; - break; - default: - // when UE Paging DRX is no value - F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; - break; - } - } -#endif - F1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; - - /* convert cnDomain */ - if (paging_p->cnDomain == F1ap_CNDomain_ps) { - F1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_PS; - } else if (paging_p->cnDomain == F1ap_CNDomain_cs) { - F1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_CS; - } else { - /* invalid paging_p->cnDomain */ - F1AP_ERROR("[SCTP %d] Received Paging : cnDomain(%ld) is unknown\n", assoc_id, paging_p->cnDomain); - return -1; - } - - memset (&F1AP_PAGING_IND(message_p).plmn_identity[0], 0, sizeof(plmn_identity_t)*256); - memset (&F1AP_PAGING_IND(message_p).tac[0], 0, sizeof(int16_t)*256); - F1AP_PAGING_IND(message_p).tai_size = 0; - - for (int i = 0; i < paging_p->taiList.f1ap_TAIItem.count; i++) { - F1AP_INFO("[SCTP %d] Received Paging taiList: i %d, count %d\n", assoc_id, i, paging_p->taiList.f1ap_TAIItem.count); - F1ap_TAIItem_t f1ap_TAIItem; - memset (&f1ap_TAIItem, 0, sizeof(F1ap_TAIItem_t)); - - memcpy(&f1ap_TAIItem, paging_p->taiList.f1ap_TAIItem.array[i], sizeof(F1ap_TAIItem_t)); - - TBCD_TO_MCC_MNC(&f1ap_TAIItem.tAI.pLMNidentity, F1AP_PAGING_IND(message_p).plmn_identity[i].mcc, - F1AP_PAGING_IND(message_p).plmn_identity[i].mnc, - F1AP_PAGING_IND(message_p).plmn_identity[i].mnc_digit_length); - OCTET_STRING_TO_INT16(&f1ap_TAIItem.tAI.tAC, F1AP_PAGING_IND(message_p).tac[i]); - F1AP_PAGING_IND(message_p).tai_size++; - F1AP_DEBUG("[SCTP %d] Received Paging: MCC %d, MNC %d, TAC %d\n", assoc_id, F1AP_PAGING_IND(message_p).plmn_identity[i].mcc, F1AP_PAGING_IND(message_p).plmn_identity[i].mnc, F1AP_PAGING_IND(message_p).tac[i]); - } - -#if 0 - // CSG Id(optional) List is not used - if (paging_p->presenceMask & F1AP_PAGINGIES_CSG_IDLIST_PRESENT) { - // TODO - } - - /* convert pagingPriority (optional) if has value */ - if (paging_p->presenceMask & F1AP_PAGINGIES_PAGINGPRIORITY_PRESENT) { - switch(paging_p->pagingPriority) { - case F1ap_PagingPriority_priolevel1: - F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL1; - break; - case F1ap_PagingPriority_priolevel2: - F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL2; - break; - case F1ap_PagingPriority_priolevel3: - F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL3; - break; - case F1ap_PagingPriority_priolevel4: - F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL4; - break; - case F1ap_PagingPriority_priolevel5: - F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL5; - break; - case F1ap_PagingPriority_priolevel6: - F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL6; - break; - case F1ap_PagingPriority_priolevel7: - F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL7; - break; - case F1ap_PagingPriority_priolevel8: - F1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL8; - break; - default: - /* invalid paging_p->pagingPriority */ - F1AP_ERROR("[SCTP %d] Received paging : pagingPriority(%ld) is invalid\n", assoc_id, paging_p->pagingPriority); - return -1; - } - } -#endif - //paging parameter values - F1AP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d cn_domain %d paging_drx %d paging_priority %d\n",assoc_id, - F1AP_PAGING_IND(message_p).ue_index_value, F1AP_PAGING_IND(message_p).cn_domain, - F1AP_PAGING_IND(message_p).paging_drx, F1AP_PAGING_IND(message_p).paging_priority); - F1AP_DEBUG("[SCTP %d] Received Paging parameters(ue): presenceMask %d s_tmsi.m_tmsi %d s_tmsi.mme_code %d IMSI length %d (0-5) %d%d%d%d%d%d\n",assoc_id, - F1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi, - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code, F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1], - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3], - F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], F1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]); - - /* send message to RRC */ - itti_send_msg_to_task(TASK_RRC_ENB, f1ap_instance->instance, message_p); - return 0; } - -static -int f1ap_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p) { - - int i; - - f1ap_mme_data_t *mme_desc_p = NULL; - f1ap_ue_context_t *ue_desc_p = NULL; - MessageDef *message_p = NULL; - int nb_of_e_rabs_failed = 0; - - F1ap_E_RABModifyRequestIEs_t *f1ap_E_RABModifyRequest; - DevAssert(f1ap_message_p != NULL); - - f1ap_E_RABModifyRequest = &f1ap_message_p->msg.f1ap_E_RABModifyRequestIEs; - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received E-RAB modify request for non " - "existing MME context\n", assoc_id); - return -1; - } - - - if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, - f1ap_E_RABModifyRequest->eNB_UE_F1AP_ID)) == NULL) { - F1AP_ERROR("[SCTP %d] Received E-RAB modify request for non " - "existing UE context 0x%06lx\n", assoc_id, - f1ap_E_RABModifyRequest->eNB_UE_F1AP_ID); - return -1; - } - - /* E-RAB modify request = UE-related procedure -> stream != 0 */ - if (stream == 0) { - F1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", - assoc_id, stream); - return -1; - } - - ue_desc_p->rx_stream = stream; - - if ( ue_desc_p->mme_ue_f1ap_id != f1ap_E_RABModifyRequest->mme_ue_f1ap_id){ - F1AP_WARN("UE context mme_ue_f1ap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_f1ap_id, f1ap_E_RABModifyRequest->mme_ue_f1ap_id); - message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_E_RAB_MODIFY_RESP); - - F1AP_E_RAB_MODIFY_RESP (message_p).eNB_ue_f1ap_id = f1ap_E_RABModifyRequest->eNB_UE_F1AP_ID; -// F1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[F1AP_MAX_E_RAB]; - F1AP_E_RAB_MODIFY_RESP (message_p).nb_of_e_rabs = 0; - - for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.count; nb_of_e_rabs_failed++) { - F1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = - ((F1ap_E_RABToBeModifiedItemBearerModReq_t *)f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.array[nb_of_e_rabs_failed])->e_RAB_ID; - F1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].cause = F1AP_CAUSE_RADIO_NETWORK; - F1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = 13;//F1ap_CauseRadioNetwork_unknown_mme_ue_f1ap_id; - } - F1AP_E_RAB_MODIFY_RESP (message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; - - f1ap_e_rab_modify_resp(mme_desc_p->f1ap_instance->instance, - &F1AP_E_RAB_MODIFY_RESP(message_p)); - - message_p = NULL; - return -1; - } - - message_p = itti_alloc_new_message(TASK_F1AP, F1AP_E_RAB_MODIFY_REQ); - - F1AP_E_RAB_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; - - F1AP_E_RAB_MODIFY_REQ(message_p).mme_ue_f1ap_id = f1ap_E_RABModifyRequest->mme_ue_f1ap_id; - F1AP_E_RAB_MODIFY_REQ(message_p).eNB_ue_f1ap_id = f1ap_E_RABModifyRequest->eNB_UE_F1AP_ID; - - F1AP_E_RAB_MODIFY_REQ(message_p).nb_e_rabs_tomodify = - f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.count; - - for (i = 0; i < f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.count; i++) { - F1ap_E_RABToBeModifiedItemBearerModReq_t *item_p; - - item_p = (F1ap_E_RABToBeModifiedItemBearerModReq_t *)f1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.f1ap_E_RABToBeModifiedItemBearerModReq.array[i]; - - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].e_rab_id = item_p->e_RAB_ID; - - // check for the NAS PDU - if (item_p->nAS_PDU.size > 0 ) { - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size; - - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); - - memcpy(F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer, - item_p->nAS_PDU.buf, item_p->nAS_PDU.size); - } else { - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = 0; - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = NULL; - continue; - } - - /* Set the QOS informations */ - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI; - - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.priority_level = - item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel; - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_capability = - item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; - F1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = - item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; - - } - - itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - - return 0; -} -// handle e-rab release command and send it to rrc_end -static -int f1ap_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - struct f1ap_message_s *f1ap_message_p) { - - int i; - - f1ap_mme_data_t *mme_desc_p = NULL; - f1ap_ue_context_t *ue_desc_p = NULL; - MessageDef *message_p = NULL; - - F1ap_E_RABReleaseCommandIEs_t *f1ap_E_RABReleaseCommand; - DevAssert(f1ap_message_p != NULL); - f1ap_E_RABReleaseCommand = &f1ap_message_p->msg.f1ap_E_RABReleaseCommandIEs; - - if ((mme_desc_p = f1ap_get_MME(NULL, assoc_id, 0)) == NULL) { - F1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing MME context\n", assoc_id); - return -1; - } - if ((ue_desc_p = f1ap_get_ue_context(mme_desc_p->f1ap_instance, - f1ap_E_RABReleaseCommand->eNB_UE_F1AP_ID)) == NULL) { - F1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id, - f1ap_E_RABReleaseCommand->eNB_UE_F1AP_ID); - return -1; - } - - /* Initial context request = UE-related procedure -> stream != 0 */ - if (stream == 0) { - F1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", - assoc_id, stream); - return -1; - } - - ue_desc_p->rx_stream = stream; - - if ( ue_desc_p->mme_ue_f1ap_id != f1ap_E_RABReleaseCommand->mme_ue_f1ap_id){ - F1AP_WARN("UE context mme_ue_f1ap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_f1ap_id, f1ap_E_RABReleaseCommand->mme_ue_f1ap_id); - } - - F1AP_DEBUG("[SCTP %d] Received E-RAB release command for eNB_UE_F1AP_ID %ld mme_ue_f1ap_id %ld\n", - assoc_id, f1ap_E_RABReleaseCommand->eNB_UE_F1AP_ID, f1ap_E_RABReleaseCommand->mme_ue_f1ap_id); - - message_p = itti_alloc_new_message(TASK_F1AP, F1AP_E_RAB_RELEASE_COMMAND); - - F1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_f1ap_id = f1ap_E_RABReleaseCommand->eNB_UE_F1AP_ID; - F1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_f1ap_id = f1ap_E_RABReleaseCommand->mme_ue_f1ap_id; - if(f1ap_E_RABReleaseCommand->nas_pdu.size > 0 ){ - F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = f1ap_E_RABReleaseCommand->nas_pdu.size; - - F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = - malloc(sizeof(uint8_t) * f1ap_E_RABReleaseCommand->nas_pdu.size); - - memcpy(F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer, - f1ap_E_RABReleaseCommand->nas_pdu.buf, - f1ap_E_RABReleaseCommand->nas_pdu.size); - } else { - F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0; - F1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL; - } - - F1AP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = f1ap_E_RABReleaseCommand->e_RABToBeReleasedList.f1ap_E_RABItem.count; - for(i=0; i < f1ap_E_RABReleaseCommand->e_RABToBeReleasedList.f1ap_E_RABItem.count; i++){ - F1ap_E_RABItem_t *item_p; - item_p = (F1ap_E_RABItem_t*)f1ap_E_RABReleaseCommand->e_RABToBeReleasedList.f1ap_E_RABItem.array[i]; - F1AP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID; - F1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); - } - - itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - - return 0; -} diff --git a/openair2/F1AP/f1ap_handlers.h b/openair2/F1AP/f1ap_handlers.h index eaa2b15c31..c3a7b7b225 100644 --- a/openair2/F1AP/f1ap_handlers.h +++ b/openair2/F1AP/f1ap_handlers.h @@ -33,8 +33,6 @@ #ifndef F1AP_HANDLERS_H_ #define F1AP_HANDLERS_H_ -void f1ap_handle_f1_setup_message(f1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown); - int f1ap_handle_message(uint32_t assoc_id, int32_t stream, const uint8_t * const data, const uint32_t data_length); diff --git a/openair2/F1AP/sctp_cu.c b/openair2/F1AP/sctp_cu.c index 546759e003..29f8e93c8c 100644 --- a/openair2/F1AP/sctp_cu.c +++ b/openair2/F1AP/sctp_cu.c @@ -40,6 +40,7 @@ #include <pthread.h> #include <unistd.h> // for close #include <stdlib.h> +#include "f1ap_handlers.h" #define MAX_BUFFER 1024 @@ -81,7 +82,10 @@ void *recv_func(void *cfd) { printf("\n"); - f1ap_decode_pdu(NULL , buffer_recv, sizeof(buffer_recv)); + f1ap_handle_message(1/*sctp_data_ind->assoc_id*/, 1/*sctp_data_ind->stream*/, + buffer_recv, sizeof(buffer_recv)); + + //f1ap_decode_pdu(NULL , buffer_recv, sizeof(buffer_recv)); } printf("ret = %d\n", ret); close( *(int*)cfd ); -- GitLab From 3e987bc1430bf22f416ba34e0a4249ce32ff028a Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Wed, 5 Sep 2018 11:53:08 +0200 Subject: [PATCH 025/308] update of cu configuration file --- openair2/ENB_APP/enb_config.c | 40 ++++++++++--------- .../PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf | 9 ++++- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 84bf7b0f29..de468b79ca 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -815,10 +815,9 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { char enbpath[MAX_OPTNAME_SIZE + 8]; - if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU) { - LOG_I(RRC,"Configuring Cell Information\n"); - // PLMN information for SIB1 in DU - RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id; + LOG_I(RRC,"Configuring Cell Information\n"); + // PLMN information for SIB1 in DU + RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id; /* if (strcmp(*(ENBParamList.paramarray[i][ENB_CELL_TYPE_IDX].strptr), "CELL_MACRO_ENB") == 0) { @@ -833,21 +832,20 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { enb_properties_loc.properties[enb_properties_loc_index]->eNB_name = strdup(enb_name); */ - RRC_CONFIGURATION_REQ (msg_p).tac = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); - RRC_CONFIGURATION_REQ (msg_p).mcc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); - RRC_CONFIGURATION_REQ (msg_p).mnc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); - RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); - AssertFatal((RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 2) || - (RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 3), - "BAD MNC DIGIT LENGTH %d", - RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length); - + RRC_CONFIGURATION_REQ (msg_p).tac = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mcc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mnc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + AssertFatal((RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 2) || + (RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 3), + "BAD MNC DIGIT LENGTH %d", + RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length); + + + // Parse optional physical parameters + sprintf(enbpath,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k), + config_getlist( &CCsParamList,NULL,0,enbpath); - // Parse optional physical parameters - sprintf(enbpath,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k), - config_getlist( &CCsParamList,NULL,0,enbpath); - } - LOG_I(RRC,"num component carriers %d \n",CCsParamList.numelt); if ( CCsParamList.numelt> 0) { @@ -2346,6 +2344,12 @@ return 0; int RCconfig_CU_F1(uint32_t i) { AssertFatal(1==0,"Shouldn't get here yet\n"); + + // 1. wait for F1AP_SETUP_REQ + // 2. configure cells with selected PLMN(s) + // 3. send F1AP_SETUP_RESP and return to setup S1AP + + while( } int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf index b740b02172..49140cdfe7 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf @@ -12,6 +12,13 @@ eNBs = eNB_name = "eNB-CU-Eurecom-LTEBox"; + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "93"; + tr_s_preference = "f1" local_s_if_name = "lo"; @@ -26,7 +33,7 @@ eNBs = component_carriers = ( { - node_function = "3GPP_eNO"; + node_function = "3GPP_eNodeB"; node_timing = "synch_to_ext_device"; node_synch_ref = 0; pbch_repetition = "FALSE"; -- GitLab From 32a39e9a678a08590917011c15c0df818af9f323 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Wed, 5 Sep 2018 22:28:56 +0200 Subject: [PATCH 026/308] CU configuration modifications --- openair2/ENB_APP/enb_app.c | 6 ++--- openair2/ENB_APP/enb_config.c | 27 +++++++++++-------- openair2/RRC/LTE/rrc_defs.h | 3 +++ .../PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index f0dd39d3e6..d4c3346ed2 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -139,8 +139,6 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u RCconfig_S1(msg_p, enb_id); - if (node_type == ngran_eNB_CU || node_type == ngran_ng_eNB_CU) RCconfig_CU_F1(enb_id); - if (enb_id == 0) RCconfig_gtpu(); LOG_I(ENB_APP,"default drx %d\n",((S1AP_REGISTER_ENB_REQ(msg_p)).default_drx)); @@ -205,14 +203,14 @@ void *eNB_app_task(void *args_p) LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst); RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *)); - LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc); + LOG_I(ENB_APP, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc); if (RC.nb_macrlc_inst>0) AssertFatal(RC.nb_macrlc_inst == enb_id_end-enb_id_start, "Number of MACRLC instances %d != number of RRC instances %d\n", RC.nb_macrlc_inst,enb_id_end-enb_id_start); for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST)); - LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end); + LOG_I(ENB_APP, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end); memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); configure_rrc(enb_id); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index de468b79ca..51a3ca6cd7 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -784,6 +784,20 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { rrc->node_type = ngran_eNB; } else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) { + + paramdef_t SCTPParams[] = SCTPPARAMS_DESC; + paramdef_t NETParams[] = NETPARAMS_DESC; + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + + sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,i,ENB_CONFIG_STRING_SCTP_CONFIG); + config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); + + int gNB_CU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); + LOG_I(ENB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,gNB_CU_id); + + char *gNB_CU_name = *(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr); + LOG_I(ENB_APP,"F1AP: gNB_CU_name[%d] %s\n",k,gNB_CU_name); + rrc->eth_params_s.local_if_name = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_IF_NAME_IDX].strptr)); LOG_I(RRC,"Configuring CU-DU interfaces for MACRLC on %s\n",rrc->eth_params_s.local_if_name); rrc->eth_params_s.my_addr = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_ADDRESS_IDX].strptr)); @@ -800,6 +814,8 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { LOG_I(RRC,"remote port (F1U) %d\n",rrc->eth_params_s.remote_portd); rrc->eth_params_s.transp_preference = ETH_UDP_MODE; rrc->node_type = ngran_eNB_CU; + rrc->sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr); + rrc->sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr); } else { // no F1 @@ -2341,17 +2357,6 @@ int RCconfig_gtpu(void ) { return 0; } -int RCconfig_CU_F1(uint32_t i) { - - AssertFatal(1==0,"Shouldn't get here yet\n"); - - // 1. wait for F1AP_SETUP_REQ - // 2. configure cells with selected PLMN(s) - // 3. send F1AP_SETUP_RESP and return to setup S1AP - - while( -} - int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { int k; diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 9767cc6ee9..ae3dd3402d 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -720,6 +720,9 @@ typedef struct eNB_RRC_INST_s { int srs_enable[MAX_NUM_CCs]; int cell_info_configured; pthread_mutex_t cell_info_mutex; + uint16_t sctp_in_streams; + uint16_t sctp_out_streams; + } eNB_RRC_INST; #define MAX_UE_CAPABILITY_SIZE 255 diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf index 49140cdfe7..ba0bd886a6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf @@ -1,4 +1,4 @@ -Active_eNBs = ( "eNB-Eurecom-LTEBox"); +Active_eNBs = ( "eNB-CU-Eurecom-LTEBox"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -- GitLab From b2583c6f23a5d3b08b942ba76f368c09b6be9cb5 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Thu, 6 Sep 2018 09:24:10 +0200 Subject: [PATCH 027/308] CU is exectuable --- targets/RT/USER/lte-softmodem.c | 269 ++++++++++++++++++-------------- 1 file changed, 154 insertions(+), 115 deletions(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index bf07e93f39..3c4c2b7125 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -986,13 +986,15 @@ int main( int argc, char **argv ) LOG_E(OPT,"failed to run OPT \n"); } + if (RC.rrc[0]->node_type != ngran_eNB_DU) { #ifdef PDCP_USE_NETLINK - printf("PDCP netlink\n"); - netlink_init(); + printf("PDCP netlink\n"); + netlink_init(); #if defined(PDCP_USE_NETLINK_QUEUES) - pdcp_netlink_init(); + pdcp_netlink_init(); #endif #endif + } #if !defined(ENABLE_ITTI) // to make a graceful exit when ctrl-c is pressed @@ -1011,13 +1013,13 @@ int main( int argc, char **argv ) - + printf("Before CC \n"); - + printf("Runtime table\n"); fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx); - - + + #ifndef DEADLINE_SCHEDULER printf("NO deadline scheduler\n"); @@ -1056,24 +1058,26 @@ int main( int argc, char **argv ) LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity); #endif + + + + int have_rrc=0; - - -#if defined(ENABLE_ITTI) if (RC.nb_inst > 0) { // don't create if node doesn't connect to RRC/S1/F1/GTP - if (create_tasks(1) < 0) { - printf("cannot create ITTI tasks\n"); - exit(-1); // need a softer mode - } + if (create_tasks(1) < 0) { + printf("cannot create ITTI tasks\n"); + exit(-1); // need a softer mode + } printf("ITTI tasks created\n"); + have_rrc=1; } else { printf("No ITTI, Initializing L1\n"); RCconfig_L1(); } -#endif + /* Start the agent. If it is turned off in the configuration, it won't start */ RCconfig_flexran(); @@ -1081,23 +1085,49 @@ int main( int argc, char **argv ) flexran_agent_start(i); } - // init UE_PF_PO and mutex lock - pthread_mutex_init(&ue_pf_po_mutex, NULL); - memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs); - - mlockall(MCL_CURRENT | MCL_FUTURE); - - pthread_cond_init(&sync_cond,NULL); - pthread_mutex_init(&sync_mutex, NULL); - -#ifdef XFORMS - int UE_id; - - printf("XFORMS\n"); + int cu_flag =0; - if (do_forms==1) { - fl_initialize (&argc, argv, NULL, 0, 0); + if (have_rrc == 1) { + + // wait for RRC to be initialized + + + int rrc_allocated; + do { + rrc_allocated=1; + for (int i=0;i<RC.nb_inst;i++) + if (RC.rrc == NULL || RC.rrc[i]==NULL) rrc_allocated=0; + if (rrc_allocated==0) { printf("Waiting for RRC allocation ...\n"); usleep(10000); } + } while (rrc_allocated==0); + + int cell_info_configured; + do { + pthread_mutex_lock(&RC.rrc[0]->cell_info_mutex); + cell_info_configured = RC.rrc[0]->cell_info_configured; + pthread_mutex_unlock(&RC.rrc[0]->cell_info_mutex); + if (cell_info_configured == 0) {printf ("Waiting for RRC cell configuration\n"); usleep(10000);} + } while(cell_info_configured == 0); + if (RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU) cu_flag=1; + } + + if (cu_flag == 0) { + // init UE_PF_PO and mutex lock + pthread_mutex_init(&ue_pf_po_mutex, NULL); + memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs); + + mlockall(MCL_CURRENT | MCL_FUTURE); + + pthread_cond_init(&sync_cond,NULL); + pthread_mutex_init(&sync_mutex, NULL); + +#ifdef XFORMS + int UE_id; + + printf("XFORMS\n"); + if (do_forms==1) { + fl_initialize (&argc, argv, NULL, 0, 0); + form_stats_l2 = create_form_stats_form(); fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats"); form_stats = create_form_stats_form(); @@ -1118,29 +1148,29 @@ int main( int argc, char **argv ) } } // CC_id } // UE_id + + ret = pthread_create(&forms_thread, NULL, scope_thread, NULL); + + if (ret == 0) + pthread_setname_np( forms_thread, "xforms" ); + + printf("Scope thread created, ret=%d\n",ret); + } - ret = pthread_create(&forms_thread, NULL, scope_thread, NULL); +#endif - if (ret == 0) - pthread_setname_np( forms_thread, "xforms" ); + rt_sleep_ns(10*100000000ULL); - printf("Scope thread created, ret=%d\n",ret); - } - -#endif - - rt_sleep_ns(10*100000000ULL); - - if (nfapi_mode) - { - printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n"); - pthread_cond_init(&sync_cond,NULL); - pthread_mutex_init(&sync_mutex, NULL); - } - - const char *nfapi_mode_str = "<UNKNOWN>"; - - switch(nfapi_mode) { + if (nfapi_mode) + { + printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n"); + pthread_cond_init(&sync_cond,NULL); + pthread_mutex_init(&sync_mutex, NULL); + } + + const char *nfapi_mode_str = "<UNKNOWN>"; + + switch(nfapi_mode) { case 0: nfapi_mode_str = "MONOLITHIC"; break; @@ -1153,16 +1183,17 @@ int main( int argc, char **argv ) default: nfapi_mode_str = "<UNKNOWN NFAPI MODE>"; break; - } - printf("NFAPI MODE:%s\n", nfapi_mode_str); - - if (nfapi_mode==2) // VNF - wait_nfapi_init("main?"); - - printf("START MAIN THREADS\n"); - - // start the main threads - + } + printf("NFAPI MODE:%s\n", nfapi_mode_str); + + if (nfapi_mode==2) // VNF + wait_nfapi_init("main?"); + + + printf("START MAIN THREADS\n"); + + // start the main threads + number_of_cards = 1; printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst); if (RC.nb_L1_inst > 0) { @@ -1171,10 +1202,10 @@ int main( int argc, char **argv ) // for (inst=0;inst<RC.nb_L1_inst;inst++) // for (CC_id=0;CC_id<RC.nb_L1_CC[inst];CC_id++) phy_init_lte_eNB(RC.eNB[inst][CC_id],0,0); } - + printf("wait_eNBs()\n"); wait_eNBs(); - + printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU); if (RC.nb_RU >0) { printf("Initializing RU threads\n"); @@ -1184,45 +1215,46 @@ int main( int argc, char **argv ) RC.ru[ru_id]->rf_map.chain=CC_id+chain_offset; } } - + config_sync_var=0; - + if (nfapi_mode==1) { // PNF wait_nfapi_init("main?"); } - + printf("wait RUs\n"); wait_RUs(); printf("ALL RUs READY!\n"); printf("RC.nb_RU:%d\n", RC.nb_RU); // once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration) printf("ALL RUs ready - init eNBs\n"); - + if (nfapi_mode != 1 && nfapi_mode != 2) - { - printf("Not NFAPI mode - call init_eNB_afterRU()\n"); - init_eNB_afterRU(); - } + { + printf("Not NFAPI mode - call init_eNB_afterRU()\n"); + init_eNB_afterRU(); + } else - { - printf("NFAPI mode - DO NOT call init_eNB_afterRU()\n"); - } + { + printf("NFAPI mode - DO NOT call init_eNB_afterRU()\n"); + } printf("ALL RUs ready - ALL eNBs ready\n"); - - - // connect the TX/RX buffers + + + // connect the TX/RX buffers - sleep(1); /* wait for thread activation */ - - printf("Sending sync to all threads\n"); - - pthread_mutex_lock(&sync_mutex); - sync_var=0; - pthread_cond_broadcast(&sync_cond); - pthread_mutex_unlock(&sync_mutex); + sleep(1); /* wait for thread activation */ + + printf("Sending sync to all threads\n"); + + pthread_mutex_lock(&sync_mutex); + sync_var=0; + pthread_cond_broadcast(&sync_cond); + pthread_mutex_unlock(&sync_mutex); + } - // wait for end of program + // wait for end of program printf("TYPE <CTRL-C> TO TERMINATE\n"); //getchar(); @@ -1241,34 +1273,38 @@ int main( int argc, char **argv ) #endif // stop threads -#ifdef XFORMS - printf("waiting for XFORMS thread\n"); - if (do_forms==1) { - pthread_join(forms_thread,&status); - fl_hide_form(form_stats->stats_form); - fl_free_form(form_stats->stats_form); + if (cu_flag == 0) { + int UE_id; +#ifdef XFORMS + printf("waiting for XFORMS thread\n"); + + if (do_forms==1) { + pthread_join(forms_thread,&status); + fl_hide_form(form_stats->stats_form); + fl_free_form(form_stats->stats_form); + fl_hide_form(form_stats_l2->stats_form); fl_free_form(form_stats_l2->stats_form); - + for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) { for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { fl_hide_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb); fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb); } } - } - + } + #endif - printf("stopping MODEM threads\n"); - - // cleanup - for (ru_id=0;ru_id<RC.nb_RU;ru_id++) { - stop_ru(RC.ru[ru_id]); - } - + printf("stopping MODEM threads\n"); + + // cleanup + for (ru_id=0;ru_id<RC.nb_RU;ru_id++) { + stop_ru(RC.ru[ru_id]); + } + stop_eNB(NB_eNB_INST); stop_RU(RC.nb_RU); /* release memory used by the RU/eNB threads (incomplete), after all @@ -1284,21 +1320,18 @@ int main( int argc, char **argv ) } free_lte_top(); - printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); - end_configmodule(); - printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); - - pthread_cond_destroy(&sync_cond); - pthread_mutex_destroy(&sync_mutex); - - pthread_cond_destroy(&nfapi_sync_cond); - pthread_mutex_destroy(&nfapi_sync_mutex); - - pthread_mutex_destroy(&ue_pf_po_mutex); - - // *** Handle per CC_id openair0 - + pthread_cond_destroy(&sync_cond); + pthread_mutex_destroy(&sync_mutex); + + pthread_cond_destroy(&nfapi_sync_cond); + pthread_mutex_destroy(&nfapi_sync_mutex); + + pthread_mutex_destroy(&ue_pf_po_mutex); + + // *** Handle per CC_id openair0 + + for(ru_id=0; ru_id<RC.nb_RU; ru_id++) { if (RC.ru[ru_id]->rfdevice.trx_end_func) { RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice); @@ -1309,6 +1342,12 @@ int main( int argc, char **argv ) RC.ru[ru_id]->ifdevice.trx_end_func = NULL; } } + } + + printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); + end_configmodule(); + printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); + if (opt_enabled == 1) terminate_opt(); -- GitLab From 14298413a47b63ea6d3d09f363eda2e045b9f94a Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 5 Sep 2018 19:21:00 +0200 Subject: [PATCH 028/308] Fix obvious warnings when building CU/DU tests --- openair2/F1AP/CU_F1AP.c | 39 ++++++++++++++--------------------- openair2/F1AP/DU_F1AP.c | 22 +++++++------------- openair2/F1AP/f1ap_handlers.c | 2 +- 3 files changed, 23 insertions(+), 40 deletions(-) diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 077dd4c858..4b5f7b942c 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -84,7 +84,7 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ // ============================================================================== -void F1AP_CU_task() { +void F1AP_CU_task(void) { printf("Start F1AP CU task!\n"); sctp_cu_init(); @@ -122,18 +122,16 @@ void F1AP_CU_task() { // } // while - return NULL; + return; } // ============================================================================== -//void CU_handle_F1_SETUP_REQUEST(struct F1AP_F1AP_PDU_t *message_p) { -void CU_handle_F1_SETUP_REQUEST() { +void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { F1AP_F1AP_PDU_t pdu; uint8_t *buffer; uint32_t len; - int ret = 0; /* Receiver */ //f1ap_receiver(&buffer); @@ -152,7 +150,7 @@ void CU_handle_F1_SETUP_REQUEST() { } -void CU_send_F1_SETUP_RESPONSE() { +void CU_send_F1_SETUP_RESPONSE(void) { //void CU_send_F1_SETUP_RESPONSE(F1AP_F1SetupResponse_t *F1SetupResponse) { //AssertFatal(1==0,"Not implemented yet\n"); @@ -168,7 +166,6 @@ void CU_send_F1_SETUP_RESPONSE() { uint8_t *buffer; uint32_t len; - int ret = 0; int i = 0; f1ap_info_t f1ap_info; @@ -420,7 +417,7 @@ void CU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(){ +void CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(void) { printf("CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER\n"); // decode the F1 message @@ -436,15 +433,13 @@ void CU_handle_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessage } //void CU_send_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { -void CU_send_DL_RRC_MESSAGE_TRANSFER() { +void CU_send_DL_RRC_MESSAGE_TRANSFER(void) { F1AP_F1AP_PDU_t pdu; F1AP_DLRRCMessageTransfer_t *out; F1AP_DLRRCMessageTransferIEs_t *ie; uint8_t *buffer; uint32_t len; - int ret = 0; - int i = 0; /* Create */ /* 0. Message Type */ @@ -534,7 +529,6 @@ void CU_send_DL_RRC_MESSAGE_TRANSFER() { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return -1; } printf("\n"); @@ -568,7 +562,6 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du uint8_t *buffer; uint32_t len; - int ret = 0; int i = 0; f1ap_info_t f1ap_info; @@ -929,7 +922,7 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return -1; + return; } printf("\n"); @@ -950,14 +943,13 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpda //void CU_send_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { -void CU_send_UE_CONTEXT_SETUP_REQUEST() { +void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextSetupRequest_t *out; F1AP_UEContextSetupRequestIEs_t *ie; uint8_t *buffer; uint32_t len; - int ret = 0; int i = 0; f1ap_info_t f1ap_info; @@ -1263,16 +1255,16 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST() { /* OPTIONAL */ if (0) { - F1AP_InactivityMonitoringRequest_t InactivityMonitoringRequest; - F1AP_RAT_FrequencyPriorityInformation_t RAT_FrequencyPriorityInformation; - F1AP_RRCContainer_t RRCContainer; - F1AP_MaskedIMEISV_t MaskedIMEISV; + //F1AP_InactivityMonitoringRequest_t InactivityMonitoringRequest; + //F1AP_RAT_FrequencyPriorityInformation_t RAT_FrequencyPriorityInformation; + //F1AP_RRCContainer_t RRCContainer; + //F1AP_MaskedIMEISV_t MaskedIMEISV; } /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return -1; + return; } printf("\n"); @@ -1308,14 +1300,13 @@ void CU_handle_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UECo } //void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { -void CU_send_UE_CONTEXT_MODIFICATION_REQUEST() { +void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextModificationRequest_t *out; F1AP_UEContextModificationRequestIEs_t *ie; uint8_t *buffer; uint32_t len; - int ret = 0; int i = 0; f1ap_info_t f1ap_info; @@ -1771,7 +1762,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST() { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return -1; + return; } printf("\n"); diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index b6915b7af2..35ae157691 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -93,7 +93,7 @@ uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { // ============================================================================== -void F1AP_DU_task() { +void F1AP_DU_task(void) { printf("Start F1AP DU task!\n"); sctp_du_init(); @@ -116,7 +116,7 @@ void F1AP_DU_task() { // } // while - return NULL; + return; } // ============================================================================== @@ -136,7 +136,6 @@ void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP) { uint8_t *buffer; uint32_t len; - int ret = 0; int i = 0; // for test @@ -607,8 +606,6 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( uint8_t *buffer; uint32_t len; - int ret = 0; - int i = 0; // for test f1ap_info_t f1ap_info; @@ -700,15 +697,13 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( } //void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -void DU_send_UL_RRC_MESSAGE_TRANSFER() { +void DU_send_UL_RRC_MESSAGE_TRANSFER(void) { F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; F1AP_ULRRCMessageTransferIEs_t *ie; uint8_t *buffer; uint32_t len; - int ret = 0; - int i = 0; /* Create */ /* 0. Message Type */ @@ -786,7 +781,6 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du uint8_t *buffer; uint32_t len; - int ret = 0; int i = 0; // for test @@ -1263,14 +1257,13 @@ void DU_handle_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextS } //void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { -void DU_send_UE_CONTEXT_SETUP_RESPONSE() { +void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextSetupResponse_t *out; F1AP_UEContextSetupResponseIEs_t *ie; uint8_t *buffer; uint32_t len; - int ret = 0; int i = 0; f1ap_info_t f1ap_info; @@ -1533,7 +1526,7 @@ void DU_send_UE_CONTEXT_SETUP_RESPONSE() { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return -1; + return; } printf("\n"); @@ -1569,14 +1562,13 @@ void DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest } //void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { -void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE() { +void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextModificationResponse_t *out; F1AP_UEContextModificationResponseIEs_t *ie; uint8_t *buffer; uint32_t len; - int ret = 0; int i = 0; f1ap_info_t f1ap_info; @@ -1922,7 +1914,7 @@ void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE() { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return -1; + return; } printf("\n"); diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index dd2be53943..0ddd1a9675 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -83,7 +83,7 @@ f1ap_message_decoded_callback messages_callback[][3] = { { 0, 0, 0 }, /* PWSFailureIndication */ }; -char *f1ap_direction2String(int f1ap_dir) { +const char *f1ap_direction2String(int f1ap_dir) { static const char *f1ap_direction_String[] = { "", /* Nothing */ "Initiating message", /* initiating message */ -- GitLab From 63a2fb0660a407daa262063abcb1a390cb7d7e4b Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 6 Sep 2018 10:03:55 +0200 Subject: [PATCH 029/308] Handle warnings regarding undeclared functions for dec, enc, sctp --- openair2/F1AP/CU_F1AP.c | 3 +++ openair2/F1AP/DU_F1AP.c | 3 +-- openair2/F1AP/f1ap_common.h | 2 +- openair2/F1AP/f1ap_decoder.c | 3 +-- openair2/F1AP/f1ap_decoder.h | 4 +++- openair2/F1AP/f1ap_encoder.h | 4 +++- openair2/F1AP/sctp_cu.c | 5 +++-- openair2/F1AP/sctp_cu.h | 40 ++++++++++++++++++++++++++++++++++ openair2/F1AP/sctp_du.h | 42 ++++++++++++++++++++++++++++++++++++ 9 files changed, 97 insertions(+), 9 deletions(-) create mode 100644 openair2/F1AP/sctp_cu.h create mode 100644 openair2/F1AP/sctp_du.h diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 4b5f7b942c..72cc663731 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -33,6 +33,9 @@ #include "conversions.h" #include "f1ap_common.h" #include "f1ap_messages_types.h" +#include "f1ap_encoder.h" +#include "f1ap_decoder.h" +#include "sctp_cu.h" #include "platform_types.h" #include "log.h" diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 35ae157691..d04312251d 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -35,8 +35,7 @@ #include "f1ap_messages_types.h" #include "platform_types.h" #include "common/utils/LOG/log.h" - - +#include "sctp_du.h" /* This structure describes association of a DU to a CU */ diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index fb33333a41..0bfc65bc4d 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -416,7 +416,7 @@ typedef struct f1ap_net_ip_address_s { typedef int (*f1ap_message_decoded_callback)( uint32_t assoc_id, uint32_t stream, - struct f1ap_message_s *message_p + F1AP_F1AP_PDU_t *message_p ); /** \brief Encode a successfull outcome message diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index fa861915f4..3be1013b41 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -134,8 +134,7 @@ static int f1ap_eNB_decode_unsuccessful_outcome(F1AP_F1AP_PDU_t *pdu) return 0; } -int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, - const uint32_t length) +int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length) { asn_dec_rval_t dec_ret; diff --git a/openair2/F1AP/f1ap_decoder.h b/openair2/F1AP/f1ap_decoder.h index c16e880c33..c8522d6ca5 100644 --- a/openair2/F1AP/f1ap_decoder.h +++ b/openair2/F1AP/f1ap_decoder.h @@ -33,7 +33,9 @@ #ifndef F1AP_ENB_ENCODER_H_ #define F1AP_ENB_ENCODER_H_ -int f1ap_eNB_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) +#include "f1ap_common.h" + +int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length) __attribute__ ((warn_unused_result)); #endif /* F1AP_ENB_ENCODER_H_ */ diff --git a/openair2/F1AP/f1ap_encoder.h b/openair2/F1AP/f1ap_encoder.h index d926497aa5..682395890a 100644 --- a/openair2/F1AP/f1ap_encoder.h +++ b/openair2/F1AP/f1ap_encoder.h @@ -33,7 +33,9 @@ #ifndef F1AP_ENCODER_H_ #define F1AP_ENCODER_H_ -int f1ap_encode_pdu(f1ap_message *message, uint8_t **buffer, uint32_t *len) +#include "f1ap_common.h" + +int f1ap_encode_pdu(F1AP_F1AP_PDU_t *message, uint8_t **buffer, uint32_t *len) __attribute__ ((warn_unused_result)); #endif /* F1AP_ENCODER_H_ */ diff --git a/openair2/F1AP/sctp_cu.c b/openair2/F1AP/sctp_cu.c index 29f8e93c8c..4e9dd98a99 100644 --- a/openair2/F1AP/sctp_cu.c +++ b/openair2/F1AP/sctp_cu.c @@ -89,9 +89,10 @@ void *recv_func(void *cfd) { } printf("ret = %d\n", ret); close( *(int*)cfd ); + return NULL; } -int sctp_cu_init() { +int sctp_cu_init(void) { pthread_t threads; printf("S - Waiting for socket_accept\n"); @@ -124,4 +125,4 @@ int sctp_cu_init() { printf("S - close\n"); return 0; -} \ No newline at end of file +} diff --git a/openair2/F1AP/sctp_cu.h b/openair2/F1AP/sctp_cu.h new file mode 100644 index 0000000000..68db2864d5 --- /dev/null +++ b/openair2/F1AP/sctp_cu.h @@ -0,0 +1,40 @@ +/* + * 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 sctp_cu.h + * \brief sctp server procedures for F1AP + * \author Robert Schmidt + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: robert.schmidt@eurecom.fr + * \note + * \warning + */ + +#ifndef SCTP_CU_H_ +#define SCTP_CU_H_ + +//void send_func(int cfd); +//void *recv_func(void *cfd); +int sctp_cu_init(void); + +#endif /* SCTP_CU_H_ */ diff --git a/openair2/F1AP/sctp_du.h b/openair2/F1AP/sctp_du.h new file mode 100644 index 0000000000..b8f2dc0635 --- /dev/null +++ b/openair2/F1AP/sctp_du.h @@ -0,0 +1,42 @@ +/* + * 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 sctp_du.h + * \brief sctp server procedures for F1AP + * \author Robert Schmidt + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: robert.schmidt@eurecom.fr + * \note + * \warning + */ + +#ifndef SCTP_DU_H_ +#define SCTP_DU_H_ + +//void f1ap_du_send_message(uint8_t *buffer_send, uint32_t length); +//void *send_func(void *argument); +//void *recv_func(void *argument); +int sctp_du_init(void); + + +#endif /* SCTP_DU_H_ */ -- GitLab From 9e5f9bdb945c93664cdce8024bd6653f375282b0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 6 Sep 2018 10:05:45 +0200 Subject: [PATCH 030/308] Suppress warning "implicitly truncated to unsigned type" --- openair3/UTILS/conversions.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index 46328b4fc6..3100861bf2 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -286,10 +286,10 @@ do { \ #define NR_CELL_ID_TO_BIT_STRING(mACRO, bITsTRING) \ do { \ (bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \ - (bITsTRING)->buf[0] = (mACRO) >> 28; \ - (bITsTRING)->buf[1] = (mACRO) >> 20; \ - (bITsTRING)->buf[2] = (mACRO) >> 12; \ - (bITsTRING)->buf[3] = (mACRO) >> 4; \ + (bITsTRING)->buf[0] = ((mACRO) >> 28) & 0xff; \ + (bITsTRING)->buf[1] = ((mACRO) >> 20) & 0xff; \ + (bITsTRING)->buf[2] = ((mACRO) >> 12) & 0xff; \ + (bITsTRING)->buf[3] = ((mACRO) >> 4) & 0xff; \ (bITsTRING)->buf[4] = ((mACRO) & 0x0f) << 4; \ (bITsTRING)->size = 5; \ (bITsTRING)->bits_unused = 4; \ -- GitLab From f19fa8ad47c1973d229f74aa2eae8283d1b7fe3d Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Thu, 6 Sep 2018 11:56:15 +0200 Subject: [PATCH 031/308] Create ITTI procedure for F1 --- openair2/COMMON/f1ap_messages_types.h | 2 + openair2/COMMON/tasks_def.h | 2 + openair2/ENB_APP/enb_app.c | 2 +- openair2/F1AP/CU_F1AP.c | 74 +++++++++++++--------- openair2/F1AP/DU_F1AP.c | 88 +++++++++++++++++++++------ openair2/RRC/LTE/rrc_eNB.c | 2 + openair3/COMMON/messages_types.h | 1 + 7 files changed, 123 insertions(+), 48 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 3305ffd256..e2f01d8954 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -25,6 +25,8 @@ //-------------------------------------------------------------------------------------------// // Defines to access message fields. +#define F1AP_CU_SCTP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_cu_sctp_req + #define F1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_req #define F1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_resp #define F1AP_SETUP_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_failure diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index 719ef6e1c0..ad38c9b031 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -53,6 +53,8 @@ TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000) // GTP_V1U task TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000) TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) +TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200) +TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200) /// X2ap task, acts as both source and target TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200) /// Sctp task (Used by both S1AP and X2AP) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index d4c3346ed2..cab95a5328 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -130,7 +130,7 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); AssertFatal(1==0,"No ITTI ask for F1AP yet\n"); - // itti_send_msg_to_task (TASK_F1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + itti_send_msg_to_task (TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); // configure GTPu here for F1U } else { // S1AP registration diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 72cc663731..641581c6af 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -32,12 +32,12 @@ #include "conversions.h" #include "f1ap_common.h" -#include "f1ap_messages_types.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" #include "sctp_cu.h" #include "platform_types.h" -#include "log.h" +#include "common/utils/LOG/log.h" +#include "intertask_interface.h" #define MAX_F1AP_BUFFER_SIZE 4096 @@ -86,46 +86,60 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ } // ============================================================================== +static +void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) +{ + int result; + + DevAssert(sctp_data_ind != NULL); + + f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, + sctp_data_ind->buffer, sctp_data_ind->buffer_length); -void F1AP_CU_task(void) { + result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); +} + +void *F1AP_CU_task(void *arg) { printf("Start F1AP CU task!\n"); - sctp_cu_init(); + //sctp_cu_init(); + + MessageDef *received_msg = NULL; + int result; - // MessageDef *received_msg = NULL; - // int result; + //F1AP_DEBUG("Starting F1AP at DU\n"); - // F1AP_DEBUG("Starting F1AP layer\n"); + //f1ap_eNB_prepare_internal_data(); - // f1ap_eNB_prepare_internal_data(); + itti_mark_task_ready(TASK_CU_F1); - // itti_mark_task_ready(TASK_F1AP); + while (1) { + switch (ITTI_MSG_ID(received_msg)) { - // while (1) { - // switch (ITTI_MSG_ID(received_msg)) { - // case F1AP_SETUP_RESP: - // CU_send_F1_SETUP_RESPONSE(); - // break; - // case F1AP_INITIAL_UL_RRC_MESSAGE: - // CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(); - // break; - // case F1AP_DL_RRC_MESSAGE: - // CU_send_DL_RRC_MESSAGE_TRANSFER(); // SRBID and RRCContainer get issue when decode. - // break; - // //CU_send_UE_CONTEXT_SETUP_REQUEST(); - // case F1AP_UE_CONTEXT_MODIFICATION_REQ: - // CU_send_UE_CONTEXT_MODIFICATION_REQUEST(); - // break; - // //CU_send_gNB_CU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); // some problem found - // break; + //case F1AP_CU_SCTP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app + // 1. save the itti msg so that you can use it to sen f1ap_setup_req + // 2. send a sctp_init req + // CU_send_sctp_init_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // &F1AP_SETUP_REQ(received_msg)); + // break; - // default: + case SCTP_DATA_IND: + CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + break; - // } // switch + default: + // F1AP_ERROR("CU Received unhandled message: %d:%s\n", + // ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + break; + } // switch + result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - // } // while + received_msg = NULL; + } // while - return; + return NULL; } diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index d04312251d..5653d15608 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -32,10 +32,10 @@ #include "conversions.h" #include "f1ap_common.h" -#include "f1ap_messages_types.h" #include "platform_types.h" #include "common/utils/LOG/log.h" #include "sctp_du.h" +#include "intertask_interface.h" /* This structure describes association of a DU to a CU */ @@ -76,6 +76,9 @@ typedef struct f1ap_info { #define F1AP_UE_IDENTIFIER_NUMBER 3 #define NUMBER_OF_eNB_MAX 3 +void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); + + uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t du_mod_idP) { static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; transaction_identifier[enb_mod_idP+du_mod_idP] = (transaction_identifier[enb_mod_idP+du_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; @@ -91,36 +94,87 @@ uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { } // ============================================================================== +static +void DU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) +{ + int result; + + DevAssert(sctp_data_ind != NULL); + + f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, + sctp_data_ind->buffer, sctp_data_ind->buffer_length); -void F1AP_DU_task(void) { + result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); +} + +void *F1AP_DU_task(void *arg) { printf("Start F1AP DU task!\n"); - sctp_du_init(); + //sctp_cu_init(); + + MessageDef *received_msg = NULL; + int result; + + //F1AP_DEBUG("Starting F1AP at DU\n"); - // while (1) { + //f1ap_eNB_prepare_internal_data(); - // switch () { + itti_mark_task_ready(TASK_DU_F1); - // case F1AP_ProcedureCode_id_F1Setup: - DU_send_F1_SETUP_REQUEST((module_id_t)1, (module_id_t)2); - // break; - //DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(); - //DU_send_UL_RRC_MESSAGE_TRANSFER(); // OK - //DU_send_UE_CONTEXT_SETUP_RESPONSE(); // OK - //DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(); // OK - //DU_send_gNB_DU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); - // default: + while (1) { + switch (ITTI_MSG_ID(received_msg)) { - // } // switch + // case TERMINATE_MESSAGE: + // //F1AP_WARN(" *** Exiting F1AP DU thread\n"); + // itti_exit_task(); + // break; - // } // while + //case F1AP_SETUP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app + // 1. save the itti msg so that you can use it to sen f1ap_setup_req + // 2. send a sctp_association req + // DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // &F1AP_SETUP_REQ(received_msg)); + // break; - return; + case SCTP_NEW_ASSOCIATION_RESP: + // 1. store the respon + // 2. send the f1setup_req + DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_resp); + break; + + case SCTP_DATA_IND: + DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + break; + + default: + // F1AP_ERROR("DU Received unhandled message: %d:%s\n", + // ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + break; + } // switch + 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; + } // while + + return NULL; } // ============================================================================== +void DU_send_sctp_association_req(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) +{ + // + AssertFatal(0,"Not implemented yet\n"); +} +void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) +{ + // + AssertFatal(0,"Not implemented yet\n"); +} // ============================================================================== diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 4fd543ae43..124e573d95 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6084,6 +6084,8 @@ openair_rrc_eNB_init( openair_rrc_on(&ctxt); if (RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) + // msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SCTP_REQ); + // RCconfig_CU_F1(msg_p, enb_id); setup_ngran_CU(RC.rrc[ctxt.module_id]); return 0; diff --git a/openair3/COMMON/messages_types.h b/openair3/COMMON/messages_types.h index 47d9d32f2b..56a16da554 100644 --- a/openair3/COMMON/messages_types.h +++ b/openair3/COMMON/messages_types.h @@ -31,6 +31,7 @@ #include "ip_forward_messages_types.h" #include "s11_messages_types.h" #include "s1ap_messages_types.h" +#include "f1ap_messages_types.h" #include "nas_messages_types.h" #include "s6a_messages_types.h" #include "sctp_messages_types.h" -- GitLab From 87093e1b553ed2aebccb1c773507201497f8c2ad Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 6 Sep 2018 18:11:24 +0200 Subject: [PATCH 032/308] Restructure create_tasks(): start tasks depending on RAN type, is read in RCconfig_RRC() --- cmake_targets/CMakeLists.txt | 3 - openair2/ENB_APP/enb_app.c | 136 ++++++++++++++++-------------- targets/COMMON/create_tasks.c | 103 ---------------------- targets/COMMON/create_tasks.h | 33 -------- targets/COMMON/create_tasks_ue.c | 3 +- targets/RT/USER/lte-softmodem.c | 16 ++-- targets/RT/USER/lte-softmodem.h | 2 + targets/RT/USER/lte-uesoftmodem.c | 1 - 8 files changed, 84 insertions(+), 213 deletions(-) delete mode 100644 targets/COMMON/create_tasks.c delete mode 100644 targets/COMMON/create_tasks.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 43ce9315f6..bb70757e3e 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2082,7 +2082,6 @@ add_executable(lte-softmodem ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c @@ -2123,7 +2122,6 @@ add_executable(lte-softmodem-nos1 ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c @@ -2163,7 +2161,6 @@ add_executable(lte-uesoftmodem ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/rfsim.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index cab95a5328..c0dd24912e 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -41,9 +41,12 @@ # include "intertask_interface.h" # include "timer.h" # if defined(ENABLE_USE_MME) +# define ENB_REGISTER_RETRY_DELAY 10 # include "s1ap_eNB.h" # include "sctp_eNB_task.h" # include "gtpv1u_eNB_task.h" +# include "nas_ue_task.h" +# include "udp_eNB_task.h" # endif #if defined(FLEXRAN_AGENT_SB_IF) @@ -54,61 +57,66 @@ extern unsigned char NB_eNB_INST; #endif +extern int emulate_rf; extern RAN_CONTEXT_t RC; +extern void *l2l1_task(void *arg); #if defined(ENABLE_ITTI) -#include "LAYER2/PROTO_AGENT/proto_agent.h" -//#include "../PROTO_AGENT/proto_agent.h" - - -/*------------------------------------------------------------------------------*/ -# if defined(ENABLE_USE_MME) -# define ENB_REGISTER_RETRY_DELAY 10 -# endif - /*------------------------------------------------------------------------------*/ - -/* -static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_properties) +static void create_remaining_tasks(module_id_t enb_id) { - MessageDef *msg_p; - int CC_id; - - msg_p = itti_alloc_new_message (TASK_ENB_APP, PHY_CONFIGURATION_REQ); - - for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - PHY_CONFIGURATION_REQ (msg_p).frame_type[CC_id] = enb_properties->properties[enb_id]->frame_type[CC_id]; - PHY_CONFIGURATION_REQ (msg_p).prefix_type[CC_id] = enb_properties->properties[enb_id]->prefix_type[CC_id]; - PHY_CONFIGURATION_REQ (msg_p).downlink_frequency[CC_id] = enb_properties->properties[enb_id]->downlink_frequency[CC_id]; - PHY_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[CC_id] = enb_properties->properties[enb_id]->uplink_frequency_offset[CC_id]; - PHY_CONFIGURATION_REQ (msg_p).nb_antennas_tx[CC_id] = enb_properties->properties[enb_id]->nb_antennas_tx[CC_id]; - PHY_CONFIGURATION_REQ (msg_p).nb_antennas_rx[CC_id] = enb_properties->properties[enb_id]->nb_antennas_rx[CC_id]; - PHY_CONFIGURATION_REQ (msg_p).tx_gain[CC_id] = enb_properties->properties[enb_id]->tx_gain[CC_id]; - PHY_CONFIGURATION_REQ (msg_p).rx_gain[CC_id] = enb_properties->properties[enb_id]->rx_gain[CC_id]; + ngran_node_t type = RC.rrc[enb_id]->node_type; + int rc; + itti_wait_ready(1); + switch (type) { + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: + case ngran_eNB_CU: + case ngran_ng_eNB_CU: + case ngran_gNB_CU: + rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for SCTP failed\n"); + rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for S1AP failed\n"); + if (!emulate_rf){ + rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for UDP failed\n"); + } + rc = itti_create_task(TASK_GTPV1_U, >pv1u_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); + break; + default: + /* intentionally left blank */ + break; } - - itti_send_msg_to_task (TASK_PHY_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + switch (type) { + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: + case ngran_eNB_DU: + case ngran_gNB_DU: + rc = itti_create_task (TASK_L2L1, l2l1_task, NULL); + AssertFatal(rc >= 0, "Create task for L2L1 failed\n"); + break; + default: + /* intentioally left blank */ + break; + } + itti_wait_ready(0); } -*/ /*------------------------------------------------------------------------------*/ -static void configure_rrc(uint32_t enb_id) +static void configure_rrc(uint32_t enb_id, MessageDef **msg_p) { - MessageDef *msg_p = NULL; - // int CC_id; - - msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); - - if (RC.rrc[enb_id]) { - RCconfig_RRC(msg_p,enb_id, RC.rrc[enb_id]); - - - LOG_I(ENB_APP,"Sending configuration message to RRC task\n"); - itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); - - } - else AssertFatal(0,"RRC context for eNB %d not allocated\n",enb_id); + RC.rrc[enb_id] = malloc(sizeof(eNB_RRC_INST)); + AssertFatal(RC.rrc[enb_id], "RRC context for eNB %d not allocated\n", enb_id); + LOG_I(ENB_APP, "%s() Creating RRC instance RC.rrc[%d]: %p\n", + __FUNCTION__, enb_id, RC.rrc[enb_id]); + memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); + *msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); + RCconfig_RRC(*msg_p, enb_id, RC.rrc[enb_id]); } /*------------------------------------------------------------------------------*/ @@ -175,49 +183,49 @@ void *eNB_app_task(void *args_p) MessageDef *msg_p = NULL; instance_t instance; int result; + MessageDef *rrc_msg_p[enb_nb]; /* for no gcc warnings */ (void)instance; int mac_has_f1[MAX_MAC_INST]; - memset(mac_has_f1,0,MAX_MAC_INST*sizeof(int)); itti_mark_task_ready (TASK_ENB_APP); - - LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__); + LOG_I(PHY, "%s() Task ready, initialise L1/MAC/RRC structures\n", __FUNCTION__); RCconfig_L1(); RCconfig_macrlc(mac_has_f1); - LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_macrlc_inst); - LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst); - if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n"); - + LOG_I(PHY, "%s() RC.nb_macrlc_inst:%d\n", __FUNCTION__, RC.nb_macrlc_inst); - AssertFatal (enb_nb <= RC.nb_inst, - "Number of eNB is greater than eNB defined in configuration file (%d/%d)!", - enb_nb, RC.nb_inst); + if (RC.nb_L1_inst>0) + AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n"); + if (RC.nb_macrlc_inst>0) + AssertFatal(RC.nb_macrlc_inst == enb_id_end-enb_id_start, + "Number of MACRLC instances %d != number of RRC instances %d\n", + RC.nb_macrlc_inst, enb_id_end-enb_id_start); LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst); - RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *)); LOG_I(ENB_APP, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc); - if (RC.nb_macrlc_inst>0) AssertFatal(RC.nb_macrlc_inst == enb_id_end-enb_id_start, - "Number of MACRLC instances %d != number of RRC instances %d\n", - RC.nb_macrlc_inst,enb_id_end-enb_id_start); for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { - RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST)); - LOG_I(ENB_APP, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end); - memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); - configure_rrc(enb_id); + configure_rrc(enb_id, &rrc_msg_p[enb_id]); - if (RC.nb_macrlc_inst >0 && mac_has_f1[enb_id]==1) RC.rrc[enb_id]->node_type = ngran_eNB_DU; - else pdcp_layer_init(); + if (RC.nb_macrlc_inst > 0 && mac_has_f1[enb_id]==1) + RC.rrc[enb_id]->node_type = ngran_eNB_DU; + else + pdcp_layer_init(); } + create_remaining_tasks(0); + + for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { + LOG_I(ENB_APP,"Sending configuration message to RRC task\n"); + itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), rrc_msg_p[enb_id]); + } # if defined(ENABLE_USE_MME) /* Try to register each eNB */ diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c deleted file mode 100644 index 391e448deb..0000000000 --- a/targets/COMMON/create_tasks.c +++ /dev/null @@ -1,103 +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 - */ - -#if defined(ENABLE_ITTI) -# include "intertask_interface.h" -# include "create_tasks.h" -# include "log.h" - -# ifdef OPENAIR2 -# if defined(ENABLE_USE_MME) -# include "sctp_eNB_task.h" -# include "s1ap_eNB.h" -# include "nas_ue_task.h" -# include "udp_eNB_task.h" -# include "gtpv1u_eNB_task.h" -# endif -# if ENABLE_RAL -# include "lteRALue.h" -# include "lteRALenb.h" -# endif -# include "RRC/LTE/rrc_defs.h" -# endif -# include "enb_app.h" - -extern int emulate_rf; - -int create_tasks(uint32_t enb_nb) -{ - LOG_D(ENB_APP, "%s(enb_nb:%d\n", __FUNCTION__, enb_nb); - - itti_wait_ready(1); - if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) { - LOG_E(PDCP, "Create task for L2L1 failed\n"); - return -1; - } - - if (enb_nb > 0) { - /* Last task to create, others task must be ready before its start */ - if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) { - LOG_E(ENB_APP, "Create task for eNB APP failed\n"); - return -1; - } - } - -# if defined(ENABLE_USE_MME) - if (enb_nb > 0) { - if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { - LOG_E(SCTP, "Create task for SCTP failed\n"); - return -1; - } - - if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) { - LOG_E(S1AP, "Create task for S1AP failed\n"); - return -1; - } - if(!emulate_rf){ - if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { - LOG_E(UDP_, "Create task for UDP failed\n"); - return -1; - } - } - - if (itti_create_task (TASK_GTPV1_U, >pv1u_eNB_task, NULL) < 0) { - LOG_E(GTPU, "Create task for GTPV1U failed\n"); - return -1; - } - } - -# endif - - if (enb_nb > 0) { - LOG_I(RRC,"Creating RRC eNB Task\n"); - - if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { - LOG_E(RRC, "Create task for RRC eNB failed\n"); - return -1; - } - } - - - itti_wait_ready(0); - - return 0; -} -#endif diff --git a/targets/COMMON/create_tasks.h b/targets/COMMON/create_tasks.h deleted file mode 100644 index ff1d9ace51..0000000000 --- a/targets/COMMON/create_tasks.h +++ /dev/null @@ -1,33 +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 - */ - -#ifndef CREATE_TASKS_H_ -#define CREATE_TASKS_H_ - -#if defined(ENABLE_ITTI) -/* External declaration of L2L1 task that depend on the target */ -extern void *l2l1_task(void *arg); - -int create_tasks(uint32_t enb_nb); -int create_tasks_ue(uint32_t ue_nb); -#endif - -#endif /* CREATE_TASKS_H_ */ diff --git a/targets/COMMON/create_tasks_ue.c b/targets/COMMON/create_tasks_ue.c index 7e7d545c9f..6cf5ce78e8 100644 --- a/targets/COMMON/create_tasks_ue.c +++ b/targets/COMMON/create_tasks_ue.c @@ -21,7 +21,6 @@ #if defined(ENABLE_ITTI) # include "intertask_interface.h" -# include "create_tasks.h" # include "log.h" # ifdef OPENAIR2 @@ -77,4 +76,4 @@ int create_tasks_ue(uint32_t ue_nb) return 0; } -#endif \ No newline at end of file +#endif diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 3c4c2b7125..d2022540c1 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -84,7 +84,6 @@ unsigned short config_frames[4] = {2,9,11,13}; #if defined(ENABLE_ITTI) #include "intertask_interface_init.h" -#include "create_tasks.h" #endif #include "PHY/INIT/phy_init.h" @@ -1064,13 +1063,16 @@ int main( int argc, char **argv ) int have_rrc=0; if (RC.nb_inst > 0) { - - // don't create if node doesn't connect to RRC/S1/F1/GTP - if (create_tasks(1) < 0) { - printf("cannot create ITTI tasks\n"); - exit(-1); // need a softer mode + LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n"); + if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) { + LOG_E(ENB_APP, "Create task for eNB APP failed\n"); + return -1; + } + LOG_I(RRC,"Creating RRC eNB Task\n"); + if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { + LOG_E(RRC, "Create task for RRC eNB failed\n"); + return -1; } - printf("ITTI tasks created\n"); have_rrc=1; } else { diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 2f8209f2d3..7f0288ea91 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -289,4 +289,6 @@ extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag); +extern void *eNB_app_task(void* args); + #endif diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index a2a12f9dd9..e9456f9700 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -85,7 +85,6 @@ #if defined(ENABLE_ITTI) #include "intertask_interface_init.h" -#include "create_tasks.h" #endif #include "system.h" -- GitLab From d0de98e067c23eaa4afda774d000a5be5f760810 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Thu, 6 Sep 2018 19:13:09 +0200 Subject: [PATCH 033/308] Create SCTP request and response with ITTI procedure for F1 --- openair2/COMMON/f1ap_messages_def.h | 3 + openair2/COMMON/f1ap_messages_types.h | 7 ++ openair2/ENB_APP/enb_app.c | 6 +- openair2/F1AP/CU_F1AP.c | 42 +++++++++-- openair2/F1AP/DU_F1AP.c | 105 ++++++++++++++++++++------ openair2/F1AP/cu_f1ap_defs.h | 63 ++++++++++++++++ openair2/F1AP/du_f1ap_defs.h | 63 ++++++++++++++++ 7 files changed, 256 insertions(+), 33 deletions(-) create mode 100644 openair2/F1AP/cu_f1ap_defs.h create mode 100644 openair2/F1AP/du_f1ap_defs.h diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 67a803face..149bf1ece0 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -19,6 +19,9 @@ * contact@openairinterface.org */ +/* F1AP -> SCTP */ +MESSAGE_DEF(F1AP_CU_SCTP_REQ , MESSAGE_PRIORITY_MED, f1ap_cu_setup_req_t , f1ap_cu_setup_req) + /* eNB application layer -> F1AP messages */ MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index e2f01d8954..48870ee478 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -51,6 +51,10 @@ // Note this should be 512 from maxval in 38.473 #define F1AP_MAX_NB_CELLS 2 +typedef struct f1ap_cu_setup_req_s { + // +} f1ap_cu_setup_req_t; + typedef struct f1ap_setup_req_s { // Midhaul networking parameters @@ -67,6 +71,9 @@ typedef struct f1ap_setup_req_s { uint32_t gNB_DU_id; char *gNB_DU_name; + /* The type of the cell */ + enum cell_type_e cell_type; + /// number of DU cells available uint16_t num_cells_available; //0< num_cells_to_available <= 512; diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index cab95a5328..9e61e971c1 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -128,8 +128,7 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); RCconfig_DU_F1(msg_p, enb_id); - LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); - AssertFatal(1==0,"No ITTI ask for F1AP yet\n"); + LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); itti_send_msg_to_task (TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); // configure GTPu here for F1U } @@ -213,12 +212,11 @@ void *eNB_app_task(void *args_p) LOG_I(ENB_APP, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end); memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); configure_rrc(enb_id); - + if (RC.nb_macrlc_inst >0 && mac_has_f1[enb_id]==1) RC.rrc[enb_id]->node_type = ngran_eNB_DU; else pdcp_layer_init(); } - # if defined(ENABLE_USE_MME) /* Try to register each eNB */ registered_enb = 0; diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 641581c6af..7551164caa 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -32,6 +32,7 @@ #include "conversions.h" #include "f1ap_common.h" +#include "cu_f1ap_defs.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" #include "sctp_cu.h" @@ -39,8 +40,13 @@ #include "common/utils/LOG/log.h" #include "intertask_interface.h" +#include "T.h" + #define MAX_F1AP_BUFFER_SIZE 4096 +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + /* This structure describes association of a DU to a CU */ typedef struct f1ap_info { @@ -87,8 +93,7 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ // ============================================================================== static -void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) -{ +void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { int result; DevAssert(sctp_data_ind != NULL); @@ -100,6 +105,30 @@ void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } +void CU_send_sctp_init_req(instance_t enb_id) { + // 1. get the itti msg, and retrive the enb_id from the message + // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port + // 3. creat an itti message to init + + MessageDef *message_p = NULL; + + message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); + message_p->ittiMsg.sctp_init.port = RC.rrc[enb_id]->eth_params_s.my_portc; + message_p->ittiMsg.sctp_init.ppid = F1AP_SCTP_PPID; + message_p->ittiMsg.sctp_init.ipv4 = 1; + message_p->ittiMsg.sctp_init.ipv6 = 0; + message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; + message_p->ittiMsg.sctp_init.ipv4_address[0] = RC.rrc[enb_id]->eth_params_s.my_addr; + /* + * SR WARNING: ipv6 multi-homing fails sometimes for localhost. + * * * * Disable it for now. + */ + message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0; + message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1"; + + itti_send_msg_to_task(TASK_SCTP, enb_id, message_p); +} + void *F1AP_CU_task(void *arg) { printf("Start F1AP CU task!\n"); @@ -117,12 +146,9 @@ void *F1AP_CU_task(void *arg) { while (1) { switch (ITTI_MSG_ID(received_msg)) { - //case F1AP_CU_SCTP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app - // 1. save the itti msg so that you can use it to sen f1ap_setup_req - // 2. send a sctp_init req - // CU_send_sctp_init_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), - // &F1AP_SETUP_REQ(received_msg)); - // break; + case F1AP_CU_SCTP_REQ: + CU_send_sctp_init_req(ITTI_MESSAGE_GET_INSTANCE(received_msg)); + break; case SCTP_DATA_IND: CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 5653d15608..8dc1f10198 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -32,17 +32,24 @@ #include "conversions.h" #include "f1ap_common.h" +#include "du_f1ap_defs.h" #include "platform_types.h" #include "common/utils/LOG/log.h" #include "sctp_du.h" #include "intertask_interface.h" +#include "T.h" + +// helper functions +#define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 +#define F1AP_UE_IDENTIFIER_NUMBER 3 +#define NUMBER_OF_eNB_MAX 3 /* This structure describes association of a DU to a CU */ typedef struct f1ap_info { module_id_t enb_mod_idP; - module_id_t du_mod_idP; + module_id_t cu_mod_idP; /* 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. @@ -71,11 +78,6 @@ typedef struct f1ap_info { } f1ap_info_t; -// helper functions -#define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 -#define F1AP_UE_IDENTIFIER_NUMBER 3 -#define NUMBER_OF_eNB_MAX 3 - void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); @@ -122,6 +124,7 @@ void *F1AP_DU_task(void *arg) { itti_mark_task_ready(TASK_DU_F1); + // SCTP while (1) { switch (ITTI_MSG_ID(received_msg)) { @@ -130,12 +133,13 @@ void *F1AP_DU_task(void *arg) { // itti_exit_task(); // break; - //case F1AP_SETUP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app - // 1. save the itti msg so that you can use it to sen f1ap_setup_req + case F1AP_SETUP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app + // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, + // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req - // DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), - // &F1AP_SETUP_REQ(received_msg)); - // break; + DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_SETUP_REQ(received_msg)); + break; case SCTP_NEW_ASSOCIATION_RESP: // 1. store the respon @@ -145,6 +149,7 @@ void *F1AP_DU_task(void *arg) { break; case SCTP_DATA_IND: + // ex: any F1 incoming message for DU ends here DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; @@ -164,16 +169,73 @@ void *F1AP_DU_task(void *arg) { // ============================================================================== -void DU_send_sctp_association_req(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) +static void du_f1ap_register(du_f1ap_instance_t *instance_p, + char *cu_ip_address, + int cu_port, + uint16_t in_streams, + uint16_t out_streams) { - // - AssertFatal(0,"Not implemented yet\n"); + + MessageDef *message_p = NULL; + sctp_new_association_req_t *sctp_new_association_req_p = NULL; + + message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); + + sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; + + sctp_new_association_req_p->port = cu_port; + sctp_new_association_req_p->ppid = F1AP_SCTP_PPID; + + sctp_new_association_req_p->in_streams = in_streams; + sctp_new_association_req_p->out_streams = out_streams; + + itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); } -void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) -{ - // - AssertFatal(0,"Not implemented yet\n"); +void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { + du_f1ap_instance_t *new_instance; + //uint8_t index; + + DevAssert(f1ap_setup_req != NULL); + + /* Look if the provided instance already exists */ + //new_instance = s1ap_eNB_get_instance(instance); + + // @Todo + // if (new_instance != NULL) { + // /* Checks if it is a retry on the same eNB */ + // DevCheck(new_instance->gNB_DU_id == f1ap_setup_req->gNB_DU_id, new_instance->gNB_DU_id, f1ap_setup_req->gNB_DU_id, 0); + // DevCheck(new_instance->cell_type == f1ap_setup_req->cell_type, new_instance->cell_type, f1ap_setup_req->cell_type, 0); + // DevCheck(new_instance->tac == f1ap_setup_req->tac, new_instance->tac, f1ap_setup_req->tac, 0); + // DevCheck(new_instance->mcc == f1ap_setup_req->mcc, new_instance->mcc, f1ap_setup_req->mcc, 0); + // DevCheck(new_instance->mnc == f1ap_setup_req->mnc, new_instance->mnc, f1ap_setup_req->mnc, 0); + // DevCheck(new_instance->mnc_digit_length == f1ap_setup_req->mnc_digit_length, new_instance->mnc_digit_length, f1ap_setup_req->mnc_digit_length, 0); + // DevCheck(new_instance->default_drx == f1ap_setup_req->default_drx, new_instance->default_drx, f1ap_setup_req->default_drx, 0); + // } else { + new_instance = calloc(1, sizeof(du_f1ap_instance_t)); + DevAssert(new_instance != NULL); + + /* Copy usefull parameters */ + new_instance->instance = instance; + new_instance->gNB_DU_id = f1ap_setup_req->gNB_DU_id; + new_instance->gNB_DU_name = f1ap_setup_req->gNB_DU_name; + new_instance->tac = f1ap_setup_req->tac[0]; + new_instance->mcc = f1ap_setup_req->mcc[0]; + new_instance->mnc = f1ap_setup_req->mnc[0]; + new_instance->mnc_digit_length = f1ap_setup_req->mnc_digit_length; + + //} + + du_f1ap_register(new_instance, + &f1ap_setup_req->CU_ipv4_address, + &f1ap_setup_req->CU_port, + f1ap_setup_req->sctp_in_streams, + f1ap_setup_req->sctp_out_streams); + +} + +void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { + DU_send_F1_SETUP_REQUEST(instance, sctp_new_association_resp); } @@ -181,7 +243,7 @@ void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_r // SETUP REQUEST -void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP) { +void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP, f1ap_setup_req_t *msg_p) { //void DU_send_F1_SETUP_REQUEST(F1SetupRequest_t *F1SetupRequest) { F1AP_F1AP_PDU_t pdu; F1AP_F1SetupRequest_t *out; @@ -590,8 +652,9 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { // SETUP SUCCESSFUL -void DU_handle_F1_SETUP_RESPONSE(struct F1AP_F1AP_PDU_t *pdu_p) { - +void DU_handle_F1_SETUP_RESPONSE() { + + AssertFatal(0,"Not implemented yet\n"); /* decode */ //DU_F1AP_decode(args_p); diff --git a/openair2/F1AP/cu_f1ap_defs.h b/openair2/F1AP/cu_f1ap_defs.h new file mode 100644 index 0000000000..0f8a1e8353 --- /dev/null +++ b/openair2/F1AP/cu_f1ap_defs.h @@ -0,0 +1,63 @@ +/* + * 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 + */ + +#include <stdint.h> + +#include "queue.h" +#include "tree.h" + +#include "sctp_eNB_defs.h" + +#ifndef CU_F1AP_DEFS_H_ +#define CU_F1AP_DEFS_H_ + +struct cu_f1ap_instance_s; +typedef struct du_f1ap_instance_s { + /* Next f1ap du association. + * Only used for virtual mode. + */ + + /* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */ + instance_t instance; + + // F1_Setup_Req payload + uint32_t gNB_CU_id; + char *gNB_CU_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; + + /* Tracking area code */ + uint16_t tac; + + /* Mobile Country Code + * Mobile Network Code + */ + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + +} cu_f1ap_instance_t; + +#endif /* CU_F1AP_DEFS_H_ */ diff --git a/openair2/F1AP/du_f1ap_defs.h b/openair2/F1AP/du_f1ap_defs.h new file mode 100644 index 0000000000..a93591106f --- /dev/null +++ b/openair2/F1AP/du_f1ap_defs.h @@ -0,0 +1,63 @@ +/* + * 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 + */ + +#include <stdint.h> + +#include "queue.h" +#include "tree.h" + +#include "sctp_eNB_defs.h" + +#ifndef DU_F1AP_DEFS_H_ +#define DU_F1AP_DEFS_H_ + +struct du_f1ap_instance_s; +typedef struct du_f1ap_instance_s { + /* Next f1ap du association. + * Only used for virtual mode. + */ + + /* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */ + instance_t instance; + + // F1_Setup_Req payload + uint32_t gNB_DU_id; + char *gNB_DU_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; + + /* Tracking area code */ + uint16_t tac; + + /* Mobile Country Code + * Mobile Network Code + */ + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + +} du_f1ap_instance_t; + +#endif /* DU_F1AP_DEFS_H_ */ -- GitLab From b6295efd2a7032c5bec3f6a2862873d27ffb6fc7 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 7 Sep 2018 11:53:33 +0200 Subject: [PATCH 034/308] modify the ip address struct in f1 setup req for DU --- openair2/COMMON/f1ap_messages_types.h | 11 +- openair2/ENB_APP/enb_app.c | 42 +++---- openair2/ENB_APP/enb_config.c | 175 ++++++++++++++------------ openair2/F1AP/CU_F1AP.c | 2 +- openair2/F1AP/DU_F1AP.c | 29 +++-- openair2/F1AP/f1ap_common.h | 86 ------------- openair2/F1AP/f1ap_default_values.h | 2 +- 7 files changed, 143 insertions(+), 204 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 48870ee478..6fa58425fd 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -51,6 +51,13 @@ // Note this should be 512 from maxval in 38.473 #define F1AP_MAX_NB_CELLS 2 +typedef struct f1ap_net_ip_address_s { + unsigned ipv4:1; + unsigned ipv6:1; + char ipv4_address[16]; + char ipv6_address[46]; +} f1ap_net_ip_address_t; + typedef struct f1ap_cu_setup_req_s { // } f1ap_cu_setup_req_t; @@ -60,8 +67,8 @@ typedef struct f1ap_setup_req_s { // Midhaul networking parameters /* The eNB IP address to bind */ - char CU_ipv4_address[16]; - int CU_port; + f1ap_net_ip_address_t CU_f1_ip_address; + f1ap_net_ip_address_t DU_f1_ip_address; /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 45f7df8cfa..385b7fae5a 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -130,34 +130,30 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { { if (node_type == ngran_eNB_DU) { // F1AP registration - - // configure F1AP here for F1C - LOG_I(ENB_APP,"ngran_eNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); - msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); - RCconfig_DU_F1(msg_p, enb_id); - - LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); - itti_send_msg_to_task (TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); - // configure GTPu here for F1U + // configure F1AP here for F1C + LOG_I(ENB_APP,"ngran_eNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); + msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); + RCconfig_DU_F1(msg_p, enb_id); + + LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); + itti_send_msg_to_task (TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + // configure GTPu here for F1U } else { // S1AP registration - /* note: there is an implicit relationship between the data structure and the message name */ - msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); - - RCconfig_S1(msg_p, enb_id); - - if (enb_id == 0) RCconfig_gtpu(); - - LOG_I(ENB_APP,"default drx %d\n",((S1AP_REGISTER_ENB_REQ(msg_p)).default_drx)); - - LOG_I(ENB_APP,"[eNB %d] eNB_app_register via S1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); - itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); - } + /* note: there is an implicit relationship between the data structure and the message name */ + msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); + RCconfig_S1(msg_p, enb_id); + + if (enb_id == 0) RCconfig_gtpu(); + + LOG_I(ENB_APP,"default drx %d\n",((S1AP_REGISTER_ENB_REQ(msg_p)).default_drx)); + + LOG_I(ENB_APP,"[eNB %d] eNB_app_register via S1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); + itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + } - register_enb_pending++; - } } diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 51a3ca6cd7..9a3a1232c1 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2375,104 +2375,115 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { // Output a list of all eNBs. config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL); AssertFatal(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr != NULL, - "eNB id %d is not defined in configuration file\n",i); + "eNB id %d is not defined in configuration file\n",i); for (k=0; k <num_enbs ; k++) { if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) { - paramdef_t SCTPParams[] = SCTPPARAMS_DESC; - paramdef_t NETParams[] = NETPARAMS_DESC; - char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + paramdef_t SCTPParams[] = SCTPPARAMS_DESC; + paramdef_t NETParams[] = NETPARAMS_DESC; + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); - LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); + LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); - F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr)); - LOG_I(ENB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name); + F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name); - F1AP_SETUP_REQ (msg_p).tac[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr)); - LOG_I(ENB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).tac[k]); + F1AP_SETUP_REQ (msg_p).tac[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).tac[k]); - F1AP_SETUP_REQ (msg_p).mcc[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr)); - LOG_I(ENB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mcc[k]); + F1AP_SETUP_REQ (msg_p).mcc[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mcc[k]); - F1AP_SETUP_REQ (msg_p).mnc[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); - LOG_I(ENB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc[k]); + F1AP_SETUP_REQ (msg_p).mnc[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc[k]); - F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); - LOG_I(ENB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); + F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + LOG_I(ENB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); - AssertFatal((F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 2) || - (F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 3), - "BAD MNC DIGIT LENGTH %d", - F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); + AssertFatal((F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 2) || + (F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 3), + "BAD MNC DIGIT LENGTH %d", + F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); - LOG_I(ENB_APP,"F1AP: CU_ip4_address %s\n",RC.mac[k]->eth_params_n.remote_addr); - LOG_I(ENB_APP,"FIAP: CU_ip4_address %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.remote_addr)); + LOG_I(ENB_APP,"F1AP: CU_ip4_address %s\n",RC.mac[k]->eth_params_n.remote_addr); + LOG_I(ENB_APP,"FIAP: CU_ip4_address %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.remote_addr)); - strcpy(F1AP_SETUP_REQ (msg_p).CU_ipv4_address, - RC.mac[k]->eth_params_n.remote_addr); - //strcpy(F1AP_SETUP_REQ (msg_p).CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); - F1AP_SETUP_REQ (msg_p).CU_port = RC.mac[k]->eth_params_n.remote_portc; + F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6 = 0; + F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4 = 1; + //strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6_address, ""); + strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address, RC.mac[k]->eth_params_n.my_addr); + + LOG_I(ENB_APP,"F1AP: DU_ip4_address %s\n",RC.mac[k]->eth_params_n.my_addr); + LOG_I(ENB_APP,"FIAP: DU_ip4_address %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.my_addr)); + + F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6 = 0; + F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4 = 1; + //strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6_address, ""); + strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, RC.mac[k]->eth_params_n.remote_addr); + + //strcpy(F1AP_SETUP_REQ (msg_p).CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); + //F1AP_SETUP_REQ (msg_p).CU_port = RC.mac[k]->eth_params_n.remote_portc; // maybe we dont need it - sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG); - config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); - F1AP_SETUP_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr); - F1AP_SETUP_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr); - - eNB_RRC_INST *rrc = RC.rrc[k]; - // wait until RRC cell information is configured - int cell_info_configured=0; - do { - LOG_I(ENB_APP,"ngran_eNB_DU: Waiting for basic cell configuration\n"); - usleep(100000); - pthread_mutex_lock(&rrc->cell_info_mutex); - cell_info_configured = rrc->cell_info_configured; - pthread_mutex_unlock(&rrc->cell_info_mutex); - } while (cell_info_configured ==0); + sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG); + config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); + F1AP_SETUP_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr); + F1AP_SETUP_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr); + + eNB_RRC_INST *rrc = RC.rrc[k]; + // wait until RRC cell information is configured + int cell_info_configured=0; + do { + LOG_I(ENB_APP,"ngran_eNB_DU: Waiting for basic cell configuration\n"); + usleep(100000); + pthread_mutex_lock(&rrc->cell_info_mutex); + cell_info_configured = rrc->cell_info_configured; + pthread_mutex_unlock(&rrc->cell_info_mutex); + } while (cell_info_configured ==0); - F1AP_SETUP_REQ (msg_p).nr_pci[k] = rrc->carrier[0].physCellId; - F1AP_SETUP_REQ (msg_p).nr_cellid[k] = 0; - F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0; - if (rrc->carrier[0].sib1->tdd_Config) { - - LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, - rrc->carrier[0].dl_CarrierFreq); - // For LTE use scs field to carry prefix type and number of antennas - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.scs = (rrc->carrier[0].Ncp<<2)+rrc->carrier[0].p_eNB;; - // use nrb field to hold LTE N_RB_DL (0...5) - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->carrier[0].mib.message.dl_Bandwidth; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->carrier[0].mib.message.dl_Bandwidth; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.num_frequency_bands = 1; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; - } - else { - LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); - - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, - rrc->carrier[0].dl_CarrierFreq); - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_arfcn = F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn; - // For LTE use scs field to carry prefix type and number of antennas - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_scs = (rrc->carrier[0].Ncp<<2)+rrc->carrier[0].p_eNB;; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_scs = rrc->carrier[0].Ncp; - // use nrb field to hold LTE N_RB_DL (0...5) - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = rrc->carrier[0].mib.message.dl_Bandwidth; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = rrc->carrier[0].mib.message.dl_Bandwidth; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.num_frequency_bands = 1; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; - } - F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = NULL; - F1AP_SETUP_REQ (msg_p).ranac[k] = 0; - F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier[0].MIB; - F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier[0].SIB1; - - break; - } - } - } + F1AP_SETUP_REQ (msg_p).nr_pci[k] = rrc->carrier[0].physCellId; + F1AP_SETUP_REQ (msg_p).nr_cellid[k] = 0; + F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0; + if (rrc->carrier[0].sib1->tdd_Config) { + + LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, + rrc->carrier[0].dl_CarrierFreq); + // For LTE use scs field to carry prefix type and number of antennas + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.scs = (rrc->carrier[0].Ncp<<2)+rrc->carrier[0].p_eNB;; + // use nrb field to hold LTE N_RB_DL (0...5) + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->carrier[0].mib.message.dl_Bandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->carrier[0].mib.message.dl_Bandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; + } + else { + LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); + + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, + rrc->carrier[0].dl_CarrierFreq); + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_arfcn = F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn; + // For LTE use scs field to carry prefix type and number of antennas + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_scs = (rrc->carrier[0].Ncp<<2)+rrc->carrier[0].p_eNB;; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_scs = rrc->carrier[0].Ncp; + // use nrb field to hold LTE N_RB_DL (0...5) + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = rrc->carrier[0].mib.message.dl_Bandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = rrc->carrier[0].mib.message.dl_Bandwidth; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; + } + F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = NULL; + F1AP_SETUP_REQ (msg_p).ranac[k] = 0; + F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier[0].MIB; + F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier[0].SIB1; + + break; + } // if + } // for + } // if return 0; diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 7551164caa..a3dac96635 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -113,7 +113,7 @@ void CU_send_sctp_init_req(instance_t enb_id) { MessageDef *message_p = NULL; message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); - message_p->ittiMsg.sctp_init.port = RC.rrc[enb_id]->eth_params_s.my_portc; + message_p->ittiMsg.sctp_init.port = F1AP_PORT_NUMBER; message_p->ittiMsg.sctp_init.ppid = F1AP_SCTP_PPID; message_p->ittiMsg.sctp_init.ipv4 = 1; message_p->ittiMsg.sctp_init.ipv6 = 0; diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 8dc1f10198..f16b876b0e 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -45,6 +45,9 @@ #define F1AP_UE_IDENTIFIER_NUMBER 3 #define NUMBER_OF_eNB_MAX 3 +// #include "common/ran_context.h" +// extern RAN_CONTEXT_t RC; + /* This structure describes association of a DU to a CU */ typedef struct f1ap_info { @@ -169,11 +172,11 @@ void *F1AP_DU_task(void *arg) { // ============================================================================== -static void du_f1ap_register(du_f1ap_instance_t *instance_p, - char *cu_ip_address, - int cu_port, - uint16_t in_streams, - uint16_t out_streams) +static void du_f1ap_register(du_f1ap_instance_t *instance_p, + f1ap_net_ip_address_t *remote_address, // CU + f1ap_net_ip_address_t *local_address, // DU + uint16_t in_streams, + uint16_t out_streams) { MessageDef *message_p = NULL; @@ -182,13 +185,21 @@ static void du_f1ap_register(du_f1ap_instance_t *instance_p, message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - - sctp_new_association_req_p->port = cu_port; + sctp_new_association_req_p->ulp_cnx_id = instance_p->instance; + sctp_new_association_req_p->port = F1AP_PORT_NUMBER; sctp_new_association_req_p->ppid = F1AP_SCTP_PPID; sctp_new_association_req_p->in_streams = in_streams; sctp_new_association_req_p->out_streams = out_streams; + memcpy(&sctp_new_association_req_p->remote_address, + remote_address, + sizeof(*remote_address)); + + memcpy(&sctp_new_association_req_p->local_address, + local_address, + sizeof(*local_address)); + itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); } @@ -227,8 +238,8 @@ void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_se //} du_f1ap_register(new_instance, - &f1ap_setup_req->CU_ipv4_address, - &f1ap_setup_req->CU_port, + &f1ap_setup_req->CU_f1_ip_address, // remote + &f1ap_setup_req->DU_f1_ip_address, // local f1ap_setup_req->sctp_in_streams, f1ap_setup_req->sctp_out_streams); diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 0bfc65bc4d..dbe675dd8a 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -394,23 +394,6 @@ extern int asn1_xer_print; //Forward declaration //struct f1ap_message_s; -typedef struct f1ap_net_ip_address_s { - unsigned ipv4:1; - unsigned ipv6:1; - char ipv4_address[16]; - char ipv6_address[46]; -} f1ap_net_ip_address_t; - - -/*typedef struct f1ap_message_s { - F1AP_ProtocolIE_ID_t id; - F1AP_Criticality_t criticality; - uint8_t direction; - union { - F1AP_F1SetupRequestIEs_t f1ap_F1SetupRequestIEs; - } msg; -} f1ap_message;*/ - /** \brief Function callback prototype. **/ typedef int (*f1ap_message_decoded_callback)( @@ -419,73 +402,4 @@ typedef int (*f1ap_message_decoded_callback)( F1AP_F1AP_PDU_t *message_p ); -/** \brief Encode a successfull outcome message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Deferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -/*ssize_t f1ap_generate_successfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_F1ap_ProcedureCode procedureCode, - F1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); -*/ -/** \brief Encode an initiating message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Deferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -/*ssize_t f1ap_generate_initiating_message( - uint8_t **buffer, - uint32_t *length, - e_F1ap_ProcedureCode procedureCode, - F1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); -*/ -/** \brief Encode an unsuccessfull outcome message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Deferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -/*ssize_t f1ap_generate_unsuccessfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_F1ap_ProcedureCode procedureCode, - F1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); -*/ -/** \brief Generate a new IE - \param id Protocol ie id of the IE - \param criticality Criticality of the IE - \param type ASN1 type descriptor of the IE value - \param sptr Structure to be encoded in the value field - @returns a pointer to the newly created IE structure or NULL in case of failure - **/ -/*F1ap_IE_t *f1ap_new_ie(F1ap_ProtocolIE_ID_t id, - F1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *type, - void *sptr); -*/ -/** \brief Handle criticality - \param criticality Criticality of the IE - @returns void - **/ -//void f1ap_handle_criticality(F1ap_Criticality_t criticality); - #endif /* F1AP_COMMON_H_ */ diff --git a/openair2/F1AP/f1ap_default_values.h b/openair2/F1AP/f1ap_default_values.h index ddb2ef5b07..91a1179624 100644 --- a/openair2/F1AP/f1ap_default_values.h +++ b/openair2/F1AP/f1ap_default_values.h @@ -40,7 +40,7 @@ #define ENB_NAME "Eurecom ENB" #define ENB_NAME_FORMAT (ENB_NAME" %u") -#define F1AP_PORT_NUMBER (3642) +#define F1AP_PORT_NUMBER (30923) #define F1AP_SCTP_PPID (62) #endif /* F1AP_DEFAULT_VALUES_H_ */ -- GitLab From e82cae08c3a240a02ede1b537acff68242effa1e Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 7 Sep 2018 12:07:26 +0200 Subject: [PATCH 035/308] fix wrong parameter when get ip address in DU --- openair2/ENB_APP/enb_config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 9a3a1232c1..41ac60cc0b 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2406,21 +2406,21 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { "BAD MNC DIGIT LENGTH %d", F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); - LOG_I(ENB_APP,"F1AP: CU_ip4_address %s\n",RC.mac[k]->eth_params_n.remote_addr); - LOG_I(ENB_APP,"FIAP: CU_ip4_address %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.remote_addr)); + LOG_I(ENB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.mac[k]->eth_params_n.remote_addr); + LOG_I(ENB_APP,"FIAP: CU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.remote_addr)); F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6 = 0; F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4 = 1; //strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6_address, ""); - strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address, RC.mac[k]->eth_params_n.my_addr); + strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address, RC.mac[k]->eth_params_n.remote_addr); - LOG_I(ENB_APP,"F1AP: DU_ip4_address %s\n",RC.mac[k]->eth_params_n.my_addr); - LOG_I(ENB_APP,"FIAP: DU_ip4_address %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.my_addr)); + LOG_I(ENB_APP,"F1AP: DU_ip4_address in DU %s\n",RC.mac[k]->eth_params_n.my_addr); + LOG_I(ENB_APP,"FIAP: DU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.my_addr)); F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6 = 0; F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4 = 1; //strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6_address, ""); - strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, RC.mac[k]->eth_params_n.remote_addr); + strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, RC.mac[k]->eth_params_n.my_addr); //strcpy(F1AP_SETUP_REQ (msg_p).CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); //F1AP_SETUP_REQ (msg_p).CU_port = RC.mac[k]->eth_params_n.remote_portc; // maybe we dont need it -- GitLab From 54aa295eb47cfb1572b519d579d5001596535588 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 7 Sep 2018 11:33:38 +0200 Subject: [PATCH 036/308] Use f1ap_encoder.c file for F1AP encoding functionality --- cmake_targets/CMakeLists.txt | 1 + openair2/F1AP/CU_F1AP.c | 40 --------------------------------- openair2/F1AP/DU_F1AP.c | 43 ++---------------------------------- openair2/F1AP/f1ap_encoder.c | 37 ++++++++++++++----------------- 4 files changed, 20 insertions(+), 101 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index bb70757e3e..53d461cbec 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -543,6 +543,7 @@ add_library(F1AP #${F1AP_DIR}/test.c ${F1AP_DIR}/DU_F1AP.c ${F1AP_DIR}/CU_F1AP.c + ${F1AP_DIR}/f1ap_encoder.c ${F1AP_DIR}/f1ap_decoder.c ${F1AP_DIR}/f1ap_handlers.c ${F1AP_DIR}/sctp_du.c diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index a3dac96635..c0bdeaf1a2 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -334,46 +334,6 @@ void CU_send_F1_SETUP_RESPONSE(void) { } -int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { - DevAssert(pdu != NULL); - DevAssert(buffer != NULL); - DevAssert(length != NULL); - - - xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); - - - ssize_t encoded; - - // asn_DEF_F1AP_F1SetupRequest - // asn_DEF_F1AP_F1AP_PDU - - /* We can safely free list of IE from sptr */ - //ASN_STRUCT_FREE_CONTENTS_ONLY(&asn_DEF_F1AP_F1SetupRequest, pdu); - - - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, - pdu, - - (void **)buffer)) < 0) { - printf("\nencoded len = %ld\n", encoded); - return -1; - } - - printf("encoded len = %ld\n", encoded); - printf("buffer = \n"); - - int i_ret; - for (i_ret = 0; i_ret < encoded; i_ret++) { - printf("%x ", *((*buffer)+i_ret)); - } - printf("\n"); - *length = encoded; - // ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu); - return encoded; -} - - // int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { // //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index f16b876b0e..359a2b9415 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -33,6 +33,8 @@ #include "conversions.h" #include "f1ap_common.h" #include "du_f1ap_defs.h" +#include "f1ap_encoder.h" +#include "f1ap_decoder.h" #include "platform_types.h" #include "common/utils/LOG/log.h" #include "sctp_du.h" @@ -506,47 +508,6 @@ void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP, f } -// ============================================================================== - -int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { - DevAssert(pdu != NULL); - DevAssert(buffer != NULL); - DevAssert(length != NULL); - - - xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); - - - ssize_t encoded; - - // asn_DEF_F1AP_F1SetupRequest - // asn_DEF_F1AP_F1AP_PDU - - /* We can safely free list of IE from sptr */ - //ASN_STRUCT_FREE_CONTENTS_ONLY(&asn_DEF_F1AP_F1SetupRequest, pdu); - - - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, - pdu, - (void **)buffer)) < 0) { - printf("encoded len = %ld\n", encoded); - return -1; - } - - printf("encoded len = %ld\n", encoded); - printf("buffer = \n"); - - int i_ret; - for (i_ret = 0; i_ret < encoded; i_ret++) { - printf("%x ", *((*buffer)+i_ret)); - } - printf("\n"); - *length = encoded; - //ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu); - return encoded; -} - - // int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { // //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index 58be896eae..bc2304b656 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -41,9 +41,9 @@ #include "intertask_interface.h" #include "f1ap_common.h" -#include "f1ap_ies_defs.h" #include "f1ap_encoder.h" +/* static inline int f1ap_encode_initiating(f1ap_message *message, uint8_t **buffer, uint32_t *len); @@ -77,32 +77,29 @@ int f1ap_encode_ue_context_release_request( F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs, uint8_t **buffer, uint32_t *length); + */ -int f1ap_encode_pdu(f1ap_message *message, uint8_t **buffer, uint32_t *len) +int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { - DevAssert(message != NULL); + ssize_t encoded; + DevAssert(pdu != NULL); DevAssert(buffer != NULL); - DevAssert(len != NULL); - - switch(message->direction) { // Need Check (present)? - case F1AP_F1AP_PDU_PR_initiatingMessage: - return f1ap_encode_initiating(message, buffer, len); - - case F1AP_F1AP_PDU_PR_successfulOutcome: - return f1ap_encode_successfull_outcome(message, buffer, len); + DevAssert(length != NULL); - case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: - return f1ap_encode_unsuccessfull_outcome(message, buffer, len); + //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); - default: - F1AP_DEBUG("Unknown message outcome (%d) or not implemented", - (int)message->direction); - break; + if (encoded < 0) { + LOG_E(F1AP, "Failed to encode F1AP message\n"); + return -1; } - - return -1; + *length = encoded; + /* Is the following needed? I moved the code here from CU_F1AP.c/DU_F1AP.c */ + // ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu); + return encoded; } +/* static inline int f1ap_encode_initiating(f1ap_message *f1ap_message_p, uint8_t **buffer, uint32_t *len) @@ -379,4 +376,4 @@ int f1ap_encode_ue_context_release_request( &asn_DEF_F1ap_UEContextReleaseRequest, ue_context_release_request_p); } - +*/ -- GitLab From 2e453eff69427838e44b480fbf99b62fa79572cc Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 7 Sep 2018 12:14:23 +0200 Subject: [PATCH 037/308] move F1AP_get_next_transaction_identifier() to f1ap_common.c --- cmake_targets/CMakeLists.txt | 1 + openair2/F1AP/CU_F1AP.c | 11 ----------- openair2/F1AP/DU_F1AP.c | 15 --------------- openair2/F1AP/f1ap_common.c | 22 ++++++++++++++++++---- openair2/F1AP/f1ap_common.h | 13 +++++++------ 5 files changed, 26 insertions(+), 36 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 53d461cbec..fc646020b7 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -546,6 +546,7 @@ add_library(F1AP ${F1AP_DIR}/f1ap_encoder.c ${F1AP_DIR}/f1ap_decoder.c ${F1AP_DIR}/f1ap_handlers.c + ${F1AP_DIR}/f1ap_common.c ${F1AP_DIR}/sctp_du.c ${F1AP_DIR}/sctp_cu.c ) diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index c0bdeaf1a2..0684c866b2 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -80,17 +80,6 @@ typedef struct f1ap_info { } f1ap_info_t; -// helper functions -#define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 -#define NUMBER_OF_eNB_MAX 3 - -uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP) { - static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; - transaction_identifier[enb_mod_idP+cu_mod_idP] = (transaction_identifier[enb_mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; - //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+cu_mod_idP]); - return transaction_identifier[enb_mod_idP+cu_mod_idP]; -} - // ============================================================================== static void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 359a2b9415..70420fd74f 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -42,14 +42,6 @@ #include "T.h" -// helper functions -#define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 -#define F1AP_UE_IDENTIFIER_NUMBER 3 -#define NUMBER_OF_eNB_MAX 3 - -// #include "common/ran_context.h" -// extern RAN_CONTEXT_t RC; - /* This structure describes association of a DU to a CU */ typedef struct f1ap_info { @@ -86,13 +78,6 @@ typedef struct f1ap_info { void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); -uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t du_mod_idP) { - static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; - transaction_identifier[enb_mod_idP+du_mod_idP] = (transaction_identifier[enb_mod_idP+du_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; - //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]); - return transaction_identifier[enb_mod_idP+du_mod_idP]; -} - uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { static uint8_t UE_identifier[NUMBER_OF_eNB_MAX]; UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER; diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 80c5b7b70d..22468ed054 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -35,10 +35,10 @@ #include "f1ap_common.h" //#include "S1AP-PDU.h" +#if defined(EMIT_ASN_DEBUG_EXTERN) int asn_debug = 0; int asn1_xer_print = 0; -#if defined(EMIT_ASN_DEBUG_EXTERN) inline void ASN_DEBUG(const char *fmt, ...) { if (asn_debug) { @@ -56,6 +56,7 @@ inline void ASN_DEBUG(const char *fmt, ...) } #endif +/* ssize_t f1ap_generate_initiating_message( uint8_t **buffer, uint32_t *length, @@ -76,9 +77,10 @@ ssize_t f1ap_generate_initiating_message( if (asn1_xer_print) { xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } + }*/ /* We can safely free list of IE from sptr */ +/* ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, @@ -110,9 +112,10 @@ ssize_t f1ap_generate_successfull_outcome( if (asn1_xer_print) { xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } + }*/ /* We can safely free list of IE from sptr */ +/* ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, @@ -146,8 +149,9 @@ ssize_t f1ap_generate_unsuccessfull_outcome( if (asn1_xer_print) { xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); } - +*/ /* We can safely free list of IE from sptr */ +/* ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, @@ -197,3 +201,13 @@ void f1ap_handle_criticality(F1ap_Criticality_t criticality) { } +*/ + +uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP) +{ + static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; + transaction_identifier[enb_mod_idP+cu_mod_idP] = + (transaction_identifier[enb_mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; + //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+cu_mod_idP]); + return transaction_identifier[enb_mod_idP+cu_mod_idP]; +} diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index dbe675dd8a..0defd872b6 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -37,9 +37,10 @@ #ifndef F1AP_COMMON_H_ #define F1AP_COMMON_H_ -/* Defined in asn_internal.h */ -// extern int asn_debug_indent; -extern int asn_debug; +#include "openairinterface5g_limits.h" + +#define F1AP_UE_IDENTIFIER_NUMBER 3 +#define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 #if defined(EMIT_ASN_DEBUG_EXTERN) inline void ASN_DEBUG(const char *fmt, ...); @@ -369,9 +370,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #define F1AP_UE_ID_FMT "0x%06"PRIX32 -extern int asn_debug; -extern int asn1_xer_print; - #include "assertions.h" #if defined(ENB_MODE) @@ -402,4 +400,7 @@ typedef int (*f1ap_message_decoded_callback)( F1AP_F1AP_PDU_t *message_p ); + +uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP); + #endif /* F1AP_COMMON_H_ */ -- GitLab From c4370d9df0c43542582c724326eb9f9fb8628d1d Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 7 Sep 2018 12:15:28 +0200 Subject: [PATCH 038/308] Start CU/DU tasks in create_remaining_tasks() of ENB_APP --- openair2/ENB_APP/enb_app.c | 19 ++++++++++++++----- openair2/F1AP/CU_F1AP.c | 1 + openair2/F1AP/DU_F1AP.c | 1 + openair2/F1AP/cu_f1ap_task.h | 27 +++++++++++++++++++++++++++ openair2/F1AP/du_f1ap_task.h | 27 +++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 openair2/F1AP/cu_f1ap_task.h create mode 100644 openair2/F1AP/du_f1ap_task.h diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 385b7fae5a..de1e655d32 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -49,6 +49,9 @@ # include "udp_eNB_task.h" # endif +extern void *F1AP_CU_task(void *); +extern void *F1AP_DU_task(void *); + #if defined(FLEXRAN_AGENT_SB_IF) # include "flexran_agent.h" #endif @@ -70,12 +73,15 @@ static void create_remaining_tasks(module_id_t enb_id) int rc; itti_wait_ready(1); switch (type) { - case ngran_eNB: - case ngran_ng_eNB: - case ngran_gNB: case ngran_eNB_CU: case ngran_ng_eNB_CU: case ngran_gNB_CU: + rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL); + AssertFatal(rc >= 0, "Create task for CU F1AP failed\n"); + /* fall through */ + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); AssertFatal(rc >= 0, "Create task for SCTP failed\n"); rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); @@ -92,11 +98,14 @@ static void create_remaining_tasks(module_id_t enb_id) break; } switch (type) { + case ngran_eNB_DU: + case ngran_gNB_DU: + rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL); + AssertFatal(rc >= 0, "Create task for DU F1AP failed\n"); + /* fall through */ case ngran_eNB: case ngran_ng_eNB: case ngran_gNB: - case ngran_eNB_DU: - case ngran_gNB_DU: rc = itti_create_task (TASK_L2L1, l2l1_task, NULL); AssertFatal(rc >= 0, "Create task for L2L1 failed\n"); break; diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 0684c866b2..726eeba0f7 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -35,6 +35,7 @@ #include "cu_f1ap_defs.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" +#include "cu_f1ap_task.h" #include "sctp_cu.h" #include "platform_types.h" #include "common/utils/LOG/log.h" diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 70420fd74f..599616a546 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -35,6 +35,7 @@ #include "du_f1ap_defs.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" +#include "du_f1ap_task.h" #include "platform_types.h" #include "common/utils/LOG/log.h" #include "sctp_du.h" diff --git a/openair2/F1AP/cu_f1ap_task.h b/openair2/F1AP/cu_f1ap_task.h new file mode 100644 index 0000000000..6904672f58 --- /dev/null +++ b/openair2/F1AP/cu_f1ap_task.h @@ -0,0 +1,27 @@ +/* + * 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 + */ + +#ifndef CU_F1AP_TASK_H_ +#define CU_F1AP_TASK_H_ + +void *F1AP_CU_task(void *arg); + +#endif /* CU_F1AP_TASK_H_ */ diff --git a/openair2/F1AP/du_f1ap_task.h b/openair2/F1AP/du_f1ap_task.h new file mode 100644 index 0000000000..579c2a9761 --- /dev/null +++ b/openair2/F1AP/du_f1ap_task.h @@ -0,0 +1,27 @@ +/* + * 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 + */ + +#ifndef DU_F1AP_TASK_H_ +#define DU_F1AP_TASK_H_ + +void *F1AP_DU_task(void *arg); + +#endif /* DU_F1AP_TASK_H_ */ -- GitLab From 17cc510a3c101c2f24c1a5770d725b5da4ca06d5 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 7 Sep 2018 14:13:56 +0200 Subject: [PATCH 039/308] add itti_receive_msg at CU and DU --- openair2/F1AP/CU_F1AP.c | 1 + openair2/F1AP/DU_F1AP.c | 2 ++ openair2/F1AP/f1ap_handlers.c | 8 ++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 726eeba0f7..2c766074bd 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -134,6 +134,7 @@ void *F1AP_CU_task(void *arg) { itti_mark_task_ready(TASK_CU_F1); while (1) { + itti_receive_msg(TASK_CU_F1, &received_msg); switch (ITTI_MSG_ID(received_msg)) { case F1AP_CU_SCTP_REQ: diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 599616a546..c7acd198c6 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -117,6 +117,8 @@ void *F1AP_DU_task(void *arg) { // SCTP while (1) { + itti_receive_msg(TASK_DU_F1, &received_msg); + switch (ITTI_MSG_ID(received_msg)) { // case TERMINATE_MESSAGE: diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 0ddd1a9675..a436696fe0 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -54,7 +54,7 @@ int f1ap_handle_f1_setup_request(uint32_t assoc_id, /* Handlers matrix. Only f1 related procedure present here */ -f1ap_message_decoded_callback messages_callback[][3] = { +f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* Reset */ @@ -110,7 +110,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, } /* Checking procedure Code and direction of message */ - if (pdu.choice.initiatingMessage->procedureCode > sizeof(messages_callback) / (3 * sizeof( + if (pdu.choice.initiatingMessage->procedureCode > sizeof(f1ap_messages_callback) / (3 * sizeof( f1ap_message_decoded_callback)) || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) { //F1AP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", @@ -124,7 +124,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, /* No handler present. * This can mean not implemented or no procedure for eNB (wrong direction). */ - if (messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { + if (f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { // F1AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n", // assoc_id, pdu.choice.initiatingMessage->procedureCode, // f1ap_direction2String(pdu.present - 1)); @@ -136,7 +136,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, } /* Calling the right handler */ - ret = (*messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) + ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) (assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return ret; -- GitLab From 021d7abf8a205f5aae1783f19c8c1dea5ebc042e Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 7 Sep 2018 19:04:45 +0200 Subject: [PATCH 040/308] Create the F1 pingpong procedure with SCTP --- cmake_targets/CMakeLists.txt | 1 + common/utils/LOG/log.c | 4 +- common/utils/LOG/log.h | 2 + common/utils/T/T_messages.txt | 30 ++++++++++++ openair2/ENB_APP/enb_app.c | 4 +- openair2/F1AP/CU_F1AP.c | 55 ++++++++++++++++------ openair2/F1AP/DU_F1AP.c | 24 ++++++---- openair2/F1AP/f1ap_handlers.c | 2 +- openair2/F1AP/f1ap_itti_messaging.c | 73 +++++++++++++++++++++++++++++ openair2/F1AP/f1ap_itti_messaging.h | 35 ++++++++++++++ targets/RT/USER/lte-softmodem.c | 6 +++ targets/RT/USER/lte-softmodem.h | 1 + 12 files changed, 209 insertions(+), 28 deletions(-) create mode 100644 openair2/F1AP/f1ap_itti_messaging.c create mode 100644 openair2/F1AP/f1ap_itti_messaging.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index fc646020b7..6beb215838 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -543,6 +543,7 @@ add_library(F1AP #${F1AP_DIR}/test.c ${F1AP_DIR}/DU_F1AP.c ${F1AP_DIR}/CU_F1AP.c + ${F1AP_DIR}/f1ap_itti_messaging.c ${F1AP_DIR}/f1ap_encoder.c ${F1AP_DIR}/f1ap_decoder.c ${F1AP_DIR}/f1ap_handlers.c diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 02ee849202..20442a02a4 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -418,7 +418,9 @@ int logInit (void) register_log_component("S1AP","",S1AP); - + register_log_component("F1AP","",F1AP); + register_log_component("CU_F1AP","",CU_F1AP); + register_log_component("DU_F1AP","",DU_F1AP); register_log_component("SCTP","",SCTP); register_log_component("RRH","",RRH); diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 7354c32c7d..9e1feab22e 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -174,6 +174,8 @@ typedef enum { SPGW, S1AP, F1AP, + DU_F1AP, + CU_F1AP, SCTP, HW, OSA, diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 904fcb7355..8887bb4110 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -883,6 +883,36 @@ ID = LEGACY_F1AP_ERROR GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_ERROR:LEGACY FORMAT = string,log +ID = LEGACY_CU_F1AP_DEBUG + DESC = CU_F1AP DEBUG LEVEL + GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log + +ID = LEGACY_CU_F1AP_INFO + DESC = CU_F1AP INFO LEVEL + GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log + +ID = LEGACY_CU_F1AP_ERROR + DESC = CU_F1AP ERROR LEVEL + GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log + +ID = LEGACY_DU_F1AP_DEBUG + DESC = DU_F1AP DEBUG LEVEL + GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log + +ID = LEGACY_DU_F1AP_INFO + DESC = DU_F1AP INFO LEVEL + GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log + +ID = LEGACY_DU_F1AP_ERROR + DESC = DU_F1AP ERROR LEVEL + GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log + ################# #### UE LOGS #### ################# diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index de1e655d32..c120e79496 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -76,14 +76,12 @@ static void create_remaining_tasks(module_id_t enb_id) case ngran_eNB_CU: case ngran_ng_eNB_CU: case ngran_gNB_CU: - rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL); + rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, enb_id); AssertFatal(rc >= 0, "Create task for CU F1AP failed\n"); /* fall through */ case ngran_eNB: case ngran_ng_eNB: case ngran_gNB: - rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for SCTP failed\n"); rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); AssertFatal(rc >= 0, "Create task for S1AP failed\n"); if (!emulate_rf){ diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 2c766074bd..4233eed3f5 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -40,6 +40,8 @@ #include "platform_types.h" #include "common/utils/LOG/log.h" #include "intertask_interface.h" +#include "f1ap_itti_messaging.h" +#include <arpa/inet.h> #include "T.h" @@ -100,6 +102,7 @@ void CU_send_sctp_init_req(instance_t enb_id) { // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port // 3. creat an itti message to init + LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ\n"); MessageDef *message_p = NULL; message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); @@ -108,7 +111,7 @@ void CU_send_sctp_init_req(instance_t enb_id) { message_p->ittiMsg.sctp_init.ipv4 = 1; message_p->ittiMsg.sctp_init.ipv6 = 0; message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; - message_p->ittiMsg.sctp_init.ipv4_address[0] = RC.rrc[enb_id]->eth_params_s.my_addr; + message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr); /* * SR WARNING: ipv6 multi-homing fails sometimes for localhost. * * * * Disable it for now. @@ -116,38 +119,54 @@ void CU_send_sctp_init_req(instance_t enb_id) { message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0; message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1"; + LOG_I(CU_F1AP,"CU.my_addr = %s \n", RC.rrc[enb_id]->eth_params_s.my_addr); + LOG_I(CU_F1AP,"CU.enb_id = %d \n", enb_id); itti_send_msg_to_task(TASK_SCTP, enb_id, message_p); } void *F1AP_CU_task(void *arg) { - printf("Start F1AP CU task!\n"); - //sctp_cu_init(); MessageDef *received_msg = NULL; int result; - //F1AP_DEBUG("Starting F1AP at DU\n"); + LOG_I(CU_F1AP,"Starting F1AP at CU\n"); //f1ap_eNB_prepare_internal_data(); itti_mark_task_ready(TASK_CU_F1); + CU_send_sctp_init_req(arg); + while (1) { itti_receive_msg(TASK_CU_F1, &received_msg); switch (ITTI_MSG_ID(received_msg)) { - case F1AP_CU_SCTP_REQ: - CU_send_sctp_init_req(ITTI_MESSAGE_GET_INSTANCE(received_msg)); + // case F1AP_CU_SCTP_REQ: + // LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ\n"); + + // break; + + case SCTP_NEW_ASSOCIATION_IND: + LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND\n"); + CU_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_ind); break; - case SCTP_DATA_IND: + case SCTP_NEW_ASSOCIATION_RESP: + LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); + CU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_resp); + break; + + case SCTP_DATA_IND: + LOG_I(CU_F1AP, "SCTP_DATA_IND\n"); CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; default: - // F1AP_ERROR("CU Received unhandled message: %d:%s\n", - // ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + LOG_E(CU_F1AP, "CU Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); break; } // switch result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); @@ -160,6 +179,14 @@ void *F1AP_CU_task(void *arg) { } +void CU_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { + CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_ind); +} + +void CU_handle_sctp_association_resp(instance_t instance, sctp_new_association_ind_t *sctp_new_association_resp) { + //CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_resp); +} + // ============================================================================== void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { F1AP_F1AP_PDU_t pdu; @@ -184,7 +211,7 @@ void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { } -void CU_send_F1_SETUP_RESPONSE(void) { +void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t *f1ap_setup_ind) { //void CU_send_F1_SETUP_RESPONSE(F1AP_F1SetupResponse_t *F1SetupResponse) { //AssertFatal(1==0,"Not implemented yet\n"); @@ -315,11 +342,11 @@ void CU_send_F1_SETUP_RESPONSE(void) { } // printf("\n"); - + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_ind->assoc_id, buffer, len, 0); /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } //printf("F1 setup response present = %d\n", out->value.present); //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index c7acd198c6..46c5eab800 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -40,6 +40,7 @@ #include "common/utils/LOG/log.h" #include "sctp_du.h" #include "intertask_interface.h" +#include "f1ap_itti_messaging.h" #include "T.h" @@ -102,14 +103,13 @@ void DU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) } void *F1AP_DU_task(void *arg) { - printf("Start F1AP DU task!\n"); //sctp_cu_init(); MessageDef *received_msg = NULL; int result; - //F1AP_DEBUG("Starting F1AP at DU\n"); + LOG_I(DU_F1AP, "Starting F1AP at DU\n"); //f1ap_eNB_prepare_internal_data(); @@ -118,7 +118,7 @@ void *F1AP_DU_task(void *arg) { // SCTP while (1) { itti_receive_msg(TASK_DU_F1, &received_msg); - + switch (ITTI_MSG_ID(received_msg)) { // case TERMINATE_MESSAGE: @@ -130,6 +130,7 @@ void *F1AP_DU_task(void *arg) { // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req + LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n"); DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg)); break; @@ -137,18 +138,20 @@ void *F1AP_DU_task(void *arg) { case SCTP_NEW_ASSOCIATION_RESP: // 1. store the respon // 2. send the f1setup_req + LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here + LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; default: - // F1AP_ERROR("DU Received unhandled message: %d:%s\n", - // ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + LOG_E(DU_F1AP, "DU Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); break; } // switch result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); @@ -172,7 +175,7 @@ static void du_f1ap_register(du_f1ap_instance_t *instance_p, MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); + message_p = itti_alloc_new_message(TASK_DU_F1, SCTP_NEW_ASSOCIATION_REQ); sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; sctp_new_association_req_p->ulp_cnx_id = instance_p->instance; @@ -244,8 +247,11 @@ void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_r // SETUP REQUEST -void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP, f1ap_setup_req_t *msg_p) { -//void DU_send_F1_SETUP_REQUEST(F1SetupRequest_t *F1SetupRequest) { +//void DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { +void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t *f1ap_setup_req) { + module_id_t enb_mod_idP; + module_id_t du_mod_idP; + F1AP_F1AP_PDU_t pdu; F1AP_F1SetupRequest_t *out; F1AP_F1SetupRequestIEs_t *ie; @@ -478,7 +484,7 @@ void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP, f printf("Failed to encode F1 setup request\n"); } - f1ap_du_send_message(buffer, len); + du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); // printf("\n"); /* decode */ diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index a436696fe0..4501975d7a 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -147,7 +147,7 @@ int f1ap_handle_f1_setup_request(uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("OOOOOOOOOOOOOOOOOOOOOOOOOOO\n"); + printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); return 0; } diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c new file mode 100644 index 0000000000..e51b5ad99b --- /dev/null +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -0,0 +1,73 @@ +/* + * 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 + */ + +#include "intertask_interface.h" + +#include "f1ap_itti_messaging.h" + +void cu_f1ap_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_CU_F1, 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 du_f1ap_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_DU_F1, 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 f1ap_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_S1AP, 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); +} + diff --git a/openair2/F1AP/f1ap_itti_messaging.h b/openair2/F1AP/f1ap_itti_messaging.h new file mode 100644 index 0000000000..66c59a72e7 --- /dev/null +++ b/openair2/F1AP/f1ap_itti_messaging.h @@ -0,0 +1,35 @@ +/* + * 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 + */ + +#ifndef F1AP_ITTI_MESSAGING_H_ +#define F1AP_ITTI_MESSAGING_H_ + +void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, + uint32_t buffer_length, uint16_t stream); + +void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, + uint32_t buffer_length, uint16_t stream); + +void f1ap_eNB_itti_send_sctp_close_association(instance_t instance, + int32_t assoc_id); + + +#endif /* F1AP_ITTI_MESSAGING_H_ */ diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index d2022540c1..da114515e8 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1063,6 +1063,7 @@ int main( int argc, char **argv ) int have_rrc=0; if (RC.nb_inst > 0) { + itti_wait_ready(1); LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n"); if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) { LOG_E(ENB_APP, "Create task for eNB APP failed\n"); @@ -1074,6 +1075,11 @@ int main( int argc, char **argv ) return -1; } have_rrc=1; + if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) { + LOG_E(SCTP, "Create task for SCTP failed\n"); + return -1; + } + itti_wait_ready(0); } else { printf("No ITTI, Initializing L1\n"); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 7f0288ea91..22090c0625 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -290,5 +290,6 @@ extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t abstraction_flag); extern void *eNB_app_task(void* args); +extern void *sctp_eNB_task(void *args); #endif -- GitLab From 5105766ec561bdd439a898f20c9342d0a98cf3d9 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 7 Sep 2018 19:14:12 +0200 Subject: [PATCH 041/308] Remove unwanted files and function for sctp and f1 unit test --- cmake_targets/CMakeLists.txt | 36 --------- openair2/F1AP/CU_F1AP.c | 55 ------------- openair2/F1AP/DU_F1AP.c | 146 ++--------------------------------- openair2/F1AP/sctp_cu.c | 128 ------------------------------ openair2/F1AP/sctp_cu.h | 40 ---------- openair2/F1AP/sctp_du.c | 139 --------------------------------- openair2/F1AP/sctp_du.h | 42 ---------- openair2/F1AP/test_f1ap_cu.c | 11 --- openair2/F1AP/test_f1ap_du.c | 5 -- 9 files changed, 7 insertions(+), 595 deletions(-) delete mode 100644 openair2/F1AP/sctp_cu.c delete mode 100644 openair2/F1AP/sctp_cu.h delete mode 100644 openair2/F1AP/sctp_du.c delete mode 100644 openair2/F1AP/sctp_du.h delete mode 100644 openair2/F1AP/test_f1ap_cu.c delete mode 100644 openair2/F1AP/test_f1ap_du.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 6beb215838..7ef66a8014 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -517,19 +517,10 @@ if (NOT ${ret} STREQUAL 0) endif (NOT ${ret} STREQUAL 0) file(GLOB F1AP_source ${F1AP_C_DIR}/*.c) -#set(F1AP_OAI_generated -# ${F1AP_C_DIR}/per_decoder.c -# ${F1AP_C_DIR}/per_encoder.c - #${F1AP_C_DIR}/f1ap_xer_print.c -# ${F1AP_C_DIR}/F1AP_ProtocolIE-Field.h -# ) - file(GLOB f1ap_h ${F1AP_C_DIR}/*.h) set(f1ap_h ${f1ap_h} ) add_library(F1AP_LIB - #${F1AP_OAI_generated} - #${f1ap_h} ${F1AP_source} ) @@ -538,9 +529,7 @@ include_directories ("${F1AP_DIR}") message(${F1AP_C_DIR}) message(${F1AP_DIR}) - add_library(F1AP - #${F1AP_DIR}/test.c ${F1AP_DIR}/DU_F1AP.c ${F1AP_DIR}/CU_F1AP.c ${F1AP_DIR}/f1ap_itti_messaging.c @@ -548,33 +537,8 @@ add_library(F1AP ${F1AP_DIR}/f1ap_decoder.c ${F1AP_DIR}/f1ap_handlers.c ${F1AP_DIR}/f1ap_common.c - ${F1AP_DIR}/sctp_du.c - ${F1AP_DIR}/sctp_cu.c - ) - -add_executable(test_f1ap_du - ${F1AP_DIR}/test_f1ap_du.c - ${F1AP_DIR}/DU_F1AP.c - ${F1AP_DIR}/f1ap_decoder.c - ${F1AP_DIR}/f1ap_handlers.c - ${F1AP_DIR}/sctp_du.c ) -target_link_libraries(test_f1ap_du - -Wl,--start-group F1AP_LIB ${T_LIB} sctp pthread -Wl,--end-group - ) - -add_executable(test_f1ap_cu - ${F1AP_DIR}/test_f1ap_cu.c - ${F1AP_DIR}/CU_F1AP.c - ${F1AP_DIR}/f1ap_decoder.c - ${F1AP_DIR}/f1ap_handlers.c - ${F1AP_DIR}/sctp_cu.c - ) - -target_link_libraries(test_f1ap_cu - -Wl,--start-group F1AP_LIB ${T_LIB} sctp pthread -Wl,--end-group - ) # Hardware dependant options ################################### diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 4233eed3f5..c92bdb0240 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -36,7 +36,6 @@ #include "f1ap_encoder.h" #include "f1ap_decoder.h" #include "cu_f1ap_task.h" -#include "sctp_cu.h" #include "platform_types.h" #include "common/utils/LOG/log.h" #include "intertask_interface.h" @@ -352,60 +351,6 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t * } -// int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { - -// //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); -// F1AP_F1AP_PDU_t pdu; -// F1AP_F1AP_PDU_t *pdu_p = &pdu; -// asn_dec_rval_t dec_ret; - -// DevAssert(buffer != NULL); - -// printf("buffer = \n"); -// int i_ret; -// for (i_ret = 0; i_ret < length; i_ret++) { -// printf("%x ", *(buffer+i_ret)); -// } -// printf("\n"); - -// memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t)); - - -// dec_ret = aper_decode(NULL, -// &asn_DEF_F1AP_F1AP_PDU, -// (void **)&pdu_p, -// buffer, -// length, -// 0, -// 0); - -// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); - -// printf("\n"); - -// printf("dec_ret.code = %d \n", dec_ret.code); - -// AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n"); - -// // switch(pdu_p->present) { -// // case F1AP_F1AP_PDU_PR_initiatingpdu: -// // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu); - -// // case F1AP_F1AP_PDU_PR_successfulOutcome: -// // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome); - -// // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: -// // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome); - -// // default: -// // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/ -// // break; -// // } - -// //AssertFatal(1==0,"Shouldn't get here\n"); -// return -1; -// } - void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure) { AssertFatal(1==0,"Not implemented yet\n"); //AssertFatal(1==0,"Not implemented yet\n"); diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index 46c5eab800..ad6d4ec3cb 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -38,7 +38,6 @@ #include "du_f1ap_task.h" #include "platform_types.h" #include "common/utils/LOG/log.h" -#include "sctp_du.h" #include "intertask_interface.h" #include "f1ap_itti_messaging.h" @@ -477,145 +476,14 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - //printf("F1 setup request present = %d\n", ie.value.present); - /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); } du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - // printf("\n"); - - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - // int req; - // req = s1ap_eNB_encode_s1_setup_request(&ie, &buffer, &len); - - //printf("encode F1 setup request, req = %d \n", req); - - //f1ap_eNB_itti_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); - /* send Not Use ITTI */ - //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); - } -// int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) { - -// //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n"); -// F1AP_F1AP_PDU_t pdu; -// F1AP_F1AP_PDU_t *pdu_p = &pdu; -// asn_dec_rval_t dec_ret; - -// DevAssert(buffer != NULL); - -// printf("buffer = \n"); -// int i_ret; -// for (i_ret = 0; i_ret < length; i_ret++) { -// printf("%x ", *(buffer+i_ret)); -// } -// printf("\n"); - -// memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t)); - - -// dec_ret = aper_decode(NULL, -// &asn_DEF_F1AP_F1AP_PDU, -// (void **)&pdu_p, -// buffer, -// length, -// 0, -// 0); - -// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); - -// printf("\n"); - -// printf("dec_ret.code = %d \n", dec_ret.code); - -// AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n"); - -// // switch(pdu_p->present) { -// // case F1AP_F1AP_PDU_PR_initiatingpdu: -// // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu); - -// // case F1AP_F1AP_PDU_PR_successfulOutcome: -// // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome); - -// // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: -// // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome); - -// // default: -// // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/ -// // break; -// // } - -// //AssertFatal(1==0,"Shouldn't get here\n"); -// return -1; -// } - - -// ssize_t s1ap_generate_initiating_pdu( -// uint8_t **buffer, -// uint32_t *length, -// F1AP_ProcedureCode_t procedureCode, -// F1AP_Criticality_t criticality, -// asn_TYPE_descriptor_t *td, -// void *sptr) -// { -// F1AP_F1AP_PDU_t pdu; -// ssize_t encoded; - -// memset(&pdu, 0, sizeof(F1AP_F1AP_PDU_t)); - -// pdu.present = F1AP_F1AP_PDU_PR_initiatingpdu; -// pdu.choice.initiatingpdu = (F1AP_Initiatingpdu_t *)calloc(1, sizeof(F1AP_Initiatingpdu_t)); -// pdu.choice.initiatingpdu->procedureCode = procedureCode; -// pdu.choice.initiatingpdu->criticality = criticality; -// //ANY_fromType_aper(&pdu.choice.initiatingpdu->value, td, sptr); - -// //if (asn1_xer_print) { -// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, (void *)&pdu); -// //} - -// /* We can safely free list of IE from sptr */ -// ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - -// if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, &pdu, -// (void **)buffer)) < 0) { -// return -1; -// } - -// *length = encoded; -// return encoded; -// } - -// int s1ap_eNB_encode_s1_setup_request( -// F1AP_F1SetupRequestIEs_t *s1SetupRequestIEs, -// uint8_t **buffer, -// uint32_t *length) -// { -// F1AP_F1SetupRequestIEs_t s1SetupRequest; -// F1AP_F1SetupRequestIEs_t *s1SetupRequest_p = &s1SetupRequest; - -// memset((void *)s1SetupRequest_p, 0, sizeof(s1SetupRequest)); - -// if (s1ap_encode_s1ap_s1setuprequesties(s1SetupRequest_p, s1SetupRequestIEs) < 0) { -// return -1; -// } - -// return s1ap_generate_initiating_pdu(buffer, -// length, -// F1AP_ProcedureCode_id_F1Setup, -// F1AP_Criticality_reject, -// &asn_DEF_F1AP_F1SetupRequest, -// s1SetupRequest_p); -// } - - - // SETUP SUCCESSFUL void DU_handle_F1_SETUP_RESPONSE() { @@ -633,7 +501,7 @@ void DU_handle_F1_SETUP_RESPONSE() { // SETUP FAILURE void DU_handle_F1_SETUP_FAILURE(struct F1AP_F1AP_PDU_t *pdu_p) { - //AssertFatal(1==0,"Not implemented yet\n"); + AssertFatal(1==0,"Not implemented yet\n"); //F1AP_F1SetupFailureIEs_t *f1_setup_failure_p; //f1_setup_failure_p = &pdu_p.choice.unsuccessfulOutcome.value.choice.F1SetupFailureIEs.protocolIEs; @@ -643,7 +511,7 @@ void DU_handle_F1_SETUP_FAILURE(struct F1AP_F1AP_PDU_t *pdu_p) { void DU_send_ERROR_INDICATION(struct F1AP_F1AP_PDU_t *pdu_p) { - //AssertFatal(1==0,"Not implemented yet\n"); + AssertFatal(1==0,"Not implemented yet\n"); //F1AP_F1ErrorIndicationIEs_t *f1_error_indication_p; //f1_error_indication_p = &pdu_p.choice.successfulOutcome.value.choice.F1ErrorIndicationIEs.protocolIEs; @@ -770,7 +638,7 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( printf("\n"); - f1ap_du_send_message(buffer, len); + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); /* decode */ // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { // printf("Failed to decode F1 setup request\n"); @@ -842,7 +710,7 @@ void DU_send_UL_RRC_MESSAGE_TRANSFER(void) { printf("\n"); - f1ap_du_send_message(buffer, len); + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); /* decode */ // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { // printf("Failed to decode F1 setup request\n"); @@ -1304,7 +1172,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du printf("\n"); - //f1ap_du_send_message(buffer, len); + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); /* decode */ if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { @@ -1617,7 +1485,7 @@ void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { // printf("Failed to decode F1 setup request\n"); // } - f1ap_du_send_message(buffer, len); + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); } void DU_send_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { @@ -2005,7 +1873,7 @@ void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { // printf("Failed to decode F1 setup request\n"); // } - f1ap_du_send_message(buffer, len); + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); } diff --git a/openair2/F1AP/sctp_cu.c b/openair2/F1AP/sctp_cu.c deleted file mode 100644 index 4e9dd98a99..0000000000 --- a/openair2/F1AP/sctp_cu.c +++ /dev/null @@ -1,128 +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 sctp_server.c - * \brief sctp server procedures for f1ap - * \author EURECOM/NTUST - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr - * \note - * \warning - */ -#include <stdio.h> -#include <string.h> -#include <time.h> -#include <sys/socket.h> -#include <sys/types.h> -#include <netinet/in.h> -#include <netinet/sctp.h> -#include <arpa/inet.h> -#include <pthread.h> -#include <unistd.h> // for close -#include <stdlib.h> -#include "f1ap_handlers.h" - -#define MAX_BUFFER 1024 - -/* server */ - -int sfd, cfd, len, flags; -struct sctp_sndrcvinfo sndrcvinfo; -struct sockaddr_in saddr, caddr; -struct sctp_initmsg initmsg; -uint8_t buff[INET_ADDRSTRLEN]; - -void send_func(int cfd) { - uint8_t buffer_send[MAX_BUFFER+1]; - /* Changing 9th character the character after # in the message buffer */ - buffer_send[0] = rand(); - sctp_sendmsg( cfd, (void *)buffer_send, (size_t)strlen(buffer_send), - NULL, 0, htons(62), 0, 1 /* stream */, 0, 0 ); - printf("S - Sent: %s\n", buffer_send); -} - -void *recv_func(void *cfd) { - int ret; - uint8_t buffer_recv[MAX_BUFFER+1]; - - //recv message - bzero( (void *)&buffer_recv, sizeof(buffer_recv) ); - while(ret = sctp_recvmsg( *(int*)cfd, (void *)buffer_recv, sizeof(buffer_recv), - (struct sockaddr *)NULL, 0, &sndrcvinfo, &flags )) { - //send_func(*(int*)cfd); - //printf("S - cfd = %d\n", *(int*)cfd); - printf("S - Received following data on ppid %d, data is: %x\n", - sndrcvinfo.sinfo_ppid, buffer_recv); - printf("S - Received following data on stream %d, data is: \n", sndrcvinfo.sinfo_stream); - - int i_ret; - for (i_ret = 0; i_ret < sizeof(buffer_recv); i_ret++) { - printf("%x ", *(buffer_recv+i_ret)); - } - - printf("\n"); - - f1ap_handle_message(1/*sctp_data_ind->assoc_id*/, 1/*sctp_data_ind->stream*/, - buffer_recv, sizeof(buffer_recv)); - - //f1ap_decode_pdu(NULL , buffer_recv, sizeof(buffer_recv)); - } - printf("ret = %d\n", ret); - close( *(int*)cfd ); - return NULL; -} - -int sctp_cu_init(void) { - pthread_t threads; - printf("S - Waiting for socket_accept\n"); - - sfd = socket( AF_INET, SOCK_STREAM, IPPROTO_SCTP ); - bzero( (void *)&saddr, sizeof(saddr) ); - saddr.sin_family = AF_INET; - saddr.sin_addr.s_addr = htonl( INADDR_ANY ); - saddr.sin_port = htons(29008); - - bind( sfd, (struct sockaddr *)&saddr, sizeof(saddr) ); - - /* Maximum of 3 streams will be available per socket */ - memset( &initmsg, 0, sizeof(initmsg) ); - initmsg.sinit_num_ostreams = 3; - initmsg.sinit_max_instreams = 3; - initmsg.sinit_max_attempts = 2; - setsockopt( sfd, IPPROTO_SCTP, SCTP_INITMSG, - &initmsg, sizeof(initmsg) ); - - listen( sfd, 5 ); - - while(cfd=accept(sfd, (struct sockaddr *)&caddr, (socklen_t*)&caddr)) { - printf("-------- S - Connected to %s\n", - inet_ntop(AF_INET, &caddr.sin_addr, buff, - sizeof(buff))); - int *thread_args = malloc(sizeof(int)); - *thread_args = cfd; - pthread_create(&threads, NULL, recv_func, thread_args); - } - - printf("S - close\n"); - return 0; -} diff --git a/openair2/F1AP/sctp_cu.h b/openair2/F1AP/sctp_cu.h deleted file mode 100644 index 68db2864d5..0000000000 --- a/openair2/F1AP/sctp_cu.h +++ /dev/null @@ -1,40 +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 sctp_cu.h - * \brief sctp server procedures for F1AP - * \author Robert Schmidt - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: robert.schmidt@eurecom.fr - * \note - * \warning - */ - -#ifndef SCTP_CU_H_ -#define SCTP_CU_H_ - -//void send_func(int cfd); -//void *recv_func(void *cfd); -int sctp_cu_init(void); - -#endif /* SCTP_CU_H_ */ diff --git a/openair2/F1AP/sctp_du.c b/openair2/F1AP/sctp_du.c deleted file mode 100644 index 3520f4691b..0000000000 --- a/openair2/F1AP/sctp_du.c +++ /dev/null @@ -1,139 +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 sctp_client.c - * \brief sctp client procedures for f1ap - * \author EURECOM/NTUST - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr - * \note - * \warning - */ -#include <stdio.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/types.h> -#include <netinet/in.h> -#include <netinet/sctp.h> -#include <pthread.h> -#include <arpa/inet.h> -#include <unistd.h> // for close -#include <stdlib.h> - -#define MAX_BUFFER 1024 -#define NUM_THREADS 1 - -int cfd, i, flags, ret; -struct sockaddr_in saddr; -struct sctp_sndrcvinfo sndrcvinfo; -struct sctp_event_subscribe events; -struct sctp_initmsg initmsg; -uint8_t buffer_send[MAX_BUFFER+1]; -uint8_t buffer_recv[MAX_BUFFER+1]; - -void f1ap_du_send_message(uint8_t *buffer_send, uint32_t length) -{ - /* Changing 9th character the character after # in the message buffer */ - //while (1) { - //buffer_send[0] = rand(); - sctp_sendmsg( cfd, (void *)buffer_send, length, - NULL, 0, htonl(62), 0, 1 /* stream */, 0, 0 ); - printf("C - Sent: "); - - int i_ret; - for (i_ret = 0; i_ret < length; i_ret++) { - printf("%x ", *(buffer_send+i_ret)); - } - - printf("\n"); - //} -} - -/* for test*/ -void *send_func(void *argument) -{ - /* Changing 9th character the character after # in the message buffer */ - while (1) { - buffer_send[0] = rand(); - sctp_sendmsg( cfd, (void *)buffer_send, (size_t)strlen(buffer_send), - NULL, 0, 0, 0, 1 /* stream */, 0, 0 ); - printf("C - Sent: %s\n", buffer_send); - } -} - -void *recv_func(void *argument) -{ - bzero( (void *)&buffer_recv, sizeof(buffer_recv) ); - - while(ret = sctp_recvmsg( cfd, (void *)buffer_recv, sizeof(buffer_recv), - (struct sockaddr *)NULL, 0, &sndrcvinfo, &flags )) { - - printf("C - Received following data on stream %d, data is: %s\n", - sndrcvinfo.sinfo_stream, buffer_recv); - } - close(cfd); - printf("C - close\n"); -} - -int sctp_du_init() -{ - pthread_t threads[NUM_THREADS]; - - char *ipadd; - ipadd = "127.0.0.1"; - printf("Use default ipaddress %s \n", ipadd); - - cfd = socket( AF_INET, SOCK_STREAM, IPPROTO_SCTP ); - - /* Specify that a maximum of 3 streams will be available per socket */ - memset( &initmsg, 0, sizeof(initmsg) ); - initmsg.sinit_num_ostreams = 3; - initmsg.sinit_max_instreams = 3; - initmsg.sinit_max_attempts = 2; - setsockopt( cfd, IPPROTO_SCTP, SCTP_INITMSG, - &initmsg, sizeof(initmsg) ); - - bzero( (void *)&saddr, sizeof(saddr) ); - saddr.sin_family = AF_INET; - inet_pton(AF_INET, ipadd, &saddr.sin_addr); - saddr.sin_port = htons(29008); - - int ret; - ret = connect( cfd, (struct sockaddr *)&saddr, sizeof(saddr) ); - if (ret == -1) { - printf("C - Not founded Server, close\n"); - return 0; - } - memset( (void *)&events, 0, sizeof(events) ); - events.sctp_data_io_event = 1; - setsockopt( cfd, SOL_SCTP, SCTP_EVENTS, - (const void *)&events, sizeof(events) ); - - /* Sending three messages on different streams */ - // send message - //pthread_create(&threads[0], NULL, send_func, (void *)0); - - pthread_create(&threads[0], NULL, recv_func, (void *)0); - - return 0; -} \ No newline at end of file diff --git a/openair2/F1AP/sctp_du.h b/openair2/F1AP/sctp_du.h deleted file mode 100644 index b8f2dc0635..0000000000 --- a/openair2/F1AP/sctp_du.h +++ /dev/null @@ -1,42 +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 sctp_du.h - * \brief sctp server procedures for F1AP - * \author Robert Schmidt - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: robert.schmidt@eurecom.fr - * \note - * \warning - */ - -#ifndef SCTP_DU_H_ -#define SCTP_DU_H_ - -//void f1ap_du_send_message(uint8_t *buffer_send, uint32_t length); -//void *send_func(void *argument); -//void *recv_func(void *argument); -int sctp_du_init(void); - - -#endif /* SCTP_DU_H_ */ diff --git a/openair2/F1AP/test_f1ap_cu.c b/openair2/F1AP/test_f1ap_cu.c deleted file mode 100644 index 544d787cf8..0000000000 --- a/openair2/F1AP/test_f1ap_cu.c +++ /dev/null @@ -1,11 +0,0 @@ - -/* Test */ -void CU_handle_F1_SETUP_REQUEST(void); -/**/ - -int main(void) { - /* Test */ - F1AP_CU_task(); - //CU_handle_F1_SETUP_REQUEST(); - return 0; -} diff --git a/openair2/F1AP/test_f1ap_du.c b/openair2/F1AP/test_f1ap_du.c deleted file mode 100644 index 78ae552a88..0000000000 --- a/openair2/F1AP/test_f1ap_du.c +++ /dev/null @@ -1,5 +0,0 @@ - -int main(void) { - F1AP_DU_task(); - return 0; -} -- GitLab From a1439effe3261b0556ae53c3cb17f1bd0f30e544 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 8 Sep 2018 15:21:47 +0200 Subject: [PATCH 042/308] Revert "Restructure create_tasks(): start tasks depending on RAN type, is read in RCconfig_RRC()" This reverts commit 87093e1b553ed2aebccb1c773507201497f8c2ad. --- cmake_targets/CMakeLists.txt | 3 + targets/COMMON/create_tasks.c | 103 ++++++++++++++++++++++++++++++ targets/COMMON/create_tasks.h | 33 ++++++++++ targets/COMMON/create_tasks_ue.c | 3 +- targets/RT/USER/lte-softmodem.c | 2 + targets/RT/USER/lte-softmodem.h | 3 - targets/RT/USER/lte-uesoftmodem.c | 1 + 7 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 targets/COMMON/create_tasks.c create mode 100644 targets/COMMON/create_tasks.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 7ef66a8014..5457768998 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2049,6 +2049,7 @@ add_executable(lte-softmodem ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c + ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c @@ -2089,6 +2090,7 @@ add_executable(lte-softmodem-nos1 ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c + ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c @@ -2128,6 +2130,7 @@ add_executable(lte-uesoftmodem ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/rfsim.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c + ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c new file mode 100644 index 0000000000..391e448deb --- /dev/null +++ b/targets/COMMON/create_tasks.c @@ -0,0 +1,103 @@ +/* + * 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 + */ + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +# include "create_tasks.h" +# include "log.h" + +# ifdef OPENAIR2 +# if defined(ENABLE_USE_MME) +# include "sctp_eNB_task.h" +# include "s1ap_eNB.h" +# include "nas_ue_task.h" +# include "udp_eNB_task.h" +# include "gtpv1u_eNB_task.h" +# endif +# if ENABLE_RAL +# include "lteRALue.h" +# include "lteRALenb.h" +# endif +# include "RRC/LTE/rrc_defs.h" +# endif +# include "enb_app.h" + +extern int emulate_rf; + +int create_tasks(uint32_t enb_nb) +{ + LOG_D(ENB_APP, "%s(enb_nb:%d\n", __FUNCTION__, enb_nb); + + itti_wait_ready(1); + if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) { + LOG_E(PDCP, "Create task for L2L1 failed\n"); + return -1; + } + + if (enb_nb > 0) { + /* Last task to create, others task must be ready before its start */ + if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) { + LOG_E(ENB_APP, "Create task for eNB APP failed\n"); + return -1; + } + } + +# if defined(ENABLE_USE_MME) + if (enb_nb > 0) { + if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { + LOG_E(SCTP, "Create task for SCTP failed\n"); + return -1; + } + + if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) { + LOG_E(S1AP, "Create task for S1AP failed\n"); + return -1; + } + if(!emulate_rf){ + if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { + LOG_E(UDP_, "Create task for UDP failed\n"); + return -1; + } + } + + if (itti_create_task (TASK_GTPV1_U, >pv1u_eNB_task, NULL) < 0) { + LOG_E(GTPU, "Create task for GTPV1U failed\n"); + return -1; + } + } + +# endif + + if (enb_nb > 0) { + LOG_I(RRC,"Creating RRC eNB Task\n"); + + if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { + LOG_E(RRC, "Create task for RRC eNB failed\n"); + return -1; + } + } + + + itti_wait_ready(0); + + return 0; +} +#endif diff --git a/targets/COMMON/create_tasks.h b/targets/COMMON/create_tasks.h new file mode 100644 index 0000000000..ff1d9ace51 --- /dev/null +++ b/targets/COMMON/create_tasks.h @@ -0,0 +1,33 @@ +/* + * 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 + */ + +#ifndef CREATE_TASKS_H_ +#define CREATE_TASKS_H_ + +#if defined(ENABLE_ITTI) +/* External declaration of L2L1 task that depend on the target */ +extern void *l2l1_task(void *arg); + +int create_tasks(uint32_t enb_nb); +int create_tasks_ue(uint32_t ue_nb); +#endif + +#endif /* CREATE_TASKS_H_ */ diff --git a/targets/COMMON/create_tasks_ue.c b/targets/COMMON/create_tasks_ue.c index 6cf5ce78e8..7e7d545c9f 100644 --- a/targets/COMMON/create_tasks_ue.c +++ b/targets/COMMON/create_tasks_ue.c @@ -21,6 +21,7 @@ #if defined(ENABLE_ITTI) # include "intertask_interface.h" +# include "create_tasks.h" # include "log.h" # ifdef OPENAIR2 @@ -76,4 +77,4 @@ int create_tasks_ue(uint32_t ue_nb) return 0; } -#endif +#endif \ No newline at end of file diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index da114515e8..43a5cf9ee4 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -84,6 +84,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #if defined(ENABLE_ITTI) #include "intertask_interface_init.h" +#include "create_tasks.h" #endif #include "PHY/INIT/phy_init.h" @@ -1074,6 +1075,7 @@ int main( int argc, char **argv ) LOG_E(RRC, "Create task for RRC eNB failed\n"); return -1; } + printf("ITTI tasks created\n"); have_rrc=1; if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) { LOG_E(SCTP, "Create task for SCTP failed\n"); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 22090c0625..2f8209f2d3 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -289,7 +289,4 @@ extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag); -extern void *eNB_app_task(void* args); -extern void *sctp_eNB_task(void *args); - #endif diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index e9456f9700..a2a12f9dd9 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -85,6 +85,7 @@ #if defined(ENABLE_ITTI) #include "intertask_interface_init.h" +#include "create_tasks.h" #endif #include "system.h" -- GitLab From 5a74b790a226a64424c773ee3e1bcd6f3358a03b Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 8 Sep 2018 18:55:30 +0200 Subject: [PATCH 043/308] Restructure code, CMakeLists fixes - move the configuration reading code before task creation - fix CMakeLists.txt so that lte-softmodem-nos1 compiles --- cmake_targets/CMakeLists.txt | 2 +- openair2/ENB_APP/enb_app.c | 109 +------------------------------ openair2/ENB_APP/enb_config.c | 48 ++++++++++++-- openair2/ENB_APP/enb_config.h | 5 +- openair2/F1AP/CU_F1AP.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 14 ++-- openair2/RRC/LTE/rrc_proto.h | 3 +- targets/COMMON/create_tasks.c | 112 ++++++++++++++++++++------------ targets/RT/USER/lte-softmodem.c | 73 ++++++--------------- 9 files changed, 142 insertions(+), 226 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 5457768998..e7da79dda0 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2106,7 +2106,7 @@ add_executable(lte-softmodem-nos1 ) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} + RRC_LIB F1AP F1AP_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7 NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl ) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index c120e79496..077265b246 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -43,15 +43,8 @@ # if defined(ENABLE_USE_MME) # define ENB_REGISTER_RETRY_DELAY 10 # include "s1ap_eNB.h" -# include "sctp_eNB_task.h" -# include "gtpv1u_eNB_task.h" -# include "nas_ue_task.h" -# include "udp_eNB_task.h" # endif -extern void *F1AP_CU_task(void *); -extern void *F1AP_DU_task(void *); - #if defined(FLEXRAN_AGENT_SB_IF) # include "flexran_agent.h" #endif @@ -60,72 +53,11 @@ extern void *F1AP_DU_task(void *); extern unsigned char NB_eNB_INST; #endif -extern int emulate_rf; extern RAN_CONTEXT_t RC; -extern void *l2l1_task(void *arg); +extern int emulate_rf; #if defined(ENABLE_ITTI) -/*------------------------------------------------------------------------------*/ -static void create_remaining_tasks(module_id_t enb_id) -{ - ngran_node_t type = RC.rrc[enb_id]->node_type; - int rc; - itti_wait_ready(1); - switch (type) { - case ngran_eNB_CU: - case ngran_ng_eNB_CU: - case ngran_gNB_CU: - rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, enb_id); - AssertFatal(rc >= 0, "Create task for CU F1AP failed\n"); - /* fall through */ - case ngran_eNB: - case ngran_ng_eNB: - case ngran_gNB: - rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for S1AP failed\n"); - if (!emulate_rf){ - rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for UDP failed\n"); - } - rc = itti_create_task(TASK_GTPV1_U, >pv1u_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); - break; - default: - /* intentionally left blank */ - break; - } - switch (type) { - case ngran_eNB_DU: - case ngran_gNB_DU: - rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL); - AssertFatal(rc >= 0, "Create task for DU F1AP failed\n"); - /* fall through */ - case ngran_eNB: - case ngran_ng_eNB: - case ngran_gNB: - rc = itti_create_task (TASK_L2L1, l2l1_task, NULL); - AssertFatal(rc >= 0, "Create task for L2L1 failed\n"); - break; - default: - /* intentioally left blank */ - break; - } - itti_wait_ready(0); -} - -/*------------------------------------------------------------------------------*/ -static void configure_rrc(uint32_t enb_id, MessageDef **msg_p) -{ - RC.rrc[enb_id] = malloc(sizeof(eNB_RRC_INST)); - AssertFatal(RC.rrc[enb_id], "RRC context for eNB %d not allocated\n", enb_id); - LOG_I(ENB_APP, "%s() Creating RRC instance RC.rrc[%d]: %p\n", - __FUNCTION__, enb_id, RC.rrc[enb_id]); - memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); - *msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); - RCconfig_RRC(*msg_p, enb_id, RC.rrc[enb_id]); -} - /*------------------------------------------------------------------------------*/ # if defined(ENABLE_USE_MME) static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, uint32_t enb_id_end)//, const Enb_properties_array_t *enb_properties) @@ -185,49 +117,10 @@ void *eNB_app_task(void *args_p) MessageDef *msg_p = NULL; instance_t instance; int result; - MessageDef *rrc_msg_p[enb_nb]; /* for no gcc warnings */ (void)instance; - int mac_has_f1[MAX_MAC_INST]; - memset(mac_has_f1,0,MAX_MAC_INST*sizeof(int)); itti_mark_task_ready (TASK_ENB_APP); - LOG_I(PHY, "%s() Task ready, initialise L1/MAC/RRC structures\n", __FUNCTION__); - - RCconfig_L1(); - - RCconfig_macrlc(mac_has_f1); - - LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst); - - LOG_I(PHY, "%s() RC.nb_macrlc_inst:%d\n", __FUNCTION__, RC.nb_macrlc_inst); - - if (RC.nb_L1_inst>0) - AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n"); - if (RC.nb_macrlc_inst>0) - AssertFatal(RC.nb_macrlc_inst == enb_id_end-enb_id_start, - "Number of MACRLC instances %d != number of RRC instances %d\n", - RC.nb_macrlc_inst, enb_id_end-enb_id_start); - - LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst); - RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *)); - LOG_I(ENB_APP, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc); - - for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { - configure_rrc(enb_id, &rrc_msg_p[enb_id]); - - if (RC.nb_macrlc_inst > 0 && mac_has_f1[enb_id]==1) - RC.rrc[enb_id]->node_type = ngran_eNB_DU; - else - pdcp_layer_init(); - } - - create_remaining_tasks(0); - - for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { - LOG_I(ENB_APP,"Sending configuration message to RRC task\n"); - itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), rrc_msg_p[enb_id]); - } # if defined(ENABLE_USE_MME) /* Try to register each eNB */ diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 41ac60cc0b..dcad36dc71 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -333,7 +333,7 @@ void RCconfig_L1(void) { } } -void RCconfig_macrlc(int *mac_has_f1) { +void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) { int j; @@ -371,7 +371,7 @@ void RCconfig_macrlc(int *mac_has_f1) { RC.mac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr); RC.mac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);; RC.mac[j]->eth_params_n.transp_preference = ETH_UDP_MODE; - mac_has_f1[j] = 1; + macrlc_has_f1[j] = 1; } else { // other midhaul AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr)); } @@ -541,7 +541,7 @@ cudu_params_t *get_cudu_config() return &(RC.cudu); } -int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { +int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { int num_enbs = 0; @@ -708,6 +708,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { char* osa_log_verbosity = NULL; */ + MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_CONFIGURATION_REQ); // for no gcc warnings (void)my_int; @@ -786,7 +787,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) { paramdef_t SCTPParams[] = SCTPPARAMS_DESC; - paramdef_t NETParams[] = NETPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,i,ENB_CONFIG_STRING_SCTP_CONFIG); @@ -2308,6 +2308,12 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { } } } + +#if defined (ENABLE_ITTI) + memcpy(&RC.rrc[i]->configuration, &RRC_CONFIGURATION_REQ(msg_p), + sizeof(RRC_CONFIGURATION_REQ(msg_p))); +#endif + } return 0; } @@ -2380,7 +2386,6 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) { paramdef_t SCTPParams[] = SCTPPARAMS_DESC; - paramdef_t NETParams[] = NETPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); @@ -2959,3 +2964,36 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { } } } + +void read_config_and_init() +{ + int macrlc_has_f1[MAX_MAC_INST]; + memset(macrlc_has_f1, 0 , MAX_MAC_INST*sizeof(int)); + + if (RC.nb_macrlc_inst > 0) + AssertFatal(RC.nb_macrlc_inst == RC.nb_inst, + "Number of MACRLC instances %d != number of RRC instances %d\n", + RC.nb_macrlc_inst, RC.nb_inst); + + RCconfig_L1(); + LOG_I(PHY, "%s() RC.nb_L1_inst: %d\n", __FUNCTION__, RC.nb_L1_inst); + + RCconfig_macrlc(macrlc_has_f1); + LOG_I(MAC, "%s() RC.nb_macrlc_inst: %d\n", __FUNCTION__, RC.nb_macrlc_inst); + + if (RC.nb_L1_inst > 0) + AssertFatal(l1_north_init_eNB() == 0, "could not initialize L1 north interface\n"); + + RC.rrc = malloc(RC.nb_inst * sizeof(eNB_RRC_INST *)); + AssertFatal(RC.rrc, "could not allocate memory for RC.rrc\n"); + for (uint32_t enb_id = 0; enb_id < RC.nb_inst; enb_id++) { + RC.rrc[enb_id] = malloc(sizeof(eNB_RRC_INST)); + AssertFatal(RC.rrc[enb_id], "RRC context for eNB %d not allocated\n", enb_id); + memset((void *)RC.rrc[enb_id], 0, sizeof(eNB_RRC_INST)); + RCconfig_RRC(enb_id, RC.rrc[enb_id]); + if (macrlc_has_f1[enb_id]) RC.rrc[enb_id]->node_type = ngran_eNB_DU; + } + + if (RC.nb_macrlc_inst == 0) + pdcp_layer_init(); +} diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 33076c6e3f..0dc934dfda 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -135,7 +135,7 @@ typedef struct ru_config_s { extern void RCconfig_RU(void); extern void RCconfig_flexran(void); extern void RCconfig_L1(void); -extern void RCconfig_macrlc(int*); +extern void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]); extern void UE_config_stub_pnf(void); extern int RCconfig_gtpu(void ); extern void RCConfig(void); @@ -143,13 +143,14 @@ extern void RCConfig(void); void enb_config_display(void); void ru_config_display(void); -int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc); +int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc); int RCconfig_S1(MessageDef *msg_p, uint32_t i); int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i); int RCconfig_CU_F1(uint32_t i); void RCconfig_cudu(void); cudu_params_t *get_cudu_config(void); +void read_config_and_init(void); #endif /* ENB_CONFIG_H_ */ /** @} */ diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index c92bdb0240..0e3b4ba14f 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -135,7 +135,7 @@ void *F1AP_CU_task(void *arg) { itti_mark_task_ready(TASK_CU_F1); - CU_send_sctp_init_req(arg); + CU_send_sctp_init_req(0); while (1) { itti_receive_msg(TASK_CU_F1, &received_msg); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 124e573d95..8b06950292 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5923,8 +5923,7 @@ void setup_ngran_CU(eNB_RRC_INST *rrc) { //----------------------------------------------------------------------------- char openair_rrc_eNB_configuration( - const module_id_t enb_mod_idP, - RrcConfigurationReq* configuration + const module_id_t enb_mod_idP ) #else char @@ -5950,9 +5949,6 @@ openair_rrc_eNB_init( #endif AssertFatal(RC.rrc[enb_mod_idP] != NULL, "RC.rrc not initialized!"); AssertFatal(MAX_MOBILES_PER_ENB < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); -#ifdef ENABLE_ITTI - AssertFatal(configuration!=NULL,"configuration input is null\n"); -#endif // for (j = 0; j < MAX_MOBILES_PER_ENB; j++) // RC.rrc[ctxt.module_id].Info.UE[j].Status = RRC_IDLE; //CH_READY; // @@ -5987,8 +5983,6 @@ openair_rrc_eNB_init( RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (MAX_MOBILES_PER_ENB * 2, NULL, NULL); RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (MAX_MOBILES_PER_ENB * 2, NULL, NULL); - memcpy(&RC.rrc[ctxt.module_id]->configuration,configuration,sizeof(RrcConfigurationReq)); - /// System Information INIT LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n", @@ -6038,7 +6032,7 @@ openair_rrc_eNB_init( init_SI(&ctxt, CC_id #if defined(ENABLE_ITTI) - , configuration + , &RC.rrc[enb_mod_idP]->configuration #endif ); for (int ue_id = 0; ue_id < MAX_MOBILES_PER_ENB; ue_id++) { @@ -7616,8 +7610,8 @@ rrc_enb_task( /* Messages from eNB app */ case RRC_CONFIGURATION_REQ: - LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p,&RRC_CONFIGURATION_REQ(msg_p)); - openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); + LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p)); + openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance)); break; default: diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index 4e8ee304c1..7934d96cb1 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -42,8 +42,7 @@ void openair_rrc_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_a #if defined(ENABLE_ITTI) char openair_rrc_eNB_configuration( - const module_id_t enb_mod_idP, - RrcConfigurationReq* configuration + const module_id_t enb_mod_idP ); #endif char openair_rrc_eNB_init( diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 391e448deb..03b13c879c 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -23,81 +23,107 @@ # include "intertask_interface.h" # include "create_tasks.h" # include "log.h" +# include "common/ran_context.h" # ifdef OPENAIR2 # if defined(ENABLE_USE_MME) -# include "sctp_eNB_task.h" # include "s1ap_eNB.h" # include "nas_ue_task.h" # include "udp_eNB_task.h" # include "gtpv1u_eNB_task.h" # endif -# if ENABLE_RAL -# include "lteRALue.h" -# include "lteRALenb.h" -# endif # include "RRC/LTE/rrc_defs.h" # endif +# include "sctp_eNB_task.h" +# include "cu_f1ap_task.h" +# include "du_f1ap_task.h" # include "enb_app.h" +extern RAN_CONTEXT_t RC; extern int emulate_rf; int create_tasks(uint32_t enb_nb) { - LOG_D(ENB_APP, "%s(enb_nb:%d\n", __FUNCTION__, enb_nb); + ngran_node_t type = RC.rrc[0]->node_type; + int rc; itti_wait_ready(1); - if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) { - LOG_E(PDCP, "Create task for L2L1 failed\n"); - return -1; - } if (enb_nb > 0) { - /* Last task to create, others task must be ready before its start */ + LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n"); if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) { LOG_E(ENB_APP, "Create task for eNB APP failed\n"); return -1; } + LOG_I(RRC,"Creating RRC eNB Task\n"); + if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { + LOG_E(RRC, "Create task for RRC eNB failed\n"); + return -1; + } } -# if defined(ENABLE_USE_MME) - if (enb_nb > 0) { - if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { - LOG_E(SCTP, "Create task for SCTP failed\n"); - return -1; - } - - if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) { - LOG_E(S1AP, "Create task for S1AP failed\n"); - return -1; - } - if(!emulate_rf){ - if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { - LOG_E(UDP_, "Create task for UDP failed\n"); - return -1; - } - } - - if (itti_create_task (TASK_GTPV1_U, >pv1u_eNB_task, NULL) < 0) { - LOG_E(GTPU, "Create task for GTPV1U failed\n"); - return -1; - } - } - -# endif + if (enb_nb > 0) { + /* this task needs not be started if: + * * there is no CU/DU split + * * ENABLE_USE_MME is not defined + * Since we cannot express this condition on both configuration and + * compilation defines, we always start this task. + */ + if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) { + LOG_E(SCTP, "Create task for SCTP failed\n"); + return -1; + } + } + switch (type) { + case ngran_eNB_CU: + case ngran_ng_eNB_CU: + case ngran_gNB_CU: if (enb_nb > 0) { - LOG_I(RRC,"Creating RRC eNB Task\n"); - - if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { - LOG_E(RRC, "Create task for RRC eNB failed\n"); - return -1; + rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL); + AssertFatal(rc >= 0, "Create task for CU F1AP failed\n"); + } + /* fall through */ + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: +#if defined(ENABLE_USE_MME) + if (enb_nb > 0) { + rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for S1AP failed\n"); + if (!emulate_rf){ + rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for UDP failed\n"); } + rc = itti_create_task(TASK_GTPV1_U, >pv1u_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); } - +#endif + break; + default: + /* intentionally left blank */ + break; + } + switch (type) { + case ngran_eNB_DU: + case ngran_gNB_DU: + if (enb_nb > 0) { + rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL); + AssertFatal(rc >= 0, "Create task for DU F1AP failed\n"); + } + /* fall through */ + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: + rc = itti_create_task (TASK_L2L1, l2l1_task, NULL); + AssertFatal(rc >= 0, "Create task for L2L1 failed\n"); + break; + default: + /* intentioally left blank */ + break; + } itti_wait_ready(0); - return 0; } #endif diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 43a5cf9ee4..3b51f2c712 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1058,69 +1058,33 @@ int main( int argc, char **argv ) LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity); #endif + /* Start the agent. If it is turned off in the configuration, it won't start */ + RCconfig_flexran(); + for (i = 0; i < RC.nb_inst; i++) { + flexran_agent_start(i); + } - - - int have_rrc=0; - if (RC.nb_inst > 0) { - itti_wait_ready(1); - LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n"); - if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) { - LOG_E(ENB_APP, "Create task for eNB APP failed\n"); - return -1; - } - LOG_I(RRC,"Creating RRC eNB Task\n"); - if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { - LOG_E(RRC, "Create task for RRC eNB failed\n"); - return -1; + read_config_and_init(); + + if (create_tasks(1) < 0) { + printf("cannot create ITTI tasks\n"); + exit(-1); } - printf("ITTI tasks created\n"); - have_rrc=1; - if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) { - LOG_E(SCTP, "Create task for SCTP failed\n"); - return -1; + + for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++) { + MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); + itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); } - itti_wait_ready(0); } else { printf("No ITTI, Initializing L1\n"); RCconfig_L1(); } - - /* Start the agent. If it is turned off in the configuration, it won't start */ - RCconfig_flexran(); - for (i = 0; i < RC.nb_L1_inst; i++) { - flexran_agent_start(i); - } - - int cu_flag =0; - - if (have_rrc == 1) { - - // wait for RRC to be initialized - - - int rrc_allocated; - do { - rrc_allocated=1; - for (int i=0;i<RC.nb_inst;i++) - if (RC.rrc == NULL || RC.rrc[i]==NULL) rrc_allocated=0; - if (rrc_allocated==0) { printf("Waiting for RRC allocation ...\n"); usleep(10000); } - } while (rrc_allocated==0); - - int cell_info_configured; - do { - pthread_mutex_lock(&RC.rrc[0]->cell_info_mutex); - cell_info_configured = RC.rrc[0]->cell_info_configured; - pthread_mutex_unlock(&RC.rrc[0]->cell_info_mutex); - if (cell_info_configured == 0) {printf ("Waiting for RRC cell configuration\n"); usleep(10000);} - } while(cell_info_configured == 0); - if (RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU) cu_flag=1; - } - - if (cu_flag == 0) { + /* start threads if only L1 or not a CU */ + if (RC.nb_inst == 0 || + !(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { // init UE_PF_PO and mutex lock pthread_mutex_init(&ue_pf_po_mutex, NULL); memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs); @@ -1285,7 +1249,8 @@ int main( int argc, char **argv ) // stop threads - if (cu_flag == 0) { + if (RC.nb_inst == 0 || + !(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { int UE_id; #ifdef XFORMS printf("waiting for XFORMS thread\n"); -- GitLab From c1249842d68755dffc7e78663fe2b925d37ab224 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 8 Sep 2018 18:58:27 +0200 Subject: [PATCH 044/308] Initialize netlink when node_type is known --- targets/RT/USER/lte-softmodem.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 3b51f2c712..86f1d92c26 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -986,16 +986,6 @@ int main( int argc, char **argv ) LOG_E(OPT,"failed to run OPT \n"); } - if (RC.rrc[0]->node_type != ngran_eNB_DU) { -#ifdef PDCP_USE_NETLINK - printf("PDCP netlink\n"); - netlink_init(); -#if defined(PDCP_USE_NETLINK_QUEUES) - pdcp_netlink_init(); -#endif -#endif - } - #if !defined(ENABLE_ITTI) // to make a graceful exit when ctrl-c is pressed signal(SIGSEGV, signal_handler); @@ -1076,6 +1066,16 @@ int main( int argc, char **argv ) MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); } + + if (RC.rrc[0]->node_type != ngran_eNB_DU) { +#ifdef PDCP_USE_NETLINK + printf("PDCP netlink\n"); + netlink_init(); +#if defined(PDCP_USE_NETLINK_QUEUES) + pdcp_netlink_init(); +#endif +#endif + } } else { printf("No ITTI, Initializing L1\n"); -- GitLab From 0fe608c292c6f4527f4532ffca63faa13a2d76c1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 9 Sep 2018 16:00:19 +0200 Subject: [PATCH 045/308] Add TERMIATE_MESSAGE to DU/CU tasks, add warning/trace IDs --- common/utils/T/T_messages.txt | 30 ++++++++++++++++++++++++------ openair2/F1AP/CU_F1AP.c | 5 +++++ openair2/F1AP/DU_F1AP.c | 5 +++++ 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 8887bb4110..7e6bae7ed0 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -868,46 +868,64 @@ ID = LEGACY_F1U_ERROR GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_ERROR:LEGACY FORMAT = string,log +ID = LEGACY_F1AP_TRACE + DESC = F1AP TRACE LEVEL + GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_TRACE:LEGACY + FORMAT = string,log ID = LEGACY_F1AP_DEBUG DESC = F1AP DEBUG LEVEL GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_DEBUG:LEGACY FORMAT = string,log - ID = LEGACY_F1AP_INFO DESC = F1AP INFO LEVEL GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_INFO:LEGACY FORMAT = string,log - +ID = LEGACY_F1AP_WARNING + DESC = F1AP WARNING LEVEL + GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log ID = LEGACY_F1AP_ERROR DESC = F1AP ERROR LEVEL GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_ERROR:LEGACY FORMAT = string,log +ID = LEGACY_CU_F1AP_TRACE + DESC = CU_F1AP TRACE LEVEL + GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_TRACE:LEGACY + FORMAT = string,log ID = LEGACY_CU_F1AP_DEBUG DESC = CU_F1AP DEBUG LEVEL GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_DEBUG:LEGACY FORMAT = string,log - ID = LEGACY_CU_F1AP_INFO DESC = CU_F1AP INFO LEVEL GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_INFO:LEGACY FORMAT = string,log - +ID = LEGACY_CU_F1AP_WARNING + DESC = CU_F1AP WARNING LEVEL + GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log ID = LEGACY_CU_F1AP_ERROR DESC = CU_F1AP ERROR LEVEL GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_ERROR:LEGACY FORMAT = string,log +ID = LEGACY_DU_F1AP_TRACE + DESC = DU_F1AP TRACE LEVEL + GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_TRACE:LEGACY + FORMAT = string,log ID = LEGACY_DU_F1AP_DEBUG DESC = DU_F1AP DEBUG LEVEL GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_DEBUG:LEGACY FORMAT = string,log - ID = LEGACY_DU_F1AP_INFO DESC = DU_F1AP INFO LEVEL GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_INFO:LEGACY FORMAT = string,log - +ID = LEGACY_DU_F1AP_WARNING + DESC = DU_F1AP WARNING LEVEL + GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log ID = LEGACY_DU_F1AP_ERROR DESC = DU_F1AP ERROR LEVEL GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_ERROR:LEGACY diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c index 0e3b4ba14f..337f411c5b 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/CU_F1AP.c @@ -163,6 +163,11 @@ void *F1AP_CU_task(void *arg) { CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; + case TERMINATE_MESSAGE: + LOG_W(CU_F1AP, " *** Exiting CU_F1AP thread\n"); + itti_exit_task(); + break; + default: LOG_E(CU_F1AP, "CU Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c index ad6d4ec3cb..229d594f8d 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/DU_F1AP.c @@ -148,6 +148,11 @@ void *F1AP_DU_task(void *arg) { DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; + case TERMINATE_MESSAGE: + LOG_W(DU_F1AP, " *** Exiting DU_F1AP thread\n"); + itti_exit_task(); + break; + default: LOG_E(DU_F1AP, "DU Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); -- GitLab From ab412cb39d7cd887706f65d2a37406cb8ea627ff Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Mon, 10 Sep 2018 13:39:48 +0200 Subject: [PATCH 046/308] Normalization of the file names for CU and DU --- .gitignore | 2 +- cmake_targets/CMakeLists.txt | 4 +- .../lte_noS1_build_oai/CMakeLists.template | 9 --- .../oaisim_build_oai/CMakeLists.template | 60 ------------------ .../oaisim_mme_build_oai/CMakeLists.template | 62 ------------------ .../oaisim_noS1_build_oai/CMakeLists.template | 63 ------------------- openair2/COMMON/f1ap_messages_types.h | 2 + openair2/ENB_APP/enb_app.c | 2 +- openair2/ENB_APP/enb_config.c | 2 + openair2/F1AP/{CU_F1AP.c => f1ap_cu.c} | 7 ++- .../F1AP/{cu_f1ap_defs.h => f1ap_cu_defs.h} | 0 .../F1AP/{cu_f1ap_task.h => f1ap_cu_task.h} | 0 openair2/F1AP/f1ap_decoder.c | 57 ++++++----------- openair2/F1AP/{DU_F1AP.c => f1ap_du.c} | 9 ++- openair2/F1AP/{du_f1ap_defs.h => f1ap_du.h} | 0 openair2/F1AP/f1ap_du_defs.h | 63 +++++++++++++++++++ .../F1AP/{du_f1ap_task.h => f1ap_du_task.h} | 0 openair2/F1AP/f1ap_handlers.c | 16 ++++- targets/COMMON/create_tasks.c | 4 +- 19 files changed, 117 insertions(+), 245 deletions(-) delete mode 100644 cmake_targets/lte_noS1_build_oai/CMakeLists.template delete mode 100644 cmake_targets/oaisim_build_oai/CMakeLists.template delete mode 100644 cmake_targets/oaisim_mme_build_oai/CMakeLists.template delete mode 100644 cmake_targets/oaisim_noS1_build_oai/CMakeLists.template rename openair2/F1AP/{CU_F1AP.c => f1ap_cu.c} (99%) rename openair2/F1AP/{cu_f1ap_defs.h => f1ap_cu_defs.h} (100%) rename openair2/F1AP/{cu_f1ap_task.h => f1ap_cu_task.h} (100%) rename openair2/F1AP/{DU_F1AP.c => f1ap_du.c} (99%) rename openair2/F1AP/{du_f1ap_defs.h => f1ap_du.h} (100%) create mode 100644 openair2/F1AP/f1ap_du_defs.h rename openair2/F1AP/{du_f1ap_task.h => f1ap_du_task.h} (100%) diff --git a/.gitignore b/.gitignore index 35696f4cbf..0051125185 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ # log and exec file log/ -lte_build_oai/ +*build_oai/ targets/bin/ diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e7da79dda0..172e11bf7d 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -530,8 +530,8 @@ message(${F1AP_C_DIR}) message(${F1AP_DIR}) add_library(F1AP - ${F1AP_DIR}/DU_F1AP.c - ${F1AP_DIR}/CU_F1AP.c + ${F1AP_DIR}/f1ap_du.c + ${F1AP_DIR}/f1ap_cu.c ${F1AP_DIR}/f1ap_itti_messaging.c ${F1AP_DIR}/f1ap_encoder.c ${F1AP_DIR}/f1ap_decoder.c diff --git a/cmake_targets/lte_noS1_build_oai/CMakeLists.template b/cmake_targets/lte_noS1_build_oai/CMakeLists.template deleted file mode 100644 index c8fc68da52..0000000000 --- a/cmake_targets/lte_noS1_build_oai/CMakeLists.template +++ /dev/null @@ -1,9 +0,0 @@ -set(ENABLE_ITTI True) -set(ENABLE_USE_MME False) -set(PDCP_USE_NETLINK True) -set(LINK_ENB_PDCP_TO_IP_DRIVER True) -set(LINK_ENB_PDCP_TO_GTPV1U False) -set(PDCP_USE_NETLINK_QUEUES False) -set(LINUX True) -set(SECU False) -set(NAS_UE False) diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template deleted file mode 100644 index 22faac75b5..0000000000 --- a/cmake_targets/oaisim_build_oai/CMakeLists.template +++ /dev/null @@ -1,60 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) -set ( DEBUG_OMG False ) -set ( DISABLE_XER_PRINT False ) -set ( DRIVER2013 True ) -set ( ENABLE_ITTI True ) -set ( ENABLE_NAS_UE_LOGGING True ) -set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_RAL False ) -set ( ENABLE_SECURITY True ) -set ( ENABLE_STANDALONE_EPC False) -set ( ENABLE_USE_CPU_EXECUTION_TIME True ) -set ( ENABLE_USE_MME True ) -set ( ENABLE_USE_RAW_SOCKET_FOR_SGI True) -set ( ENABLE_VCD_FIFO False ) -set ( ENB_MODE True ) -set ( EXMIMO_IOT True ) -set ( JUMBO_FRAME True ) -set ( LARGE_SCALE False ) -set ( LINK_ENB_PDCP_TO_GTPV1U True) -set ( LINUX_LIST False ) -set ( LINUX True ) -set ( LOCALIZATION False ) -set ( LOG_NO_THREAD True ) -set ( DEADLINE_SCHEDULER False ) -set ( MAC_CONTEXT 1 ) -set ( MAX_NUM_CCs 1 ) -set ( MESSAGE_CHART_GENERATOR False) -set ( MSG_PRINT False ) -set ( MU_RECEIVER False ) -set ( NAS_ADDRESS_FIX False ) -set ( NAS_BUILT_IN_UE True) -set ( NAS_MME False ) -set ( NAS_UE True ) -set ( NB_ANTENNAS_RX "2" ) -set ( NB_ANTENNAS_TX "2" ) -set ( NO_RRM True ) -set ( OAISIM True ) -set ( OAI_NW_DRIVER_TYPE_ETHERNET False ) -set ( OAI_NW_DRIVER_USE_NETLINK True ) -set ( OPENAIR2 True ) -set ( OPENAIR_LTE True ) -set ( PACKAGE_NAME "oaisim" ) -set ( PDCP_USE_NETLINK True ) -set ( PDCP_MSG_PRINT False ) -set ( PHY_CONTEXT False ) -set ( PHY_EMUL False ) -set ( PHYSIM True ) -set ( RF_BOARD "False" ) -set ( RLC_STOP_ON_LOST_PDU False ) -set ( RRC_ASN1_VERSION "Rel10" ) -set ( RRC_DEFAULT_RAB_IS_AM True) -set ( RRC_MSG_PRINT False ) -set ( SECU False ) -set ( SMBV False ) -set ( TEST_OMG False ) -set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) -set ( USE_MME "R10" ) -set ( XER_PRINT False ) diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template deleted file mode 100644 index b18b23ee9a..0000000000 --- a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) -set ( DEBUG_OMG False ) -set ( DISABLE_XER_PRINT False ) -set ( DRIVER2013 False ) -set ( ENABLE_ITTI True ) -set ( ENABLE_NAS_UE_LOGGING False ) -set ( ENABLE_NEW_MULTICAST False ) -set ( ENABLE_RAL False ) -set ( ENABLE_SECURITY False ) -set ( ENABLE_STANDALONE_EPC False ) -set ( ENABLE_USE_CPU_EXECUTION_TIME False ) -set ( ENABLE_USE_MME False ) -set ( ENABLE_USE_RAW_SOCKET_FOR_SGI True) -set ( ENABLE_VCD_FIFO False ) -set ( ENB_MODE False ) -set ( EPC_BUILD True ) -set ( EXMIMO_IOT False ) -set ( JUMBO_FRAME False ) -set ( LARGE_SCALE False ) -set ( LINK_ENB_PDCP_TO_GTPV1U True) -set ( LINUX_LIST False ) -set ( LINUX False ) -set ( LOCALIZATION False ) -set ( LOG_NO_THREAD False ) -set ( DEADLINE_SCHEDULER False ) -set ( MAC_CONTEXT 1 ) -set ( MAX_NUM_CCs 1 ) -set ( MSG_PRINT False ) -set ( MU_RECEIVER False ) -set ( NAS_ADDRESS_FIX False ) -set ( NAS_BUILT_IN_EPC True ) -set ( NAS_MME True ) -set ( NAS_NETLINK False ) -set ( NAS_UE False ) -set ( NB_ANTENNAS_RX "2" ) -set ( NB_ANTENNAS_TX "2" ) -set ( NO_RRM False ) -set ( OAISIM False ) -set ( OAI_NW_DRIVER_TYPE_ETHERNET False ) -set ( OAI_NW_DRIVER_USE_NETLINK False ) -set ( OPENAIR2 False ) -set ( OPENAIR_LTE False ) -set ( PACKAGE_NAME "EPC" ) -set ( PDCP_MSG_PRINT False ) -set ( PHY_CONTEXT False ) -set ( PHY_EMUL False ) -set ( PHYSIM False ) -set ( RF_BOARD "False" ) -set ( RRC_ASN1_VERSION "Rel10" ) -set ( RLC_STOP_ON_LOST_PDU False ) -set ( RRC_MSG_PRINT False ) -set ( SECU False ) -set ( SMBV False ) -set ( TEST_OMG False ) -set ( UPDATE_RELEASE_9 True) -set ( UPDATE_RELEASE_10 True) -set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) -set ( USE_MME "R10" ) -set ( XER_PRINT False ) -set ( XFORMS False ) diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template deleted file mode 100644 index bc416cff55..0000000000 --- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template +++ /dev/null @@ -1,63 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set ( DEBUG_OMG False ) -set ( DISABLE_XER_PRINT False ) -set ( DRIVER2013 True ) -set ( ENABLE_ITTI True ) -set ( ENABLE_NAS_UE_LOGGING False ) -set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_RAL False ) -set ( ENABLE_SECURITY False ) -set ( ENABLE_STANDALONE_EPC False) -set ( ENABLE_USE_CPU_EXECUTION_TIME True ) -set ( ENABLE_USE_MME False ) -set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False) -set ( ENABLE_VCD_FIFO False ) -set ( ENB_MODE True ) -set ( EXMIMO_IOT True ) -set ( JUMBO_FRAME True ) -set ( LARGE_SCALE False ) -set ( LINK_ENB_PDCP_TO_GTPV1U False) -set ( LINUX_LIST False ) -set ( LINUX True ) -set ( LOCALIZATION False ) -set ( LOG_NO_THREAD 1 ) -set ( DEADLINE_SCHEDULER False ) -set ( MAC_CONTEXT 1 ) -set ( MAX_NUM_CCs 1 ) -set ( MESSAGE_CHART_GENERATOR False ) -set ( MESSAGE_CHART_GENERATOR_RLC_MAC False ) -set ( MESSAGE_CHART_GENERATOR_PHY False ) -set ( MSG_PRINT False ) -set ( MU_RECEIVER False ) -set ( NAS_ADDRESS_FIX False ) -set ( NAS_BUILT_IN_UE False) -set ( NAS_MME False ) -set ( NAS_UE False ) -set ( NB_ANTENNAS_RX "2" ) -set ( NB_ANTENNAS_TX "2" ) -set ( NO_RRM True ) -set ( OAISIM True ) -set ( OAI_NW_DRIVER_TYPE_ETHERNET False ) -set ( OAI_NW_DRIVER_USE_NETLINK True ) -set ( OPENAIR2 True ) -set ( OPENAIR_LTE True ) -set ( PACKAGE_NAME "oaisim" ) -set ( PDCP_USE_NETLINK True ) -set ( PDCP_MSG_PRINT False ) -set ( PHY_CONTEXT False ) -set ( PHY_EMUL False ) -set ( PHYSIM True ) -set ( RF_BOARD "False" ) -set ( RRC_ASN1_VERSION "Rel10" ) -set ( RLC_STOP_ON_LOST_PDU False ) -set ( RRC_MSG_PRINT False ) -set ( SECU False ) -set ( SMBV False ) -set ( TEST_OMG False ) -set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) -set ( USE_MME "R10" ) -set ( XER_PRINT False ) -set ( DEBUG_PHY False ) -set ( DEBUG_PHY_PROC False) -set ( DEBUG_DLSCH False) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 6fa58425fd..15b6ba2650 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -103,6 +103,8 @@ typedef struct f1ap_setup_req_s { uint16_t num_ssi[F1AP_MAX_NB_CELLS]; uint8_t sst[F1AP_MAX_NB_CELLS][16]; uint8_t sd[F1AP_MAX_NB_CELLS][16]; + // tdd_flag = 0 means FDD, 1 means TDD + int tdd_flag; union { struct { diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 077265b246..37cdf06ed2 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -195,7 +195,7 @@ void *eNB_app_task(void *args_p) break; case F1AP_SETUP_RESP: - AssertFatal(RC.rrc[0]->node_type == ngran_eNB_DU, "Should not have received F1AP_REGISTER_ENB_CNF\n"); + AssertFatal(RC.rrc[0]->node_type == ngran_eNB_DU, "Should not have received F1AP_REGISTER_ENB_CNF in CU/eNB\n"); LOG_I(ENB_APP, "[eNB %d] Received %s: associated ngran_eNB_CU %s with %d cells to activate\n", instance, ITTI_MSG_NAME (msg_p), F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index dcad36dc71..93a49cca2e 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2453,6 +2453,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { if (rrc->carrier[0].sib1->tdd_Config) { LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); + F1AP_SETUP_REQ (msg_p).tdd_flag = 1; F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, rrc->carrier[0].dl_CarrierFreq); // For LTE use scs field to carry prefix type and number of antennas @@ -2466,6 +2467,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { } else { LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); + F1AP_SETUP_REQ (msg_p).tdd_flag = 0; F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, rrc->carrier[0].dl_CarrierFreq); diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/f1ap_cu.c similarity index 99% rename from openair2/F1AP/CU_F1AP.c rename to openair2/F1AP/f1ap_cu.c index 337f411c5b..7c2c644104 100644 --- a/openair2/F1AP/CU_F1AP.c +++ b/openair2/F1AP/f1ap_cu.c @@ -32,10 +32,10 @@ #include "conversions.h" #include "f1ap_common.h" -#include "cu_f1ap_defs.h" +#include "f1ap_cu_defs.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" -#include "cu_f1ap_task.h" +#include "f1ap_cu_task.h" #include "platform_types.h" #include "common/utils/LOG/log.h" #include "intertask_interface.h" @@ -148,18 +148,21 @@ void *F1AP_CU_task(void *arg) { case SCTP_NEW_ASSOCIATION_IND: LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND\n"); + LOG_I(DU_F1AP, "--------------3--------------\n"); CU_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_NEW_ASSOCIATION_RESP: LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); + LOG_I(DU_F1AP, "--------------4--------------\n"); CU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: LOG_I(CU_F1AP, "SCTP_DATA_IND\n"); + LOG_I(DU_F1AP, "--------------5--------------\n"); CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; diff --git a/openair2/F1AP/cu_f1ap_defs.h b/openair2/F1AP/f1ap_cu_defs.h similarity index 100% rename from openair2/F1AP/cu_f1ap_defs.h rename to openair2/F1AP/f1ap_cu_defs.h diff --git a/openair2/F1AP/cu_f1ap_task.h b/openair2/F1AP/f1ap_cu_task.h similarity index 100% rename from openair2/F1AP/cu_f1ap_task.h rename to openair2/F1AP/f1ap_cu_task.h diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 3be1013b41..a18ad270f4 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -39,7 +39,7 @@ #include "f1ap_common.h" #include "f1ap_decoder.h" -static int f1ap_eNB_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) +static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) { MessageDef *message_p; MessagesIds message_id; @@ -76,28 +76,17 @@ static int f1ap_eNB_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) return 0; } -static int f1ap_eNB_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) +static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) { - MessageDef *message_p; - MessagesIds message_id; - asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; DevAssert(pdu != NULL); switch(pdu->choice.successfulOutcome->procedureCode) { - // case F1AP_ProcedureCode_id_F1Setup: - // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - // message_id = F1AP_F1_SETUP_LOG; - // message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); - // message_p->ittiMsg.f1ap_s1_setup_log.size = res.result.encoded; - // memcpy(&message_p->ittiMsg.f1ap_s1_setup_log.text, res.buffer, res.result.encoded); - // itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - // free(res.buffer); - // break; + case F1AP_ProcedureCode_id_F1Setup: + LOG_I(F1AP, "get F1AP_ProcedureCode_id_F1Setup\n"); + break; default: - // F1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n", - // (int)pdu->choice.successfulOutcome->procedureCode); - printf("Unknown procedure ID (%d) for successfull outcome message\n", + LOG_E(F1AP,"Unknown procedure ID (%d) for successfull outcome message\n", (int)pdu->choice.successfulOutcome->procedureCode); return -1; } @@ -105,28 +94,19 @@ static int f1ap_eNB_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) return 0; } -static int f1ap_eNB_decode_unsuccessful_outcome(F1AP_F1AP_PDU_t *pdu) +static int f1ap_decode_unsuccessful_outcome(F1AP_F1AP_PDU_t *pdu) { - MessageDef *message_p; - MessagesIds message_id; - asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; DevAssert(pdu != NULL); switch(pdu->choice.unsuccessfulOutcome->procedureCode) { - // case F1AP_ProcedureCode_id_F1Setup: - // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - // message_id = F1AP_F1_SETUP_LOG; - // message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); - // message_p->ittiMsg.f1ap_f1_setup_log.size = res.result.encoded; - // memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, res.buffer, res.result.encoded); - // itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - // free(res.buffer); - // break; + case F1AP_ProcedureCode_id_F1Setup: + LOG_I(F1AP, "get F1AP_ProcedureCode_id_F1Setup\n"); + break; default: // F1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n", // (int)pdu->choice.unsuccessfulOutcome->procedureCode); - printf("Unknown procedure ID (%d) for unsuccessfull outcome message\n", + LOG_E(F1AP, "Unknown procedure ID (%d) for unsuccessfull outcome message\n", (int)pdu->choice.unsuccessfulOutcome->procedureCode); return -1; } @@ -148,27 +128,26 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t 0, 0); - //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p); + //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + //LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code); if (dec_ret.code != RC_OK) { - //F1AP_ERROR("Failed to decode pdu\n"); - printf("Failed to decode pdu\n"); + LOG_E(F1AP, "Failed to decode pdu\n"); return -1; } switch(pdu->present) { case F1AP_F1AP_PDU_PR_initiatingMessage: - return f1ap_eNB_decode_initiating_message(pdu); + return f1ap_decode_initiating_message(pdu); case F1AP_F1AP_PDU_PR_successfulOutcome: - return f1ap_eNB_decode_successful_outcome(pdu); + return f1ap_decode_successful_outcome(pdu); case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: - return f1ap_eNB_decode_unsuccessful_outcome(pdu); + return f1ap_decode_unsuccessful_outcome(pdu); default: - //F1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu->present); - printf("Unknown presence (%d) or not implemented\n", (int)pdu->present); + LOG_D(F1AP, "Unknown presence (%d) or not implemented\n", (int)pdu->present); break; } diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/f1ap_du.c similarity index 99% rename from openair2/F1AP/DU_F1AP.c rename to openair2/F1AP/f1ap_du.c index 229d594f8d..978a0356cf 100644 --- a/openair2/F1AP/DU_F1AP.c +++ b/openair2/F1AP/f1ap_du.c @@ -32,10 +32,10 @@ #include "conversions.h" #include "f1ap_common.h" -#include "du_f1ap_defs.h" +#include "f1ap_du_defs.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" -#include "du_f1ap_task.h" +#include "f1ap_du_task.h" #include "platform_types.h" #include "common/utils/LOG/log.h" #include "intertask_interface.h" @@ -130,6 +130,7 @@ void *F1AP_DU_task(void *arg) { // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n"); + LOG_I(DU_F1AP, "--------------0--------------\n"); DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg)); break; @@ -138,6 +139,7 @@ void *F1AP_DU_task(void *arg) { // 1. store the respon // 2. send the f1setup_req LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); + LOG_I(DU_F1AP, "--------------1--------------\n"); DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; @@ -145,6 +147,7 @@ void *F1AP_DU_task(void *arg) { case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); + LOG_I(DU_F1AP, "--------------2--------------\n"); DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; @@ -464,7 +467,7 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - "1", + "1",//f1ap_setup_req->mib, sizeof("1")); OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 diff --git a/openair2/F1AP/du_f1ap_defs.h b/openair2/F1AP/f1ap_du.h similarity index 100% rename from openair2/F1AP/du_f1ap_defs.h rename to openair2/F1AP/f1ap_du.h diff --git a/openair2/F1AP/f1ap_du_defs.h b/openair2/F1AP/f1ap_du_defs.h new file mode 100644 index 0000000000..a93591106f --- /dev/null +++ b/openair2/F1AP/f1ap_du_defs.h @@ -0,0 +1,63 @@ +/* + * 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 + */ + +#include <stdint.h> + +#include "queue.h" +#include "tree.h" + +#include "sctp_eNB_defs.h" + +#ifndef DU_F1AP_DEFS_H_ +#define DU_F1AP_DEFS_H_ + +struct du_f1ap_instance_s; +typedef struct du_f1ap_instance_s { + /* Next f1ap du association. + * Only used for virtual mode. + */ + + /* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */ + instance_t instance; + + // F1_Setup_Req payload + uint32_t gNB_DU_id; + char *gNB_DU_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; + + /* Tracking area code */ + uint16_t tac; + + /* Mobile Country Code + * Mobile Network Code + */ + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + +} du_f1ap_instance_t; + +#endif /* DU_F1AP_DEFS_H_ */ diff --git a/openair2/F1AP/du_f1ap_task.h b/openair2/F1AP/f1ap_du_task.h similarity index 100% rename from openair2/F1AP/du_f1ap_task.h rename to openair2/F1AP/f1ap_du_task.h diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 4501975d7a..b083629748 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -52,13 +52,17 @@ int f1ap_handle_f1_setup_request(uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +static +int f1ap_handle_f1_setup_response(uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* Handlers matrix. Only f1 related procedure present here */ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* Reset */ - { f1ap_handle_f1_setup_request, 0, 0 }, /* F1Setup */ + { f1ap_handle_f1_setup_request, f1ap_handle_f1_setup_response, 0 }, /* F1Setup */ { 0, 0, 0 }, /* ErrorIndication */ { f1ap_handle_f1_setup_request, 0, 0 }, /* gNBDUConfigurationUpdate */ { f1ap_handle_f1_setup_request, 0, 0 }, /* gNBCUConfigurationUpdate */ @@ -151,3 +155,13 @@ int f1ap_handle_f1_setup_request(uint32_t assoc_id, return 0; } + +static +int f1ap_handle_f1_setup_response(uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ + printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); + + return 0; +} diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 03b13c879c..49b078dede 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -35,8 +35,8 @@ # include "RRC/LTE/rrc_defs.h" # endif # include "sctp_eNB_task.h" -# include "cu_f1ap_task.h" -# include "du_f1ap_task.h" +# include "f1ap_cu_task.h" +# include "f1ap_du_task.h" # include "enb_app.h" extern RAN_CONTEXT_t RC; -- GitLab From 7732b49a348a19b489afd3d6c348bc71edf11e54 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Mon, 10 Sep 2018 16:20:54 +0200 Subject: [PATCH 047/308] Ignore config x2, if we are in F1 procedure --- openair2/ENB_APP/enb_app.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index f01c734bc3..2f86d38fa6 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -170,8 +170,9 @@ void *eNB_app_task(void *args_p) /* 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); - + if (RC.rrc[0]->node_type == ngran_eNB) { // CU or DU do not need + x2_register_enb_pending = eNB_app_register_x2 (enb_id_start, enb_id_end); + } do { // Wait for a message itti_receive_msg (TASK_ENB_APP, &msg_p); -- GitLab From 66fc1bbd42aff856514f2b324c127d78c8d9141d Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Tue, 11 Sep 2018 17:25:42 +0200 Subject: [PATCH 048/308] added F1/RRC interfaces for CU handling of F1Setup procedure note: doesn't compile yet. --- openair2/COMMON/f1ap_messages_def.h | 6 +- openair2/COMMON/f1ap_messages_types.h | 2 +- openair2/ENB_APP/enb_config.c | 15 ++-- openair2/F1AP/f1ap_cu.c | 4 +- openair2/F1AP/f1ap_du.c | 2 +- openair2/RRC/LTE/rrc_defs.h | 4 + openair2/RRC/LTE/rrc_eNB.c | 102 ++++++++++++++++++++++++++ 7 files changed, 125 insertions(+), 10 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 149bf1ece0..65b41872bd 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -22,10 +22,10 @@ /* F1AP -> SCTP */ MESSAGE_DEF(F1AP_CU_SCTP_REQ , MESSAGE_PRIORITY_MED, f1ap_cu_setup_req_t , f1ap_cu_setup_req) -/* eNB application layer -> F1AP messages */ +/* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/ MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req) -/* F1AP -> eNB application layer messages */ +/* F1AP -> eNB_DU or eNB_CU_RRC -> F1AP application layer messages */ MESSAGE_DEF(F1AP_SETUP_RESP , MESSAGE_PRIORITY_MED, f1ap_setup_resp_t , f1ap_setup_resp) MESSAGE_DEF(F1AP_SETUP_FAILURE , MESSAGE_PRIORITY_MED, f1ap_setup_failure_t , f1ap_setup_failure) @@ -41,3 +41,5 @@ MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req ) + + diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 15b6ba2650..d7da511353 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -82,7 +82,7 @@ typedef struct f1ap_setup_req_s { enum cell_type_e cell_type; /// number of DU cells available - uint16_t num_cells_available; //0< num_cells_to_available <= 512; + uint16_t num_cells_available; //0< num_cells_available <= 512; // Served Cell Information /* Tracking area code */ diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 1d9a088144..c3236ca4ca 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -774,11 +774,11 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,i,ENB_CONFIG_STRING_SCTP_CONFIG); config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); - int gNB_CU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); - LOG_I(ENB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,gNB_CU_id); + rrc->node_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); + LOG_I(ENB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,rrc->node_id); - char *gNB_CU_name = *(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr); - LOG_I(ENB_APP,"F1AP: gNB_CU_name[%d] %s\n",k,gNB_CU_name); + rrc->node_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr); + LOG_I(ENB_APP,"F1AP: gNB_CU_name[%d] %s\n",k,rrc->node_name); rrc->eth_params_s.local_if_name = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_IF_NAME_IDX].strptr)); LOG_I(RRC,"Configuring CU-DU interfaces for MACRLC on %s\n",rrc->eth_params_s.local_if_name); @@ -2363,13 +2363,18 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { // Output a list of all eNBs. config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL); AssertFatal(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr != NULL, - "eNB id %d is not defined in configuration file\n",i); + "eNB id %d is not defined in configuration file\n",i); + + F1AP_SETUP_REQ (msg_p).num_available_cells = 0; + for (k=0; k <num_enbs ; k++) { if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) { paramdef_t SCTPParams[] = SCTPPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + F1AP_SETUP_REQ (msg_p).num_available_cells++; + F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); diff --git a/openair2/F1AP/f1ap_cu.c b/openair2/F1AP/f1ap_cu.c index 7c2c644104..7ab5739b15 100644 --- a/openair2/F1AP/f1ap_cu.c +++ b/openair2/F1AP/f1ap_cu.c @@ -208,7 +208,9 @@ void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { } /* decode */ //CU_F1AP_decode(args_p); - + // fill in f1ap_setup_req message for RRC task + + /* handle */ // send successful callback diff --git a/openair2/F1AP/f1ap_du.c b/openair2/F1AP/f1ap_du.c index 978a0356cf..ff77379167 100644 --- a/openair2/F1AP/f1ap_du.c +++ b/openair2/F1AP/f1ap_du.c @@ -64,7 +64,7 @@ typedef struct f1ap_info { uint16_t in_streams; uint16_t out_streams; - /* Connexion id used between SCTP/S1AP */ + /* Connexion id used between SCTP/F1AP */ uint16_t cnx_id; /* SCTP association id */ diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index ae3dd3402d..968f2fb942 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -642,7 +642,9 @@ typedef struct { uint32_t ul_CarrierFreq; uint32_t pbch_repetition; BCCH_BCH_Message_t mib; + BCCH_BCH_Message_t *mib_DU; BCCH_DL_SCH_Message_t siblock1; + BCCH_DL_SCH_Message_t *siblock1_DU; BCCH_DL_SCH_Message_t systemInformation; // SystemInformation_t systemInformation; SystemInformationBlockType1_t *sib1; @@ -679,6 +681,8 @@ typedef struct eNB_RRC_INST_s { /// southbound midhaul configuration ngran_node_t node_type; eth_params_t eth_params_s; + char *node_name; + uint32_t node_id; rrc_eNB_carrier_data_t carrier[MAX_NUM_CCs]; uid_allocator_t uid_allocator; // for rrc_ue_head RB_HEAD(rrc_ue_tree_s, rrc_eNB_ue_context_s) rrc_ue_head; // ue_context tree key search by rnti diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 8dcff3bf57..f9c47a5edb 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7274,7 +7274,100 @@ void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(ctxt_pP, ue_context_pP, 0); } +void handle_f1_setup_request(f1ap_setup_req_t *f1_setup_req) { + + f1ap_setup_resp_t *f1_setup_resp=NULL; + + LOG_I(RRC,"Received F1 Setup Request from gNB_DU %d (%s)\n",f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name); + + uint16_t num_cells_to_activate = 0; + + int cu_cell_ind=0; + + for (int i=0;i<f1_setup_req->num_cells_available;i++) { + // check that mcc/mnc match and grab MIB/SIB1 + int found_cell=0; + for (int j=0;j<RC.nb_inst;j++) { + eNB_RRC_INST *rrc = RC.rrc[j]; + if (rrc->mcc == f1_setup_req->mcc[i] && rrc->mnc == f1_setup_req->mnc[i]) { + rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]); + rrc->carrier[0].mib_length = f1_setup_req->mib_length[i]; + + memcpy((void*)rrc->carrier[0].MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]); + asn_dec_rval_t dec_rval = uper_decode_complete(NULL, + &asn_DEF_BCCH_BCH_Message, + (void **)&rrc->carrier[0].mib_DU, + f1_setup_req->mib[i], + f1_setup_req->mib_length[i]); + AssertFatal(dec_rval.code == RC_OK, + "[eNB_DU %"PRIu8"] Failed to decode BCCH_BCH_MESSAGE (%zu bits)\n", + j, + dec_rval.consumed ); + BCCH_BCH_Message_t *mib = rrc->carrier[0].mib; + BCCH_BCH_Message_t *mib_DU = rrc->carrier[0].mib_DU; + mib->message.dl_Bandwidth = mib_DU->message_dl_Bandwidth; + mib->message.phich_Config.phich_Resource = mib_DU->message.phich_Config.phich_Resource; + mib->message.phich_Config.phich_duration = mib_DU->message.phich_Config.phich_duration; + + rrc->carrier[0].SIB1 = malloc(f1_setup_req->sib1_length[i]); + rrc->carrier[0].sib1_length = f1_setup_req->sib1_length[i]; + memcpy((void*)rrc->carrier[0].SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]); + dec_rval = uper_decode_complete(NULL, + &asn_DEF_BCCH_DL_SCH_Message, + (void **)&rrc->carrier[0].siblock1_DU, + f1_setup_req->sib1[i], + f1_setup_req->sib1_length[i]); + AssertFatal(dec_rval.code == RC_OK, + "[eNB_DU %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", + j, + dec_rval.consumed ); + // Parse message and extract SystemInformationBlockType1 field + BCCH_DL_SCH_Message_t *bcch_message = rrc->carrier[0].siblock1_DU; + AssertFatal(bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1, + "bcch_message->message.present != BCCH_DL_SCH_MessageType_PR_c1\n"); + AssertFatal(bcch_message->message.choice.c1.present == BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1, + "bcch_message->message.choice.c1.present != BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); + rrc->carrier[0].sib1 = bcch_message->message.choice.c1.choice.systemInformationBlockType1; + rrc->carrier[0].physCellId = f1_setup_req->nrpci[i]; + // prepare F1_SETUP_RESPONSE + + if (msg_p == NULL) { + msg_p = itti_alloc_new_message (TASK_F1AP,F1AP_SETUP_RESP); + F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; + F1AP_SETUP_RESP (msg_p).gNB_CU_id = rrc->node_id; + } + F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->mcc; + F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->mnc; + F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->mnc_digit_length; + F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nrpci[i]; + int num_SI= 0; + if (rrc->SIB23) { + F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->SIB23; + F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->sizeof_SIB23; + num_SI++; + } + F1AP_SETUP_RESP (msg_p).num_SI = num_SI; + // send ITTI message to F1AP-CU task + itti_send_msg_to_task (TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(enb_id), f1_setup_resp); + cu_cell_ind++; + found_cell=1; + break; + } // setup_req mcc/mnc match rrc internal list element + }// for (int j=0;j<RC.nb_inst;j++) + if (found_cell==0) { + AssertFatal(1==0,"No cell found\n"); + /*msg_p = itti_alloc_new_message (TASK_F1AP,F1AP_SETUP_FAILURE); + F1AP_SETUP_RESP (msg_p).cause = rrc->node_name; + F1AP_SETUP_RESP (msg_p).time_to_wait = rrc->node_id; + F1AP_SETUP_RESP (msg_p).criticality_diagnostics = rrc->node_name;*/ + } + // handle other failure cases + }//for (int i=0;i<f1_setup_req->num_cells_available;i++) +} + + + // ignore 5GNR fields for now, just take MIB and SIB1 //----------------------------------------------------------------------------- void* rrc_enb_task( @@ -7427,7 +7520,16 @@ rrc_enb_task( LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p)); openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance)); break; + / * Messages from F1AP task */ + case F1AP_SETUP_REQUEST: + AssertFatal(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU, + "should not receive F1AP_SETUP_REQUEST if this isn't a CU!\n"); + LOG_I(RRC"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); + + + handle_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); + break; default: LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); break; -- GitLab From ac3db89ec158862f90f895731ac3728acba05aff Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 11 Sep 2018 17:53:16 +0200 Subject: [PATCH 049/308] Remove the dummy value in DU, and store the payload data in DU --- openair2/COMMON/f1ap_messages_types.h | 22 +- openair2/ENB_APP/enb_config.c | 7 +- openair2/F1AP/f1ap_cu.c | 17 +- openair2/F1AP/f1ap_cu_defs.h | 36 --- openair2/F1AP/f1ap_du.c | 328 +++++++++----------------- openair2/F1AP/f1ap_du.h | 37 --- openair2/F1AP/f1ap_du_defs.h | 36 --- openair2/F1AP/f1ap_encoder.c | 2 +- 8 files changed, 149 insertions(+), 336 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 15b6ba2650..a5a60014f1 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -66,6 +66,12 @@ typedef struct f1ap_setup_req_s { // Midhaul networking parameters + /* Connexion id used between SCTP/F1AP */ + uint16_t cnx_id; + + /* SCTP association id */ + int32_t assoc_id; + /* The eNB IP address to bind */ f1ap_net_ip_address_t CU_f1_ip_address; f1ap_net_ip_address_t DU_f1_ip_address; @@ -91,20 +97,20 @@ typedef struct f1ap_setup_req_s { /* Mobile Country Codes * Mobile Network Codes */ - uint16_t mcc[F1AP_MAX_NB_CELLS]; - uint16_t mnc[F1AP_MAX_NB_CELLS]; - uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS]; + uint16_t mcc[F1AP_MAX_NB_CELLS];//[6]; + uint16_t mnc[F1AP_MAX_NB_CELLS];//[6]; + uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS];//[6]; // NR Physical Cell Ids uint16_t nr_pci[F1AP_MAX_NB_CELLS]; // NR Cell Ids uint8_t nr_cellid[F1AP_MAX_NB_CELLS]; // Number of slide support items (max 16, could be increased to as much as 1024) - uint16_t num_ssi[F1AP_MAX_NB_CELLS]; - uint8_t sst[F1AP_MAX_NB_CELLS][16]; - uint8_t sd[F1AP_MAX_NB_CELLS][16]; - // tdd_flag = 0 means FDD, 1 means TDD - int tdd_flag; + uint16_t num_ssi[F1AP_MAX_NB_CELLS];//[6]; + uint8_t sst[F1AP_MAX_NB_CELLS];//[16][6]; + uint8_t sd[F1AP_MAX_NB_CELLS];//[16][6]; + // fdd_flag = 1 means FDD, 0 means TDD + int fdd_flag; union { struct { diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 1d9a088144..123e8c3262 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2432,10 +2432,12 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { F1AP_SETUP_REQ (msg_p).nr_pci[k] = rrc->carrier[0].physCellId; F1AP_SETUP_REQ (msg_p).nr_cellid[k] = 0; F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0; + + if (rrc->carrier[0].sib1->tdd_Config) { LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); - F1AP_SETUP_REQ (msg_p).tdd_flag = 1; + F1AP_SETUP_REQ (msg_p).fdd_flag = 0; F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, rrc->carrier[0].dl_CarrierFreq); // For LTE use scs field to carry prefix type and number of antennas @@ -2449,8 +2451,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { } else { LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); - F1AP_SETUP_REQ (msg_p).tdd_flag = 0; - + F1AP_SETUP_REQ (msg_p).fdd_flag = 1; F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn = freq_to_arfcn10(rrc->carrier[0].sib1->freqBandIndicator, rrc->carrier[0].dl_CarrierFreq); F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_arfcn = F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn; diff --git a/openair2/F1AP/f1ap_cu.c b/openair2/F1AP/f1ap_cu.c index 7c2c644104..e38d19a81a 100644 --- a/openair2/F1AP/f1ap_cu.c +++ b/openair2/F1AP/f1ap_cu.c @@ -49,6 +49,8 @@ #include "common/ran_context.h" extern RAN_CONTEXT_t RC; +static f1ap_setup_resp_t *f1ap_cu_data; + /* This structure describes association of a DU to a CU */ typedef struct f1ap_info { @@ -166,6 +168,14 @@ void *F1AP_CU_task(void *arg) { CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; +// case F1AP_SETUP_RESPONSE: // This is from RRC +// CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) +// break; + +// case F1AP_SETUP_FAILURE: // This is from RRC +// CU_send_F1_SETUP_FAILURE(instance, *f1ap_setup_ind, &(F1AP_SETUP_FAILURE) f1ap_setup_failure) +// break; + case TERMINATE_MESSAGE: LOG_W(CU_F1AP, " *** Exiting CU_F1AP thread\n"); itti_exit_task(); @@ -211,6 +221,11 @@ void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { /* handle */ + + // fill f1ap_setup_req_t + // send ITTI F1AP_SETUP_REQ to RRC + // return + // send successful callback //CU_send_F1_SETUP_RESPONSE(); // or failure callback @@ -218,7 +233,7 @@ void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { } -void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t *f1ap_setup_ind) { +void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t *f1ap_setup_ind, f1ap_setup_resp_t *f1ap_setup_resp) { //void CU_send_F1_SETUP_RESPONSE(F1AP_F1SetupResponse_t *F1SetupResponse) { //AssertFatal(1==0,"Not implemented yet\n"); diff --git a/openair2/F1AP/f1ap_cu_defs.h b/openair2/F1AP/f1ap_cu_defs.h index 0f8a1e8353..f569478367 100644 --- a/openair2/F1AP/f1ap_cu_defs.h +++ b/openair2/F1AP/f1ap_cu_defs.h @@ -19,45 +19,9 @@ * contact@openairinterface.org */ -#include <stdint.h> - -#include "queue.h" -#include "tree.h" - -#include "sctp_eNB_defs.h" #ifndef CU_F1AP_DEFS_H_ #define CU_F1AP_DEFS_H_ -struct cu_f1ap_instance_s; -typedef struct du_f1ap_instance_s { - /* Next f1ap du association. - * Only used for virtual mode. - */ - - /* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */ - instance_t instance; - - // F1_Setup_Req payload - uint32_t gNB_CU_id; - char *gNB_CU_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; - - /* Tracking area code */ - uint16_t tac; - - /* Mobile Country Code - * Mobile Network Code - */ - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - -} cu_f1ap_instance_t; #endif /* CU_F1AP_DEFS_H_ */ diff --git a/openair2/F1AP/f1ap_du.c b/openair2/F1AP/f1ap_du.c index 978a0356cf..3138a4b9ba 100644 --- a/openair2/F1AP/f1ap_du.c +++ b/openair2/F1AP/f1ap_du.c @@ -43,40 +43,9 @@ #include "T.h" -/* This structure describes association of a DU to a CU */ -typedef struct f1ap_info { +static f1ap_setup_req_t *f1ap_du_data; - module_id_t enb_mod_idP; - module_id_t cu_mod_idP; - - /* 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 GNB_DU_ID; - - /* This is the optional name provided by the MME */ - char *GNB_DU_Name; - f1ap_net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets - - - /* Number of input/ouput streams */ - uint16_t in_streams; - uint16_t out_streams; - - /* Connexion id used between SCTP/S1AP */ - uint16_t cnx_id; - - /* SCTP association id */ - int32_t assoc_id; - - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - -} f1ap_info_t; - -void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); +void DU_handle_sctp_association_resp(instance_t instance,sctp_new_association_resp_t *sctp_new_association_resp); uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { @@ -104,7 +73,6 @@ void DU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) void *F1AP_DU_task(void *arg) { //sctp_cu_init(); - MessageDef *received_msg = NULL; int result; @@ -141,7 +109,7 @@ void *F1AP_DU_task(void *arg) { LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); LOG_I(DU_F1AP, "--------------1--------------\n"); DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); + &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: @@ -172,81 +140,62 @@ void *F1AP_DU_task(void *arg) { // ============================================================================== -static void du_f1ap_register(du_f1ap_instance_t *instance_p, - f1ap_net_ip_address_t *remote_address, // CU - f1ap_net_ip_address_t *local_address, // DU - uint16_t in_streams, - uint16_t out_streams) -{ +void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { + DevAssert(f1ap_setup_req != NULL); + MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; message_p = itti_alloc_new_message(TASK_DU_F1, SCTP_NEW_ASSOCIATION_REQ); sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - sctp_new_association_req_p->ulp_cnx_id = instance_p->instance; + sctp_new_association_req_p->ulp_cnx_id = instance; sctp_new_association_req_p->port = F1AP_PORT_NUMBER; sctp_new_association_req_p->ppid = F1AP_SCTP_PPID; - sctp_new_association_req_p->in_streams = in_streams; - sctp_new_association_req_p->out_streams = out_streams; + sctp_new_association_req_p->in_streams = f1ap_setup_req->sctp_in_streams; + sctp_new_association_req_p->out_streams = f1ap_setup_req->sctp_out_streams; + // remote memcpy(&sctp_new_association_req_p->remote_address, - remote_address, - sizeof(*remote_address)); + &f1ap_setup_req->CU_f1_ip_address, + sizeof(f1ap_setup_req->CU_f1_ip_address)); + // local memcpy(&sctp_new_association_req_p->local_address, - local_address, - sizeof(*local_address)); + &f1ap_setup_req->DU_f1_ip_address, + sizeof(f1ap_setup_req->DU_f1_ip_address)); + + // store data + f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); + *f1ap_du_data = *f1ap_setup_req; - itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); + //du_f1ap_register_to_sctp + itti_send_msg_to_task(TASK_SCTP, instance, message_p); } -void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { - du_f1ap_instance_t *new_instance; - //uint8_t index; - - DevAssert(f1ap_setup_req != NULL); +void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { - /* Look if the provided instance already exists */ - //new_instance = s1ap_eNB_get_instance(instance); - - // @Todo - // if (new_instance != NULL) { - // /* Checks if it is a retry on the same eNB */ - // DevCheck(new_instance->gNB_DU_id == f1ap_setup_req->gNB_DU_id, new_instance->gNB_DU_id, f1ap_setup_req->gNB_DU_id, 0); - // DevCheck(new_instance->cell_type == f1ap_setup_req->cell_type, new_instance->cell_type, f1ap_setup_req->cell_type, 0); - // DevCheck(new_instance->tac == f1ap_setup_req->tac, new_instance->tac, f1ap_setup_req->tac, 0); - // DevCheck(new_instance->mcc == f1ap_setup_req->mcc, new_instance->mcc, f1ap_setup_req->mcc, 0); - // DevCheck(new_instance->mnc == f1ap_setup_req->mnc, new_instance->mnc, f1ap_setup_req->mnc, 0); - // DevCheck(new_instance->mnc_digit_length == f1ap_setup_req->mnc_digit_length, new_instance->mnc_digit_length, f1ap_setup_req->mnc_digit_length, 0); - // DevCheck(new_instance->default_drx == f1ap_setup_req->default_drx, new_instance->default_drx, f1ap_setup_req->default_drx, 0); - // } else { - new_instance = calloc(1, sizeof(du_f1ap_instance_t)); - DevAssert(new_instance != NULL); - - /* Copy usefull parameters */ - new_instance->instance = instance; - new_instance->gNB_DU_id = f1ap_setup_req->gNB_DU_id; - new_instance->gNB_DU_name = f1ap_setup_req->gNB_DU_name; - new_instance->tac = f1ap_setup_req->tac[0]; - new_instance->mcc = f1ap_setup_req->mcc[0]; - new_instance->mnc = f1ap_setup_req->mnc[0]; - new_instance->mnc_digit_length = f1ap_setup_req->mnc_digit_length; - - //} - - du_f1ap_register(new_instance, - &f1ap_setup_req->CU_f1_ip_address, // remote - &f1ap_setup_req->DU_f1_ip_address, // local - f1ap_setup_req->sctp_in_streams, - f1ap_setup_req->sctp_out_streams); + DevAssert(sctp_new_association_resp != NULL); -} + if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { + LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + sctp_new_association_resp->sctp_state, + instance, + sctp_new_association_resp->ulp_cnx_id); -void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { - DU_send_F1_SETUP_REQUEST(instance, sctp_new_association_resp); + //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); + return; // exit -1 for debugging + } + + // save the assoc id + f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; + f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; + f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; + + + DU_send_F1_SETUP_REQUEST(instance); } @@ -254,8 +203,7 @@ void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_r // SETUP REQUEST -//void DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { -void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t *f1ap_setup_req) { +void DU_send_F1_SETUP_REQUEST(instance_t instance) { module_id_t enb_mod_idP; module_id_t du_mod_idP; @@ -266,14 +214,7 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * uint8_t *buffer; uint32_t len; int i = 0; - - // for test - f1ap_info_t f1ap_info; - f1ap_info.GNB_DU_ID = 789; - f1ap_info.GNB_DU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 3; + int j = 0; /* Create */ /* 0. pdu Type */ @@ -300,18 +241,18 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID; - asn_int642INTEGER(&ie->value.choice.GNB_DU_ID, f1ap_info.GNB_DU_ID); + asn_int642INTEGER(&ie->value.choice.GNB_DU_ID, f1ap_du_data->gNB_DU_id); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + /* optional */ /* c3. GNB_DU_Name */ - if (f1ap_info.GNB_DU_Name != NULL) { + if (f1ap_du_data->gNB_DU_name != NULL) { ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name; - OCTET_STRING_fromBuf(&ie->value.choice.GNB_DU_Name, f1ap_info.GNB_DU_Name, - strlen(f1ap_info.GNB_DU_Name)); + OCTET_STRING_fromBuf(&ie->value.choice.GNB_DU_Name, f1ap_du_data->gNB_DU_name, + strlen(f1ap_du_data->gNB_DU_name)); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -322,8 +263,10 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; + int num_cells_available = f1ap_du_data->num_cells_available; + printf("num_cells_available = %d \n", num_cells_available); for (i=0; - i<1; + i<num_cells_available; i++) { /* mandatory */ /* 4.1 serverd cells item */ @@ -344,30 +287,25 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &nRCGI.pLMN_Identity); - - - //INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); - nRCGI.nRCellIdentity.buf = malloc((36+7)/8); - - nRCGI.nRCellIdentity.size = (36+7)/8; - nRCGI.nRCellIdentity.bits_unused = 4; - - nRCGI.nRCellIdentity.buf[0] = 123; - - //nRCGI.nRCellIdentity = 15; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = 321; // int 0..1007 + served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - "10", - 3); + f1ap_du_data->tac[i], + sizeof(f1ap_du_data->tac[i])); + + // OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + // "10", + // 3); /* - Configured_EPS_TAC */ - if(1){ + if(0){ served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, "2", @@ -375,30 +313,33 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * } /* - broadcast PLMNs */ - int maxnoofBPLMNS = 1; - for (i=0; - i<maxnoofBPLMNS; - i++) { + // RK: add the num_available_broadcast_PLMNs to the message + int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs; + printf("num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); + for (j=0; + j<num_available_broadcast_PLMNs; // num_available_broadcast_PLMNs + j++) { /* > PLMN BroadcastPLMNs Item */ F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &broadcastPLMNs_Item->pLMN_Identity); + //MCC_MNC_TO_PLMNID(208, 95, 2, &broadcastPLMNs_Item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); } // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; - - if ("FDD") { + //f1ap_du_data->fdd_flag = 1; + if (f1ap_du_data->fdd_flag) { // FDD nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); /* >>> UL NRFreqInfo */ - fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; + fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_arfcn; F1AP_FreqBandNrItem_t ul_freqBandNrItem; memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 888L; + ul_freqBandNrItem.freqBandIndicatorNr = 777L; F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); @@ -408,25 +349,25 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); /* >>> DL NRFreqInfo */ - fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; + fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_arfcn; F1AP_FreqBandNrItem_t dl_freqBandNrItem; memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 555L; + dl_freqBandNrItem.freqBandIndicatorNr = 777L; F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); /* >>> UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.ul_nrb; /* >>> DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.dl_nrb; nR_Mode_Info.choice.fDD = fDD_Info; } else { // TDD @@ -435,9 +376,10 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * /* > TDD >> TDD Info */ F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); /* >>> ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer + tDD_Info->nRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].tdd.nr_arfcn; // Integer F1AP_FreqBandNrItem_t nr_freqBandNrItem; memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + // RK: missing params nr_freqBandNrItem.freqBandIndicatorNr = 555L; F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; @@ -447,8 +389,8 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; - tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + tDD_Info->transmission_Bandwidth.nRSCS= f1ap_du_data->nr_mode_info[i].tdd.scs; + tDD_Info->transmission_Bandwidth.nRNRB= f1ap_du_data->nr_mode_info[i].tdd.nrb; nR_Mode_Info.choice.tDD = tDD_Info; } @@ -467,12 +409,20 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - "1",//f1ap_setup_req->mib, - sizeof("1")); + f1ap_du_data->mib[i],//f1ap_du_data->mib, + f1ap_du_data->mib_length[i]); OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - "1", - sizeof("1")); + f1ap_du_data->sib1[i], + f1ap_du_data->sib1_length[i]); + // OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + // "1",//f1ap_setup_req->mib, + // sizeof("1")); + + // OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + // "1", + // sizeof("1")); + gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; // /* ADD */ @@ -489,7 +439,7 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t * printf("Failed to encode F1 setup request\n"); } - du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); + du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); } @@ -510,27 +460,16 @@ void DU_handle_F1_SETUP_RESPONSE() { // SETUP FAILURE void DU_handle_F1_SETUP_FAILURE(struct F1AP_F1AP_PDU_t *pdu_p) { AssertFatal(1==0,"Not implemented yet\n"); - - //F1AP_F1SetupFailureIEs_t *f1_setup_failure_p; - //f1_setup_failure_p = &pdu_p.choice.unsuccessfulOutcome.value.choice.F1SetupFailureIEs.protocolIEs; - } - - void DU_send_ERROR_INDICATION(struct F1AP_F1AP_PDU_t *pdu_p) { AssertFatal(1==0,"Not implemented yet\n"); - - //F1AP_F1ErrorIndicationIEs_t *f1_error_indication_p; - //f1_error_indication_p = &pdu_p.choice.successfulOutcome.value.choice.F1ErrorIndicationIEs.protocolIEs; } - void DU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { AssertFatal(1==0,"Not implemented yet\n"); } - void DU_handle_RESET(F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -547,8 +486,6 @@ void DU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } -//void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -//void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER() { void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( module_id_t module_idP, int CC_idP, @@ -565,14 +502,6 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( uint8_t *buffer; uint32_t len; - // for test - f1ap_info_t f1ap_info; - f1ap_info.GNB_DU_ID = 789; - f1ap_info.GNB_DU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 3; - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -601,7 +530,7 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[0], f1ap_du_data->mnc[0], f1ap_du_data->mnc_digit_length[0], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); ie->value.choice.NRCGI = nRCGI; @@ -732,7 +661,7 @@ void DU_handle_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessage //void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { -void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP) { +void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP, f1ap_setup_req_t *f1ap_du_data) { F1AP_F1AP_PDU_t pdu; F1AP_GNBDUConfigurationUpdate_t *out; F1AP_GNBDUConfigurationUpdateIEs_t *ie; @@ -740,14 +669,8 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du uint8_t *buffer; uint32_t len; int i = 0; + int j = 0; - // for test - f1ap_info_t f1ap_info; - f1ap_info.GNB_DU_ID = 789; - f1ap_info.GNB_DU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 3; /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -775,9 +698,9 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Add_List; - for (i=0; - i<1; - i++) { + for (j=0; + j<1; + j++) { // F1AP_Served_Cells_To_Add_ItemIEs_t *served_cells_to_add_item_ies; served_cells_to_add_item_ies = (F1AP_Served_Cells_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Add_ItemIEs_t)); @@ -794,22 +717,12 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &nRCGI.pLMN_Identity); - - - //INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); - nRCGI.nRCellIdentity.buf = malloc((36+7)/8); - - nRCGI.nRCellIdentity.size = (36+7)/8; - nRCGI.nRCellIdentity.bits_unused = 4; - - nRCGI.nRCellIdentity.buf[0] = 123; - - //nRCGI.nRCellIdentity = 15; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = 321; // int 0..1007 + served_cell_information.nRPCI = 321L; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, @@ -832,7 +745,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* > PLMN BroadcastPLMNs Item */ F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &broadcastPLMNs_Item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); } @@ -957,7 +870,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* 3.1 oldNRCGI */ F1AP_NRCGI_t oldNRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); served_cells_to_modify_item.oldNRCGI = oldNRCGI; @@ -969,14 +882,13 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = 321; // int 0..1007 + served_cell_information.nRPCI = 321L; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, @@ -999,7 +911,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* > PLMN BroadcastPLMNs Item */ F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &broadcastPLMNs_Item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); } @@ -1124,7 +1036,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* 3.1 oldNRCGI */ F1AP_NRCGI_t oldNRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); served_cells_to_delete_item.oldNRCGI = oldNRCGI; @@ -1160,7 +1072,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* 3.1 oldNRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); active_cells_item.nRCGI = nRCGI; @@ -1224,12 +1136,6 @@ void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { uint32_t len; int i = 0; - f1ap_info_t f1ap_info; - f1ap_info.GNB_DU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 8; - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -1435,7 +1341,7 @@ void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { /* - nRCGI */ F1AP_NRCGI_t nRCGI; // issue here - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, &nRCGI.pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); // // INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); // nRCGI.nRCellIdentity.buf = malloc((36+7)/8); @@ -1529,12 +1435,6 @@ void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { uint32_t len; int i = 0; - f1ap_info_t f1ap_info; - f1ap_info.GNB_DU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 8; - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -1797,7 +1697,7 @@ void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { /* - sCell_ID */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); diff --git a/openair2/F1AP/f1ap_du.h b/openair2/F1AP/f1ap_du.h index a93591106f..ea2463662a 100644 --- a/openair2/F1AP/f1ap_du.h +++ b/openair2/F1AP/f1ap_du.h @@ -19,45 +19,8 @@ * contact@openairinterface.org */ -#include <stdint.h> - -#include "queue.h" -#include "tree.h" - -#include "sctp_eNB_defs.h" - #ifndef DU_F1AP_DEFS_H_ #define DU_F1AP_DEFS_H_ -struct du_f1ap_instance_s; -typedef struct du_f1ap_instance_s { - /* Next f1ap du association. - * Only used for virtual mode. - */ - - /* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */ - instance_t instance; - - // F1_Setup_Req payload - uint32_t gNB_DU_id; - char *gNB_DU_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; - - /* Tracking area code */ - uint16_t tac; - - /* Mobile Country Code - * Mobile Network Code - */ - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - -} du_f1ap_instance_t; #endif /* DU_F1AP_DEFS_H_ */ diff --git a/openair2/F1AP/f1ap_du_defs.h b/openair2/F1AP/f1ap_du_defs.h index a93591106f..e8f18b0c12 100644 --- a/openair2/F1AP/f1ap_du_defs.h +++ b/openair2/F1AP/f1ap_du_defs.h @@ -19,45 +19,9 @@ * contact@openairinterface.org */ -#include <stdint.h> - -#include "queue.h" -#include "tree.h" - -#include "sctp_eNB_defs.h" #ifndef DU_F1AP_DEFS_H_ #define DU_F1AP_DEFS_H_ -struct du_f1ap_instance_s; -typedef struct du_f1ap_instance_s { - /* Next f1ap du association. - * Only used for virtual mode. - */ - - /* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */ - instance_t instance; - - // F1_Setup_Req payload - uint32_t gNB_DU_id; - char *gNB_DU_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; - - /* Tracking area code */ - uint16_t tac; - - /* Mobile Country Code - * Mobile Network Code - */ - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - -} du_f1ap_instance_t; #endif /* DU_F1AP_DEFS_H_ */ diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index bc2304b656..c7c9ebf040 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -86,7 +86,7 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) DevAssert(buffer != NULL); DevAssert(length != NULL); - //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); if (encoded < 0) { -- GitLab From 00c0a3e5f8a2a2881645160faf64ec2eab94ca3e Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Tue, 11 Sep 2018 19:55:32 +0200 Subject: [PATCH 050/308] compiles now --- openair2/ENB_APP/enb_config.c | 6 ++--- openair2/RRC/LTE/rrc_eNB.c | 41 ++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index c3236ca4ca..82b1fd292d 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -777,7 +777,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { rrc->node_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); LOG_I(ENB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,rrc->node_id); - rrc->node_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr); + rrc->node_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr)); LOG_I(ENB_APP,"F1AP: gNB_CU_name[%d] %s\n",k,rrc->node_name); rrc->eth_params_s.local_if_name = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_IF_NAME_IDX].strptr)); @@ -2365,7 +2365,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { AssertFatal(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr != NULL, "eNB id %d is not defined in configuration file\n",i); - F1AP_SETUP_REQ (msg_p).num_available_cells = 0; + F1AP_SETUP_REQ (msg_p).num_cells_available = 0; for (k=0; k <num_enbs ; k++) { if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) { @@ -2373,7 +2373,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { paramdef_t SCTPParams[] = SCTPPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - F1AP_SETUP_REQ (msg_p).num_available_cells++; + F1AP_SETUP_REQ (msg_p).num_cells_available++; F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index f9c47a5edb..73553faf61 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7274,7 +7274,7 @@ void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(ctxt_pP, ue_context_pP, 0); } -void handle_f1_setup_request(f1ap_setup_req_t *f1_setup_req) { +void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { f1ap_setup_resp_t *f1_setup_resp=NULL; @@ -7284,6 +7284,8 @@ void handle_f1_setup_request(f1ap_setup_req_t *f1_setup_req) { uint16_t num_cells_to_activate = 0; int cu_cell_ind=0; + + MessageDef *msg_p; for (int i=0;i<f1_setup_req->num_cells_available;i++) { // check that mcc/mnc match and grab MIB/SIB1 @@ -7292,7 +7294,7 @@ void handle_f1_setup_request(f1ap_setup_req_t *f1_setup_req) { eNB_RRC_INST *rrc = RC.rrc[j]; if (rrc->mcc == f1_setup_req->mcc[i] && rrc->mnc == f1_setup_req->mnc[i]) { rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]); - rrc->carrier[0].mib_length = f1_setup_req->mib_length[i]; + rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i]; memcpy((void*)rrc->carrier[0].MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]); asn_dec_rval_t dec_rval = uper_decode_complete(NULL, @@ -7304,14 +7306,14 @@ void handle_f1_setup_request(f1ap_setup_req_t *f1_setup_req) { "[eNB_DU %"PRIu8"] Failed to decode BCCH_BCH_MESSAGE (%zu bits)\n", j, dec_rval.consumed ); - BCCH_BCH_Message_t *mib = rrc->carrier[0].mib; + BCCH_BCH_Message_t *mib = &rrc->carrier[0].mib; BCCH_BCH_Message_t *mib_DU = rrc->carrier[0].mib_DU; - mib->message.dl_Bandwidth = mib_DU->message_dl_Bandwidth; + mib->message.dl_Bandwidth = mib_DU->message.dl_Bandwidth; mib->message.phich_Config.phich_Resource = mib_DU->message.phich_Config.phich_Resource; - mib->message.phich_Config.phich_duration = mib_DU->message.phich_Config.phich_duration; + mib->message.phich_Config.phich_Duration = mib_DU->message.phich_Config.phich_Duration; rrc->carrier[0].SIB1 = malloc(f1_setup_req->sib1_length[i]); - rrc->carrier[0].sib1_length = f1_setup_req->sib1_length[i]; + rrc->carrier[0].sizeof_SIB1 = f1_setup_req->sib1_length[i]; memcpy((void*)rrc->carrier[0].SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]); dec_rval = uper_decode_complete(NULL, &asn_DEF_BCCH_DL_SCH_Message, @@ -7328,28 +7330,27 @@ void handle_f1_setup_request(f1ap_setup_req_t *f1_setup_req) { "bcch_message->message.present != BCCH_DL_SCH_MessageType_PR_c1\n"); AssertFatal(bcch_message->message.choice.c1.present == BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1, "bcch_message->message.choice.c1.present != BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); - rrc->carrier[0].sib1 = bcch_message->message.choice.c1.choice.systemInformationBlockType1; - rrc->carrier[0].physCellId = f1_setup_req->nrpci[i]; + rrc->carrier[0].sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1; + rrc->carrier[0].physCellId = f1_setup_req->nr_pci[i]; // prepare F1_SETUP_RESPONSE if (msg_p == NULL) { - msg_p = itti_alloc_new_message (TASK_F1AP,F1AP_SETUP_RESP); + msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_RESP); F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; - F1AP_SETUP_RESP (msg_p).gNB_CU_id = rrc->node_id; } F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->mcc; F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->mnc; F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->mnc_digit_length; - F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nrpci[i]; + F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i]; int num_SI= 0; - if (rrc->SIB23) { - F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->SIB23; - F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->sizeof_SIB23; + if (rrc->carrier[0].SIB23) { + F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23; + F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23; num_SI++; } - F1AP_SETUP_RESP (msg_p).num_SI = num_SI; + F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI; // send ITTI message to F1AP-CU task - itti_send_msg_to_task (TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(enb_id), f1_setup_resp); + itti_send_msg_to_task (TASK_CU_F1, ENB_MODULE_ID_TO_INSTANCE(j), (MessageDef*)f1_setup_resp); cu_cell_ind++; found_cell=1; break; @@ -7357,7 +7358,7 @@ void handle_f1_setup_request(f1ap_setup_req_t *f1_setup_req) { }// for (int j=0;j<RC.nb_inst;j++) if (found_cell==0) { AssertFatal(1==0,"No cell found\n"); - /*msg_p = itti_alloc_new_message (TASK_F1AP,F1AP_SETUP_FAILURE); + /*msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_FAILURE); F1AP_SETUP_RESP (msg_p).cause = rrc->node_name; F1AP_SETUP_RESP (msg_p).time_to_wait = rrc->node_id; F1AP_SETUP_RESP (msg_p).criticality_diagnostics = rrc->node_name;*/ @@ -7520,11 +7521,11 @@ rrc_enb_task( LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p)); openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance)); break; - / * Messages from F1AP task */ - case F1AP_SETUP_REQUEST: + /* Messages from F1AP task */ + case F1AP_SETUP_REQ: AssertFatal(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU, "should not receive F1AP_SETUP_REQUEST if this isn't a CU!\n"); - LOG_I(RRC"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); + LOG_I(RRC,"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); handle_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); -- GitLab From f1253ee7e95e7417bb497b1099f36755272a86a1 Mon Sep 17 00:00:00 2001 From: "Wolfgang A. Mozart" <mozart@eurecom.fr> Date: Wed, 12 Sep 2018 08:34:24 +0200 Subject: [PATCH 051/308] UE compiles now --- cmake_targets/CMakeLists.txt | 7 ++++++- cmake_targets/build_oai | 6 ++++++ openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 3 ++- openair2/LAYER2/RLC/rlc.c | 10 +++++++--- openair2/UTIL/MEM/mem_block.h | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 232693dd28..eb3c048039 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -675,7 +675,12 @@ add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION w add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") -######################## +############################################################################# +# Flag for UE compilation to avoid issues in common eNB/UE PDCP/RLC functions +############################################################################# + +add_boolean_option(UETARGET False "set UE as target for compiler") + # Include order ########################## add_boolean_option(ENB_MODE True "Swap the include directories between openair2 and openair3" ) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 54683af1cc..f099b0cd37 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -69,6 +69,7 @@ DISABLE_LOG_X="False" USRP_REC_PLAY="False" BUILD_ECLIPSE=0 UE_NAS_USE_TUN="False" +UETARGET="False" BASIC_SIMULATOR=0 trap handle_ctrl_c INT @@ -226,6 +227,7 @@ function main() { shift;; --UE) UE=1 + UETARGET="True" echo_info "Will compile UE" shift;; --mu) @@ -573,6 +575,9 @@ function main() { echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file + if [ "$UE" = 1 ] ; then + echo "set (UETARGET $UETARGET )" >> $cmake_file + fi if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then echo_info "Compiling UE S1 build : enabling Linux and NETLINK" echo "set (LINUX True )" >> $cmake_file @@ -927,6 +932,7 @@ fi echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file echo "set (LINUX True )" >> $cmake_file echo "set (PDCP_USE_NETLINK True )" >> $cmake_file + echo "set (UETARGET True )" >> $cmake_file echo "set (BASIC_SIMULATOR \"True\" )" >> $cmake_file echo "set (UE_NAS_USE_TUN \"True\" )" >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)' >> $cmake_file diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 681a6e32f8..f07419d3ca 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -374,6 +374,7 @@ boolean_t pdcp_data_req( "[MSG] PDCP DL %s PDU on rb_id %d\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP); LOG_F(PDCP,"\n"); +#ifndef UETARGET static cudu_params_t *cudu = NULL; if (ctxt_pP->enb_flag == 1) { @@ -439,7 +440,7 @@ boolean_t pdcp_data_req( #endif ); } - +#endif /*UETARGET*/ } switch (rlc_status) { diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index b4685a0764..b886d92783 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -54,6 +54,7 @@ extern boolean_t pdcp_data_ind( #include "rlc_proto_agent_primitives.h" // PROTO AGENT +#ifndef UETARGET void async_server_thread_init (void) { @@ -111,7 +112,7 @@ async_server_thread_finalize (void) return err; } - +#endif /*UETARGET*/ //----------------------------------------------------------------------------- void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, const signed long sizeP) @@ -675,7 +676,7 @@ void rlc_data_ind ( if (ctxt_pP->enb_flag) T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); #endif - +#ifndef UETARGET if ((!srb_flagP) && (ctxt_pP->enb_flag == 1)) { proto_agent_send_pdcp_data_ind(ctxt_pP, @@ -686,6 +687,7 @@ void rlc_data_ind ( sdu_pP); } else +#endif /*UETARGET*/ { pdcp_data_ind ( ctxt_pP, @@ -765,6 +767,8 @@ rlc_module_init (void) pool_buffer_init(); + +#ifndef UETARGET /* Launch the RLC listening server * as a separate thread */ @@ -774,7 +778,7 @@ rlc_module_init (void) async_server_thread_init(); started = 1; } - +#endif /*UETARGET*/ return(0); } diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h index 0f3b98b04a..313e10d24f 100644 --- a/openair2/UTIL/MEM/mem_block.h +++ b/openair2/UTIL/MEM/mem_block.h @@ -124,7 +124,7 @@ void check_free_mem_block (mem_block_t * leP); # define MEM_MNGT_MB12_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*4096 // 262144 -# define MEM_MNGT_MB12_NB_BLOCKS 1024 * MEM_SCALE +# define MEM_MNGT_MB12_NB_BLOCKS 32 * MEM_SCALE //# define MEM_MNGT_MB12_NB_BLOCKS 4096 * MEM_SCALE # define MEM_MNGT_POOL_ID12 12 -- GitLab From 37b9e7b512daee9897b6a5b1e468ea4db6cb0dfe Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Wed, 12 Sep 2018 19:51:03 +0200 Subject: [PATCH 052/308] Handle the f1 setup request and send back f1 response with value from conf --- openair2/COMMON/f1ap_messages_types.h | 12 +- openair2/ENB_APP/enb_config.c | 11 +- openair2/F1AP/f1ap_common.h | 15 ++- openair2/F1AP/f1ap_cu.c | 47 ++++++-- openair2/F1AP/f1ap_decoder.c | 4 +- openair2/F1AP/f1ap_du.c | 30 ++--- openair2/F1AP/f1ap_handlers.c | 159 ++++++++++++++++++++++++-- openair2/RRC/LTE/rrc_defs.h | 4 +- openair2/RRC/LTE/rrc_eNB.c | 154 ++++++++++++++----------- openair2/RRC/LTE/rrc_proto.h | 2 +- openair3/UTILS/conversions.h | 2 +- 11 files changed, 319 insertions(+), 121 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 6fa1ffbef0..4cb1b4bbab 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -81,7 +81,7 @@ typedef struct f1ap_setup_req_s { uint16_t sctp_out_streams; // F1_Setup_Req payload - uint32_t gNB_DU_id; + uint64_t gNB_DU_id; char *gNB_DU_name; /* The type of the cell */ @@ -164,6 +164,16 @@ typedef struct f1ap_setup_req_s { } f1ap_setup_req_t; typedef struct f1ap_setup_resp_s { + /* Connexion id used between SCTP/F1AP */ + uint16_t cnx_id; + + /* SCTP association id */ + int32_t assoc_id; + + /* Number of SCTP streams used for a mme association */ + uint16_t sctp_in_streams; + uint16_t sctp_out_streams; + /// string holding gNB_CU_name char *gNB_CU_name; /// number of DU cells to activate diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 720469c3e5..b6e16f35ae 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -798,6 +798,13 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { rrc->node_type = ngran_eNB_CU; rrc->sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr); rrc->sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr); + + // MCC and MNC + rrc->mcc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); + rrc->mnc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); + rrc->mnc_digit_length= strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + rrc->tac= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); + } else { // no F1 @@ -2373,7 +2380,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { paramdef_t SCTPParams[] = SCTPPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - F1AP_SETUP_REQ (msg_p).num_cells_available++; + F1AP_SETUP_REQ (msg_p).num_cells_available++; F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); @@ -2474,6 +2481,8 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { F1AP_SETUP_REQ (msg_p).ranac[k] = 0; F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier[0].MIB; F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier[0].SIB1; + F1AP_SETUP_REQ (msg_p).mib_length[k] = rrc->carrier[0].sizeof_MIB; + F1AP_SETUP_REQ (msg_p).sib1_length[k] = rrc->carrier[0].sizeof_SIB1; break; } // if diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 0defd872b6..9ddf15a354 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -390,7 +390,20 @@ inline void ASN_DEBUG(const char *fmt, ...); #endif //Forward declaration -//struct f1ap_message_s; +#define F1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \ + do {\ + IE_TYPE **ptr; \ + ie = NULL; \ + for (ptr = container->protocolIEs.list.array; \ + ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \ + ptr++) { \ + if((*ptr)->id == IE_ID) { \ + ie = *ptr; \ + break; \ + } \ + } \ + if (mandatory) DevAssert(ie != NULL); \ + } while(0) /** \brief Function callback prototype. **/ diff --git a/openair2/F1AP/f1ap_cu.c b/openair2/F1AP/f1ap_cu.c index 64c32d3337..190e264d00 100644 --- a/openair2/F1AP/f1ap_cu.c +++ b/openair2/F1AP/f1ap_cu.c @@ -49,7 +49,7 @@ #include "common/ran_context.h" extern RAN_CONTEXT_t RC; -static f1ap_setup_resp_t *f1ap_cu_data; +f1ap_setup_req_t *f1ap_du_data_from_du; /* This structure describes association of a DU to a CU */ typedef struct f1ap_info { @@ -84,6 +84,7 @@ typedef struct f1ap_info { } f1ap_info_t; + // ============================================================================== static void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { @@ -103,7 +104,7 @@ void CU_send_sctp_init_req(instance_t enb_id) { // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port // 3. creat an itti message to init - LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ\n"); + LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ(create socket)\n"); MessageDef *message_p = NULL; message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); @@ -120,8 +121,6 @@ void CU_send_sctp_init_req(instance_t enb_id) { message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0; message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1"; - LOG_I(CU_F1AP,"CU.my_addr = %s \n", RC.rrc[enb_id]->eth_params_s.my_addr); - LOG_I(CU_F1AP,"CU.enb_id = %d \n", enb_id); itti_send_msg_to_task(TASK_SCTP, enb_id, message_p); } @@ -150,24 +149,30 @@ void *F1AP_CU_task(void *arg) { case SCTP_NEW_ASSOCIATION_IND: LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND\n"); - LOG_I(DU_F1AP, "--------------3--------------\n"); CU_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_NEW_ASSOCIATION_RESP: LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); - LOG_I(DU_F1AP, "--------------4--------------\n"); CU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: LOG_I(CU_F1AP, "SCTP_DATA_IND\n"); - LOG_I(DU_F1AP, "--------------5--------------\n"); CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; + case F1AP_SETUP_RESP: // from rrc + LOG_W(CU_F1AP, "F1AP_SETUP_RESP\n"); + // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // &F1AP_SETUP_RESP(received_msg)); + CU_send_F1_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_SETUP_RESP(received_msg)); + break; + + // case F1AP_SETUP_RESPONSE: // This is from RRC // CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) // break; @@ -197,13 +202,33 @@ void *F1AP_CU_task(void *arg) { void CU_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { - CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_ind); + //CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_ind); } -void CU_handle_sctp_association_resp(instance_t instance, sctp_new_association_ind_t *sctp_new_association_resp) { +void CU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { //CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_resp); + + DevAssert(sctp_new_association_resp != NULL); + + if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { + LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + sctp_new_association_resp->sctp_state, + instance, + sctp_new_association_resp->ulp_cnx_id); + + //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); + return; // exit -1 for debugging + } + + // go to an init func + f1ap_du_data_from_du = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); + // save the assoc id + f1ap_du_data_from_du->assoc_id = sctp_new_association_resp->assoc_id; + f1ap_du_data_from_du->sctp_in_streams = sctp_new_association_resp->in_streams; + f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams; } + // ============================================================================== void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { F1AP_F1AP_PDU_t pdu; @@ -235,7 +260,7 @@ void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { } -void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t *f1ap_setup_ind, f1ap_setup_resp_t *f1ap_setup_resp) { +void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) { //void CU_send_F1_SETUP_RESPONSE(F1AP_F1SetupResponse_t *F1SetupResponse) { //AssertFatal(1==0,"Not implemented yet\n"); @@ -366,7 +391,7 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t * } // printf("\n"); - cu_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_ind->assoc_id, buffer, len, 0); + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); /* decode */ // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { // printf("Failed to decode F1 setup request\n"); diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index a18ad270f4..559b8f77d7 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -127,8 +127,8 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length, 0, 0); - - //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); //LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code); if (dec_ret.code != RC_OK) { diff --git a/openair2/F1AP/f1ap_du.c b/openair2/F1AP/f1ap_du.c index 3138a4b9ba..a74ff2ff2c 100644 --- a/openair2/F1AP/f1ap_du.c +++ b/openair2/F1AP/f1ap_du.c @@ -45,9 +45,6 @@ static f1ap_setup_req_t *f1ap_du_data; -void DU_handle_sctp_association_resp(instance_t instance,sctp_new_association_resp_t *sctp_new_association_resp); - - uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { static uint8_t UE_identifier[NUMBER_OF_eNB_MAX]; UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER; @@ -98,7 +95,6 @@ void *F1AP_DU_task(void *arg) { // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n"); - LOG_I(DU_F1AP, "--------------0--------------\n"); DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg)); break; @@ -107,7 +103,6 @@ void *F1AP_DU_task(void *arg) { // 1. store the respon // 2. send the f1setup_req LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); - LOG_I(DU_F1AP, "--------------1--------------\n"); DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; @@ -115,7 +110,6 @@ void *F1AP_DU_task(void *arg) { case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); - LOG_I(DU_F1AP, "--------------2--------------\n"); DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); break; @@ -170,7 +164,9 @@ void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_se // store data f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); *f1ap_du_data = *f1ap_setup_req; - + //printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]); + printf("sib f1ap context %s\n", f1ap_du_data->sib1[0]); + //du_f1ap_register_to_sctp itti_send_msg_to_task(TASK_SCTP, instance, message_p); } @@ -285,10 +281,12 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { F1AP_Served_Cell_Information_t served_cell_information; memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + /* - nRCGI */ F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; @@ -297,12 +295,8 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - f1ap_du_data->tac[i], - sizeof(f1ap_du_data->tac[i])); - - // OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - // "10", - // 3); + &f1ap_du_data->tac[i], + 3); /* - Configured_EPS_TAC */ if(0){ @@ -321,7 +315,6 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { j++) { /* > PLMN BroadcastPLMNs Item */ F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); //MCC_MNC_TO_PLMNID(208, 95, 2, &broadcastPLMNs_Item->pLMN_Identity); MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); @@ -398,7 +391,7 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { served_cell_information.nR_Mode_Info = nR_Mode_Info; /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = "0"; // sept. 2018 + char *measurementTimingConfiguration = "0"; //&f1ap_du_data->measurement_timing_information[i]; // sept. 2018 OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, measurementTimingConfiguration, @@ -415,13 +408,6 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 f1ap_du_data->sib1[i], f1ap_du_data->sib1_length[i]); - // OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - // "1",//f1ap_setup_req->mib, - // sizeof("1")); - - // OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - // "1", - // sizeof("1")); gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; // diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index b083629748..530c411aa6 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -47,6 +47,9 @@ #include "conversions.h" #include "msc.h" +extern f1ap_setup_req_t *f1ap_du_data_from_du; + + static int f1ap_handle_f1_setup_request(uint32_t assoc_id, uint32_t stream, @@ -108,8 +111,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, memset(&pdu, 0, sizeof(pdu)); if (f1ap_decode_pdu(&pdu, data, data_length) < 0) { - //F1AP_ERROR("Failed to decode PDU\n"); - printf("Failed to decode PDU\n"); + LOG_E(F1AP, "Failed to decode PDU\n"); return -1; } @@ -117,9 +119,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, if (pdu.choice.initiatingMessage->procedureCode > sizeof(f1ap_messages_callback) / (3 * sizeof( f1ap_message_decoded_callback)) || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) { - //F1AP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", - // assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); - printf("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", + LOG_E(F1AP, "[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return -1; @@ -129,10 +129,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, * This can mean not implemented or no procedure for eNB (wrong direction). */ if (f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { - // F1AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n", - // assoc_id, pdu.choice.initiatingMessage->procedureCode, - // f1ap_direction2String(pdu.present - 1)); - printf("[SCTP %d] No handler for procedureCode %ld in %s\n", + LOG_E(F1AP, "[SCTP %d] No handler for procedureCode %ld in %s\n", assoc_id, pdu.choice.initiatingMessage->procedureCode, f1ap_direction2String(pdu.present - 1)); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); @@ -151,9 +148,147 @@ int f1ap_handle_f1_setup_request(uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); + printf("f1ap_handle_f1_setup_request\n"); + + MessageDef *message_p; + F1AP_F1SetupRequest_t *container; + F1AP_F1SetupRequestIEs_t *ie; + int i = 0; + - return 0; + DevAssert(pdu != NULL); + + container = &pdu->choice.initiatingMessage->value.choice.F1SetupRequest; + + /* F1 Setup Request == Non UE-related procedure -> stream 0 */ + if (stream != 0) { + LOG_W(F1AP, "[SCTP %d] Received f1 setup request on stream != 0 (%d)\n", + assoc_id, stream); + } + + message_p = itti_alloc_new_message(TASK_RRC_ENB, F1AP_SETUP_REQ); + + /* assoc_id */ + F1AP_SETUP_REQ(message_p).assoc_id = assoc_id; + + /* gNB_DU_id */ + // this function exits if the ie is mandatory + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_ID, true); + asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &F1AP_SETUP_REQ(message_p).gNB_DU_id); + printf("F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); + + /* gNB_DU_name */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_Name, true); + F1AP_SETUP_REQ(message_p).gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char)); + memcpy(F1AP_SETUP_REQ(message_p).gNB_DU_name, ie->value.choice.GNB_DU_Name.buf, + ie->value.choice.GNB_DU_Name.size); + /* Convert the mme name to a printable string */ + F1AP_SETUP_REQ(message_p).gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; + printf ("F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); + + /* GNB_DU_Served_Cells_List */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); + F1AP_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; + printf ("F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available); + + int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available; + + for (i=0; i<num_cells_available; i++) { + F1AP_GNB_DU_Served_Cells_Item_t *served_celles_item_p; + + served_celles_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); + + /* tac */ + // @issue in here + OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); + printf ("F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); + + /* - nRCGI */ + TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], + F1AP_SETUP_REQ(message_p).mnc[i], + F1AP_SETUP_REQ(message_p).mnc_digit_length[i]); + + // @issue in here cellID + F1AP_SETUP_REQ(message_p).nr_cellid[i] = 1; + printf("[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, + F1AP_SETUP_REQ(message_p).mcc[i], + F1AP_SETUP_REQ(message_p).mnc[i], + F1AP_SETUP_REQ(message_p).nr_cellid[i]); + + /* - nRPCI */ + F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI; + printf ("F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); + + // System Information + /* mib */ + F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_celles_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); + memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_celles_item_p->gNB_DU_System_Information->mIB_message.buf, + served_celles_item_p->gNB_DU_System_Information->mIB_message.size); + /* Convert the mme name to a printable string */ + F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; + F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size; + printf ("F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); + + /* sib1 */ + F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); + memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_celles_item_p->gNB_DU_System_Information->sIB1_message.buf, + served_celles_item_p->gNB_DU_System_Information->sIB1_message.size); + /* Convert the mme name to a printable string */ + F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; + F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size; + printf ("F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); + } + + + *f1ap_du_data_from_du = F1AP_SETUP_REQ(message_p); + // char *measurement_timing_information[F1AP_MAX_NB_CELLS]; + // uint8_t ranac[F1AP_MAX_NB_CELLS]; + + // int fdd_flag = f1ap_setup_req->fdd_flag; + + // union { + // struct { + // uint32_t ul_nr_arfcn; + // uint8_t ul_scs; + // uint8_t ul_nrb; + + // uint32_t dl_nr_arfcn; + // uint8_t dl_scs; + // uint8_t dl_nrb; + + // uint32_t sul_active; + // uint32_t sul_nr_arfcn; + // uint8_t sul_scs; + // uint8_t sul_nrb; + + // uint8_t num_frequency_bands; + // uint16_t nr_band[32]; + // uint8_t num_sul_frequency_bands; + // uint16_t nr_sul_band[32]; + // } fdd; + // struct { + + // uint32_t nr_arfcn; + // uint8_t scs; + // uint8_t nrb; + + // uint32_t sul_active; + // uint32_t sul_nr_arfcn; + // uint8_t sul_scs; + // uint8_t sul_nrb; + + // uint8_t num_frequency_bands; + // uint16_t nr_band[32]; + // uint8_t num_sul_frequency_bands; + // uint16_t nr_sul_band[32]; + + // } tdd; + // } nr_mode_info[F1AP_MAX_NB_CELLS]; + + return itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(assoc_id), message_p); } static @@ -161,7 +296,7 @@ int f1ap_handle_f1_setup_response(uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); + printf("f1ap_handle_f1_setup_response\n"); return 0; } diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 968f2fb942..8464e11913 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -16,7 +16,7 @@ * limitations under the License. *------------------------------------------------------------------------------- * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org + * conmnc_digit_lengtht@openairinterface.org */ /*! \file RRC/LTE/defs.h @@ -713,6 +713,8 @@ typedef struct eNB_RRC_INST_s { int mnc; /// number of mnc digits int mnc_digit_length; + /// tac + int tac; // other RAN parameters int srb1_timer_poll_retransmit; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 73553faf61..7d0e638ad9 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -183,7 +183,8 @@ init_SI( (int)configuration->N_RB_DL[CC_id], (int)configuration->phich_resource[CC_id], (int)configuration->phich_duration[CC_id]); - do_MIB(&rrc->carrier[CC_id], + + carrier->sizeof_MIB= do_MIB(&rrc->carrier[CC_id], #ifdef ENABLE_ITTI configuration->N_RB_DL[CC_id], configuration->phich_resource[CC_id], @@ -5837,7 +5838,7 @@ void setup_ngran_CU(eNB_RRC_INST *rrc) { //----------------------------------------------------------------------------- char openair_rrc_eNB_configuration( - const module_id_t enb_mod_idP + const module_id_t enb_mod_idP, RrcConfigurationReq *rrc_configuration_req ) #else char @@ -5990,7 +5991,15 @@ openair_rrc_eNB_init( } openair_rrc_on(&ctxt); - + +/* + RC.rrc[ctxt.module_id]->mcc= rrc_configuration_req->mcc; + RC.rrc[ctxt.module_id]->mnc= rrc_configuration_req->mnc; + RC.rrc[ctxt.module_id]->mnc_digit_length= rrc_configuration_req->mnc_digit_length; + RC.rrc[ctxt.module_id]->tac= rrc_configuration_req->tac; + + LOG_W(RRC, "[inst %d] RRC->MCC/MSG->MCC %d/%d \n", ctxt.module_id, RC.rrc[ctxt.module_id]->mcc, rrc_configuration_req->mcc); + */ if (RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) // msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SCTP_REQ); // RCconfig_CU_F1(msg_p, enb_id); @@ -7285,76 +7294,85 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { int cu_cell_ind=0; - MessageDef *msg_p; - + MessageDef *msg_p = NULL; + + //LOG_W(RRC,"num_cells_available %d \n", f1_setup_req->num_cells_available); for (int i=0;i<f1_setup_req->num_cells_available;i++) { // check that mcc/mnc match and grab MIB/SIB1 int found_cell=0; for (int j=0;j<RC.nb_inst;j++) { eNB_RRC_INST *rrc = RC.rrc[j]; if (rrc->mcc == f1_setup_req->mcc[i] && rrc->mnc == f1_setup_req->mnc[i]) { - rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]); - rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i]; - - memcpy((void*)rrc->carrier[0].MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]); - asn_dec_rval_t dec_rval = uper_decode_complete(NULL, - &asn_DEF_BCCH_BCH_Message, - (void **)&rrc->carrier[0].mib_DU, - f1_setup_req->mib[i], - f1_setup_req->mib_length[i]); - AssertFatal(dec_rval.code == RC_OK, - "[eNB_DU %"PRIu8"] Failed to decode BCCH_BCH_MESSAGE (%zu bits)\n", - j, - dec_rval.consumed ); - BCCH_BCH_Message_t *mib = &rrc->carrier[0].mib; - BCCH_BCH_Message_t *mib_DU = rrc->carrier[0].mib_DU; - mib->message.dl_Bandwidth = mib_DU->message.dl_Bandwidth; - mib->message.phich_Config.phich_Resource = mib_DU->message.phich_Config.phich_Resource; - mib->message.phich_Config.phich_Duration = mib_DU->message.phich_Config.phich_Duration; - - rrc->carrier[0].SIB1 = malloc(f1_setup_req->sib1_length[i]); - rrc->carrier[0].sizeof_SIB1 = f1_setup_req->sib1_length[i]; - memcpy((void*)rrc->carrier[0].SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]); - dec_rval = uper_decode_complete(NULL, - &asn_DEF_BCCH_DL_SCH_Message, - (void **)&rrc->carrier[0].siblock1_DU, - f1_setup_req->sib1[i], - f1_setup_req->sib1_length[i]); - AssertFatal(dec_rval.code == RC_OK, - "[eNB_DU %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", - j, - dec_rval.consumed ); - // Parse message and extract SystemInformationBlockType1 field - BCCH_DL_SCH_Message_t *bcch_message = rrc->carrier[0].siblock1_DU; - AssertFatal(bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1, - "bcch_message->message.present != BCCH_DL_SCH_MessageType_PR_c1\n"); - AssertFatal(bcch_message->message.choice.c1.present == BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1, - "bcch_message->message.choice.c1.present != BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); - rrc->carrier[0].sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1; - rrc->carrier[0].physCellId = f1_setup_req->nr_pci[i]; - // prepare F1_SETUP_RESPONSE - - if (msg_p == NULL) { - msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_RESP); - F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; - } + // RK: cu_cell_ind is the index for cu_cell_ind, could you confirm? + rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]); + rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i]; + LOG_W(RRC, "instance %d mib length %d\n", i, f1_setup_req->mib_length[i]); + LOG_W(RRC, "instance %d sib1 length %d\n", i, f1_setup_req->sib1_length[i]); + + memcpy((void*)rrc->carrier[0].MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]); + asn_dec_rval_t dec_rval = uper_decode_complete(NULL, + &asn_DEF_BCCH_BCH_Message, + (void **)&rrc->carrier[0].mib_DU, + f1_setup_req->mib[i], + f1_setup_req->mib_length[i]); + AssertFatal(dec_rval.code == RC_OK, + "[eNB_DU %"PRIu8"] Failed to decode BCCH_BCH_MESSAGE (%zu bits)\n", + j, + dec_rval.consumed ); + BCCH_BCH_Message_t *mib = &rrc->carrier[0].mib; + BCCH_BCH_Message_t *mib_DU = rrc->carrier[0].mib_DU; + mib->message.dl_Bandwidth = mib_DU->message.dl_Bandwidth; + mib->message.phich_Config.phich_Resource = mib_DU->message.phich_Config.phich_Resource; + mib->message.phich_Config.phich_Duration = mib_DU->message.phich_Config.phich_Duration; + + rrc->carrier[0].SIB1 = malloc(f1_setup_req->sib1_length[i]); + rrc->carrier[0].sizeof_SIB1 = f1_setup_req->sib1_length[i]; + memcpy((void*)rrc->carrier[0].SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]); + dec_rval = uper_decode_complete(NULL, + &asn_DEF_BCCH_DL_SCH_Message, + (void **)&rrc->carrier[0].siblock1_DU, + f1_setup_req->sib1[i], + f1_setup_req->sib1_length[i]); + AssertFatal(dec_rval.code == RC_OK, + "[eNB_DU %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", + j, + dec_rval.consumed ); + // Parse message and extract SystemInformationBlockType1 field + BCCH_DL_SCH_Message_t *bcch_message = rrc->carrier[0].siblock1_DU; + AssertFatal(bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1, + "bcch_message->message.present != BCCH_DL_SCH_MessageType_PR_c1\n"); + AssertFatal(bcch_message->message.choice.c1.present == BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1, + "bcch_message->message.choice.c1.present != BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); + rrc->carrier[0].sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1; + rrc->carrier[0].physCellId = f1_setup_req->nr_pci[i]; + // prepare F1_SETUP_RESPONSE + + if (msg_p == NULL) { + msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_RESP); + } + F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->mcc; - F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->mnc; - F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->mnc_digit_length; - F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i]; - int num_SI= 0; - if (rrc->carrier[0].SIB23) { - F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23; - F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23; - num_SI++; - } - F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI; - // send ITTI message to F1AP-CU task - itti_send_msg_to_task (TASK_CU_F1, ENB_MODULE_ID_TO_INSTANCE(j), (MessageDef*)f1_setup_resp); - cu_cell_ind++; - found_cell=1; - break; - } // setup_req mcc/mnc match rrc internal list element + F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->mnc; + F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->mnc_digit_length; + F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i]; + int num_SI= 0; + if (rrc->carrier[0].SIB23) { + F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23; + F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23; + num_SI++; + } + F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI; + // send ITTI message to F1AP-CU task + itti_send_msg_to_task (TASK_CU_F1, ENB_MODULE_ID_TO_INSTANCE(j), msg_p); + cu_cell_ind++; + found_cell=1; + break; + } else {// setup_req mcc/mnc match rrc internal list element + + LOG_W(RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d \n", + j, rrc->mcc, f1_setup_req->mcc[i],rrc->mnc, f1_setup_req->mnc[i]); + + } }// for (int j=0;j<RC.nb_inst;j++) if (found_cell==0) { AssertFatal(1==0,"No cell found\n"); @@ -7519,12 +7537,12 @@ rrc_enb_task( /* Messages from eNB app */ case RRC_CONFIGURATION_REQ: LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p)); - openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance)); + openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); break; /* Messages from F1AP task */ case F1AP_SETUP_REQ: AssertFatal(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU, - "should not receive F1AP_SETUP_REQUEST if this isn't a CU!\n"); + "should not receive F1AP_SETUP_REQUEST, need call by CU!\n"); LOG_I(RRC,"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index 7934d96cb1..0c87d18094 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -42,7 +42,7 @@ void openair_rrc_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_a #if defined(ENABLE_ITTI) char openair_rrc_eNB_configuration( - const module_id_t enb_mod_idP + const module_id_t enb_mod_idP, RrcConfigurationReq *rrc_configuration_req ); #endif char openair_rrc_eNB_init( diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index 3100861bf2..d6bbbbd03d 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -139,7 +139,7 @@ do { \ #define OCTET_STRING_TO_INT16(aSN, x) \ do { \ - DevCheck((aSN)->size == 2, (aSN)->size, 0, 0); \ + DevCheck((aSN)->size == 2 || (aSN)->size == 3, (aSN)->size, 0, 0); \ BUFFER_TO_INT16((aSN)->buf, x); \ } while(0) -- GitLab From e54f6305dcd33aebe8022d969c3cb294160e74c7 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Thu, 13 Sep 2018 10:13:05 +0200 Subject: [PATCH 053/308] update f1 response with value from conf and request content --- openair2/F1AP/f1ap_cu.c | 190 +++++++++++++++---------------------- openair2/RRC/LTE/rrc_eNB.c | 13 +-- 2 files changed, 81 insertions(+), 122 deletions(-) diff --git a/openair2/F1AP/f1ap_cu.c b/openair2/F1AP/f1ap_cu.c index 190e264d00..0007d55790 100644 --- a/openair2/F1AP/f1ap_cu.c +++ b/openair2/F1AP/f1ap_cu.c @@ -51,40 +51,6 @@ extern RAN_CONTEXT_t RC; f1ap_setup_req_t *f1ap_du_data_from_du; -/* This structure describes association of a DU to a CU */ -typedef struct f1ap_info { - - module_id_t enb_mod_idP; - module_id_t cu_mod_idP; - - /* 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 GNB_DU_ID; - - /* This is the optional name provided by the MME */ - char *GNB_CU_Name; - f1ap_net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets - - - /* Number of input/ouput streams */ - uint16_t in_streams; - uint16_t out_streams; - - /* Connexion id used between SCTP/S1AP */ - uint16_t cnx_id; - - /* SCTP association id */ - int32_t assoc_id; - - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - -} f1ap_info_t; - - // ============================================================================== static void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { @@ -278,12 +244,6 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setu uint32_t len; int i = 0; - f1ap_info_t f1ap_info; - f1ap_info.GNB_CU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 8; - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -302,16 +262,16 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setu ie->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + /* optional */ /* c2. GNB_CU_Name */ - if (f1ap_info.GNB_CU_Name != NULL) { + if (f1ap_setup_resp->gNB_CU_name != NULL) { ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_Name; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name; - OCTET_STRING_fromBuf(&ie->value.choice.GNB_CU_Name, f1ap_info.GNB_CU_Name, - strlen(f1ap_info.GNB_CU_Name)); + OCTET_STRING_fromBuf(&ie->value.choice.GNB_CU_Name, f1ap_setup_resp->gNB_CU_name, + strlen(f1ap_setup_resp->gNB_CU_name)); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -322,69 +282,70 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setu ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; - + int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate; + printf("num_cells_to_activate = %d \n", num_cells_to_activate); for (i=0; - i<1; + i<num_cells_to_activate; i++) { - F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; - cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); - cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; + cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); + cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; - /* 3.1 cells to be Activated list item */ - F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; - memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); + /* 3.1 cells to be Activated list item */ + F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; + memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - cells_to_be_activated_list_item.nRCGI = nRCGI; + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i], + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_activated_list_item.nRCGI = nRCGI; - /* optional */ - /* - nRPCI */ - if (1) { - cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 - } + /* optional */ + /* - nRPCI */ + if (1) { + cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 + } - /* optional */ - /* - gNB-CU System Information */ - if (1) { - /* 3.1.2 gNB-CUSystem Information */ - F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; - cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); - cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; - cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; - - - F1AP_GNB_CUSystemInformation_t gNB_CUSystemInformation; - memset((void *)&gNB_CUSystemInformation, 0, sizeof(F1AP_GNB_CUSystemInformation_t)); + /* optional */ + /* - gNB-CU System Information */ + if (1) { + /* 3.1.2 gNB-CUSystem Information */ + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; + cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); + cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; + cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; - OCTET_STRING_fromBuf(&gNB_CUSystemInformation.sImessage, - "123456", strlen("123456")); + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = gNB_CUSystemInformation; + OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, + f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); + printf("f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); + cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; - F1AP_ProtocolExtensionContainer_160P9_t p_160P9_t; - memset((void *)&p_160P9_t, 0, sizeof(F1AP_ProtocolExtensionContainer_160P9_t)); - ASN_SEQUENCE_ADD(&p_160P9_t.list, - cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_item.iE_Extensions = &p_160P9_t; + F1AP_ProtocolExtensionContainer_160P9_t p_160P9_t; + memset((void *)&p_160P9_t, 0, sizeof(F1AP_ProtocolExtensionContainer_160P9_t)); - } - /* ADD */ - cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, - cells_to_be_activated_list_item_ies); + ASN_SEQUENCE_ADD(&p_160P9_t.list, + cells_to_be_activated_list_itemExtIEs); + cells_to_be_activated_list_item.iE_Extensions = &p_160P9_t; + + } + /* ADD */ + cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, + cells_to_be_activated_list_item_ies); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); @@ -580,11 +541,10 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du uint32_t len; int i = 0; - f1ap_info_t f1ap_info; - f1ap_info.GNB_CU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 8; + // for test + int mcc = 208; + int mnc = 93; + int mnc_digit_length = 8; /* Create */ /* 0. Message Type */ @@ -630,7 +590,7 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); cells_to_be_activated_list_item.nRCGI = nRCGI; @@ -679,7 +639,7 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); cells_to_be_deactivated_list_item.nRCGI = nRCGI; @@ -855,7 +815,7 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); cells_to_be_barred_item.nRCGI = nRCGI; @@ -968,11 +928,10 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { uint32_t len; int i = 0; - f1ap_info_t f1ap_info; - f1ap_info.GNB_CU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 8; + // for test + int mcc = 208; + int mnc = 93; + int mnc_digit_length = 8; /* Create */ /* 0. Message Type */ @@ -1012,7 +971,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI; /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); @@ -1079,7 +1038,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { /* - candidate_SpCell_ID */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); @@ -1153,7 +1112,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { // /* - sCell_ID */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); @@ -1325,11 +1284,10 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { uint32_t len; int i = 0; - f1ap_info_t f1ap_info; - f1ap_info.GNB_CU_Name = "ABC"; - f1ap_info.mcc = 208; - f1ap_info.mnc = 93; - f1ap_info.mnc_digit_length = 8; + // for test + int mcc = 208; + int mnc = 93; + int mnc_digit_length = 8; /* Create */ /* 0. Message Type */ @@ -1368,7 +1326,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_NRCGI; /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); ie->value.choice.NRCGI = nRCGI; @@ -1492,7 +1450,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { // /* - sCell_ID */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); scell_toBeSetupMod_item.sCell_ID = nRCGI; @@ -1531,7 +1489,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { /* - sCell_ID */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_info.mcc, f1ap_info.mnc, f1ap_info.mnc_digit_length, + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); scell_toBeRemoved_item.sCell_ID = nRCGI; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 7d0e638ad9..1427ec5091 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -183,7 +183,7 @@ init_SI( (int)configuration->N_RB_DL[CC_id], (int)configuration->phich_resource[CC_id], (int)configuration->phich_duration[CC_id]); - + carrier->sizeof_MIB= do_MIB(&rrc->carrier[CC_id], #ifdef ENABLE_ITTI configuration->N_RB_DL[CC_id], @@ -7285,12 +7285,10 @@ void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { - - f1ap_setup_resp_t *f1_setup_resp=NULL; LOG_I(RRC,"Received F1 Setup Request from gNB_DU %d (%s)\n",f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name); - uint16_t num_cells_to_activate = 0; + //uint16_t num_cells_to_activate = 0; int cu_cell_ind=0; @@ -7362,10 +7360,13 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { num_SI++; } F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI; - // send ITTI message to F1AP-CU task - itti_send_msg_to_task (TASK_CU_F1, ENB_MODULE_ID_TO_INSTANCE(j), msg_p); + cu_cell_ind++; found_cell=1; + + F1AP_SETUP_RESP (msg_p).num_cells_to_activate = cu_cell_ind; + // send ITTI message to F1AP-CU task + itti_send_msg_to_task (TASK_CU_F1, ENB_MODULE_ID_TO_INSTANCE(j), msg_p); break; } else {// setup_req mcc/mnc match rrc internal list element -- GitLab From b27cd4dd1b23dfcc5a9cc160d9bd0f0c101218e6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 13 Sep 2018 13:47:29 +0200 Subject: [PATCH 054/308] Reduce warnings in PROTO_AGENT heavily --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 58 +++++-------------- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 11 +++- .../LAYER2/PROTO_AGENT/proto_agent_async.c | 7 +-- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 57 +++++++++--------- .../LAYER2/PROTO_AGENT/proto_agent_common.h | 7 +-- .../LAYER2/PROTO_AGENT/proto_agent_defs.h | 4 +- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 20 +++---- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.c | 14 ++--- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.h | 9 ++- 9 files changed, 80 insertions(+), 107 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index a38ffddaf3..fd809d5f9a 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -33,7 +33,6 @@ * \date 2016 * \version 0.1 */ -#include "ENB_APP/flexran_agent_defs.h" #include "proto_agent_common.h" #include "common/utils/LOG/log.h" #include "proto_agent.h" @@ -57,7 +56,7 @@ pthread_t cu_thread[MAX_DU], du_thread; Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); mod_id_t client_mod[MAX_DU], server_mod; -proto_agent_instance_t *client_channel[MAX_DU], *server_channel; +proto_agent_async_channel_t *client_channel[MAX_DU], *server_channel; proto_recv_t client_info[MAX_DU]; #define TEST_MOD 0 @@ -161,7 +160,7 @@ void * proto_server_init(void *args) int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){ int channel_id; - char *peer_address; + char *peer_address = NULL; proto_server[mod_id].enb_id = mod_id; @@ -230,7 +229,7 @@ int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){ proto_agent_init_channel_container(); /*Create the async channel info*/ - proto_agent_instance_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port, link_type, peer_address); + proto_agent_async_channel_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port, link_type, peer_address); server_channel = channel_info; @@ -260,13 +259,9 @@ int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){ proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); // Code for sending the HELLO/ECHO_REQ message once a connection is established - Protocol__FlexsplitMessage *msg = NULL; + uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; - Protocol__FlexsplitMessage *rep_msg=NULL; - Protocol__FlexsplitMessage *ser_msg=NULL; int msg_flag = 0; - int priority; - int size; if (udp == 0) { @@ -277,7 +272,6 @@ int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){ goto error; int msgsize = 0; - int err_code; if (init_msg != NULL) msg = proto_agent_pack_message(init_msg, &msgsize); @@ -295,7 +289,7 @@ int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){ du_thread=new_thread(proto_server_receive, &proto_server[mod_id]); - LOG_D(PROTO_AGENT, "server ends with thread_id %u\n",du_thread); + LOG_D(PROTO_AGENT, "server ends with thread_id %lu\n",du_thread); return 0; error: @@ -383,7 +377,7 @@ int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_para /*Create the async channel info*/ - proto_agent_instance_t *channel_info = proto_agent_async_channel_info(cu_id, in_ip, in_port, link_type, peer_address); + proto_agent_async_channel_t *channel_info = proto_agent_async_channel_info(cu_id, in_ip, in_port, link_type, peer_address); client_channel[cu_id] = channel_info; /*Create a channel using the async channel info*/ channel_id = proto_agent_create_channel((void *) channel_info, @@ -408,14 +402,8 @@ int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_para /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ proto_agent_register_channel(cu_id, channel, ENB_AGENT_MAX); - void *data; - int size; - int priority; - err_code_t err_code; - Protocol__FlexsplitMessage *msg = NULL; + uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; - Protocol__FlexsplitMessage *rep_msg=NULL; - Protocol__FlexsplitMessage *ser_msg=NULL; int msg_flag; // In the case of UDP comm, start the echo request from the client side; the server thread should be blocked until it reads the SRC port of the 1st packet @@ -429,7 +417,6 @@ int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_para goto error; int msgsize = 0; - int err_code; if (init_msg != NULL) msg = proto_agent_pack_message(init_msg, &msgsize); @@ -447,7 +434,7 @@ int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_para return 0; error: - LOG_E(PROTO_AGENT, "there was an error %u\n", err_code); + LOG_E(PROTO_AGENT, "there was an error in proto_agent_start()\n"); return 1; } @@ -455,7 +442,7 @@ error: void proto_agent_send_hello(void) { - Protocol__FlexsplitMessage *msg = NULL; + uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; int msg_flag = 0; @@ -481,17 +468,10 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct //LOG_D(PROTO_AGENT, "PROTOPDCP: sending the data req over the async channel\n"); - Protocol__FlexsplitMessage *msg = NULL; + uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; - Protocol__FlexsplitMessage *rep = NULL; - Protocol__FlexsplitMessage *srep = NULL; int msg_flag = 0; - void *data=NULL; - int priority; - int size; - int ret; - int err_code; //printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n"); @@ -544,18 +524,11 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f { //LOG_D(PROTO_AGENT, "PROTOPDCP: Sending Data Indication over the async channel\n"); - Protocol__FlexsplitMessage *msg = NULL; + uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg = NULL; - Protocol__FlexsplitMessage *rep = NULL; - Protocol__FlexsplitMessage *srep = NULL; int msg_flag = 0; - void *data=NULL; - int priority; - int size; - int ret; - int err_code; //printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n"); @@ -602,16 +575,16 @@ error: void * -proto_server_receive(void) +proto_server_receive(void *args) { - proto_agent_instance_t *d = &proto_server[server_mod]; + proto_agent_instance_t *d = args; void *data = NULL; int size; int priority; err_code_t err_code; Protocol__FlexsplitMessage *msg; - Protocol__FlexsplitMessage *ser_msg; + uint8_t *ser_msg; while (1) { @@ -661,7 +634,6 @@ proto_client_receive(void *args) proto_recv_t* recv = args; mod_id_t recv_mod = recv->mod_id; - uint8_t type = recv->type_id; LOG_D(PROTO_AGENT, "\n\nrecv mod is %u\n\n",recv_mod); //proto_agent_instance_t *d = &proto_agent[TEST_MOD]; @@ -671,7 +643,7 @@ proto_client_receive(void *args) err_code_t err_code; Protocol__FlexsplitMessage *msg; - Protocol__FlexsplitMessage *ser_msg; + uint8_t *ser_msg; while (1) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 65a5d6f5a9..520a438aa7 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -42,7 +42,7 @@ void * proto_server_init(void *args); -void * proto_server_receive(void); +void * proto_server_receive(void *args); void * proto_client_receive(void *args); int proto_agent_start(uint8_t enb_id, mod_id_t mod_id, uint8_t type_id, cudu_params_t *cudu); @@ -59,4 +59,13 @@ typedef struct uint8_t type_id; }proto_recv_t; +void proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, + const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, + confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP); + +void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP); + #endif diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index e4e165f945..07c528da5b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -95,7 +95,7 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, c error: LOG_E(PROTO_AGENT,"there was an error\n"); - return 1; + return NULL; } @@ -154,12 +154,11 @@ proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, ch error: LOG_E(PROTO_AGENT,"there was an error\n"); - return 1; + return NULL; } int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { - proto_agent_async_channel_t *channel; - channel = (proto_agent_channel_t *)channel_info; + proto_agent_async_channel_t *channel = channel_info; return message_put(channel->send_queue, data, size, priority); } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index c829265825..d89c0b09ae 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -121,7 +121,7 @@ int f1u_dl_data_create_header(uint32_t pdu_type, uint32_t f1u_sn, Protocol__DlDa protocol__dl_data_header__init(*header); LOG_D(F1U, "Initialized the DL Data User header\n"); - fill_dl_data_header(pdu_type, 0, f1u_sn, (*header)->fields); + fill_dl_data_header(pdu_type, 0, f1u_sn, &(*header)->fields); return 0; error: @@ -149,7 +149,9 @@ int f1u_dl_data(const void *params, Protocol__F1uMessage **msg) goto error; - dl_data = *msg; + // FIXME: Is the following used? It seems to be overwritten by the function + // protocol__dl_user_data__init() anyway + //dl_data = *msg; protocol__dl_user_data__init(dl_data); @@ -177,7 +179,7 @@ int f1u_dl_data(const void *params, Protocol__F1uMessage **msg) } -int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, int *size) { +int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size) { *size = protocol__flexsplit_message__get_packed_size(msg); @@ -238,7 +240,11 @@ int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage * int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - + Protocol__FspCtxt *ctxt = NULL; + Protocol__FspRlcPdu *pdu = NULL; + Protocol__FspRlcData *rlc_data = NULL; + Protocol__FspRlcDataReq *data_req = NULL; + // Initialize the PDCP params data_req_args *args = (data_req_args *)params; @@ -255,11 +261,6 @@ int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__Fle * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData */ - Protocol__FspCtxt *ctxt = NULL; - Protocol__FspRlcPdu *pdu = NULL; - Protocol__FspRlcData *rlc_data = NULL; - Protocol__FspRlcDataReq *data_req = NULL; - ctxt = malloc(sizeof(Protocol__FspCtxt)); pdu = malloc(sizeof(Protocol__FspRlcPdu)); @@ -369,8 +370,6 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - Protocol__FspHeader *header; - xid_t xid; rlc_op_status_t result = 0; //printf("PROTO_AGENT: handling the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; @@ -395,15 +394,12 @@ int proto_agent_pdcp_data_req_ack(mod_id_t mod_id, const void *params, Protocol_ Protocol__FspRlcDataReq *data_req = input->data_req_msg; xid = data_req->header->xid; - Protocol__FspRlcPdu *pdu = NULL; Protocol__FspCtxt *ctxt = NULL; Protocol__FspRlcData *rlc_data = NULL; rlc_data = data_req->pdcp_data; - pdu = rlc_data->fsp_pdu; - ctxt = rlc_data->fsp_ctxt; protocol_ctxt_t *ctxt_pP; @@ -451,11 +447,12 @@ int proto_agent_pdcp_data_req_ack(mod_id_t mod_id, const void *params, Protocol_ ,NULL #endif ); + + Protocol__FspRlcDataReqAck *ack = NULL; if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ_ACK, &header) != 0) goto error; - Protocol__FspRlcDataReqAck *ack = NULL; ack = malloc(sizeof(Protocol__FspRlcDataReqAck)); protocol__fsp_rlc_data_req_ack__init(ack); @@ -519,7 +516,11 @@ int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) { int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - + Protocol__FspCtxt *ctxt = NULL; + Protocol__FspRlcPdu *pdu = NULL; + Protocol__FspRlcData *rlc_data = NULL; + Protocol__FspPdcpDataInd *data_ind = NULL; + // Initialize the PDCP params data_req_args *args = (data_req_args *)params; @@ -536,12 +537,6 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData */ - - Protocol__FspCtxt *ctxt = NULL; - Protocol__FspRlcPdu *pdu = NULL; - Protocol__FspRlcData *rlc_data = NULL; - Protocol__FspPdcpDataInd *data_ind = NULL; - ctxt = malloc(sizeof(Protocol__FspCtxt)); pdu = malloc(sizeof(Protocol__FspRlcPdu)); @@ -633,6 +628,8 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { Protocol__FspHeader *header; + Protocol__FspPdcpDataIndAck *ack = NULL; + xid_t xid; rlc_op_status_t result = 0; @@ -642,15 +639,12 @@ int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol_ Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg; xid = data_ind->header->xid; - Protocol__FspRlcPdu *pdu = NULL; Protocol__FspCtxt *ctxt = NULL; Protocol__FspRlcData *rlc_data = NULL; rlc_data = data_ind->rlc_data; - pdu = rlc_data->fsp_pdu; - ctxt = rlc_data->fsp_ctxt; protocol_ctxt_t *ctxt_pP; @@ -687,11 +681,9 @@ int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol_ // else if (xid == 0) // FIXME: USE a preprocessed definition pdcp_data_ind((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); - if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND_ACK, &header) != 0) goto error; - Protocol__FspPdcpDataIndAck *ack = NULL; ack = malloc(sizeof(Protocol__FspPdcpDataIndAck)); protocol__fsp_pdcp_data_ind_ack__init(ack); @@ -707,7 +699,9 @@ int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol_ (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_ACK; (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->has_msg_dir = 1; - (*msg)->data_req_ack = ack; + // FIXME: the following was (*msg)->data_req_ack = ack; + // but this throws compiler warning. Probably we want the following instead + (*msg)->data_ind_ack = ack; return 0; @@ -744,13 +738,14 @@ int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) { int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { Protocol__FspHeader *header; + Protocol__FspHello *hello_msg = NULL; + /*TODO: Need to set random xid or xid from received hello message*/ xid_t xid = mod_id; if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0) goto error; LOG_D(PROTO_AGENT, "creating the HELLO message\n"); - Protocol__FspHello *hello_msg = NULL; hello_msg = malloc(sizeof(Protocol__FspHello)); if(hello_msg == NULL) goto error; @@ -797,13 +792,13 @@ int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) { int proto_agent_echo_request(mod_id_t mod_id, const void* params, Protocol__FlexsplitMessage **msg) { Protocol__FspHeader *header; + Protocol__FspEchoRequest *echo_request_msg = NULL; xid_t xid = mod_id; if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0) goto error; LOG_D(PROTO_AGENT, "creating the echo request message\n"); - Protocol__FspEchoRequest *echo_request_msg = NULL; echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest)); if(echo_request_msg == NULL) goto error; @@ -852,6 +847,7 @@ int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__Flexsp xid_t xid; Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspEchoRequest *echo_req = input->echo_request_msg; + Protocol__FspEchoReply *echo_reply_msg = NULL; xid = (echo_req->header)->xid; @@ -861,7 +857,6 @@ int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__Flexsp if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0) goto error; - Protocol__FspEchoReply *echo_reply_msg; echo_reply_msg = malloc(sizeof(Protocol__FspEchoReply)); if(echo_reply_msg == NULL) goto error; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index 9421ee546f..d81561c14c 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -78,11 +78,10 @@ uint32_t ack_result; * functions and generic handlers **********************************/ -int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, int *size); +int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size); int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg); -void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, - uint32_t * size); +uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size); err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg); @@ -112,7 +111,7 @@ int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__Fl Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, uint8_t *data, - uint32_t size); + int size); Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h index 33a2f48b95..2202390749 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h @@ -49,7 +49,7 @@ #define DEFAULT_PROTO_AGENT_PORT 2210 #define DEFAULT_PROTO_AGENT_CACHE "/mnt/oai_agent_cache" -/*typedef enum { +typedef enum { PROTO_AGENT_DEFAULT=0, @@ -64,7 +64,7 @@ ENB_AGENT_MAX=9, -} agent_id_t;*/ +} proto_agent_id_t; /* typedef enum { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index 7620a12a42..bfa4ed105c 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -60,17 +60,17 @@ proto_agent_message_destruction_callback proto_message_destruction_callback[] = }; -static const char *proto_agent_direction2String[] = { - "", /* not_set */ - "originating message", /* originating message */ - "successfull outcome", /* successfull outcome */ - "unsuccessfull outcome", /* unsuccessfull outcome */ -}; +//static const char *proto_agent_direction2String[] = { +// "", /* not_set */ +// "originating message", /* originating message */ +// "successfull outcome", /* successfull outcome */ +// "unsuccessfull outcome", /* unsuccessfull outcome */ +//}; Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, uint8_t *data, - uint32_t size){ + int size){ Protocol__FlexsplitMessage *decoded_message = NULL; Protocol__FlexsplitMessage *reply_message = NULL; @@ -117,9 +117,9 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, -void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, - uint32_t * size){ - void * buffer; +uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size) +{ + uint8_t *buffer; err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR; if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index 6ae133c7ff..591a7ac288 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -41,7 +41,7 @@ proto_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; proto_agent_channel_instance_t channel_instance; int proto_agent_channel_id = 0; -int proto_agent_msg_send(mod_id_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { +int proto_agent_msg_send(mod_id_t mod_id, proto_agent_id_t agent_id, void *data, int size, int priority) { /*Check if agent id is valid*/ if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { goto error; @@ -61,7 +61,7 @@ int proto_agent_msg_send(mod_id_t mod_id, agent_id_t agent_id, void *data, int s return -1; } -int proto_agent_msg_recv(mod_id_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) { +int proto_agent_msg_recv(mod_id_t mod_id, proto_agent_id_t agent_id, void **data, int *size, int *priority) { /*Check if agent id is valid*/ if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { goto error; @@ -81,7 +81,7 @@ int proto_agent_msg_recv(mod_id_t mod_id, agent_id_t agent_id, void **data, int return -1; } -int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, agent_id_t agent_id) { +int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) { int i; if (channel == NULL) { @@ -98,7 +98,7 @@ int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel return 0; } -void proto_agent_unregister_channel(mod_id_t mod_id, agent_id_t agent_id) { +void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id) { int i; if (agent_id == ENB_AGENT_MAX) { @@ -126,7 +126,7 @@ int proto_agent_create_channel(void *channel_info, /*element should be a real pointer*/ RB_INSERT(proto_agent_channel_map, &channel_instance.proto_agent_head, channel); - LOG_D(PROTO_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); + LOG_D(PROTO_AGENT, "Created a new channel with id 0x%x\n", channel->channel_id); return channel_id; } @@ -150,7 +150,7 @@ int proto_agent_destroy_channel(int channel_id) { for (j = 0; j < ENB_AGENT_MAX; j++) { if (agent_channel[i][j] != NULL) { if (agent_channel[i][j]->channel_id == e->channel_id) { - agent_channel[i][j] == NULL; + agent_channel[i][j] = NULL; } } } @@ -172,7 +172,7 @@ err_code_t proto_agent_init_channel_container(void) { for (i = 0; i < NUM_MAX_ENB; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { - agent_channel[i][j] == NULL; + agent_channel[i][j] = NULL; } } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h index 1224c0b914..b489c64416 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h @@ -35,7 +35,6 @@ */ #ifndef PROTO_AGENT_NET_COMM_H_ #define PROTO_AGENT_NET_COMM_H_ -#include "ENB_APP/flexran_agent_defs.h" #include "proto_agent_defs.h" @@ -59,16 +58,16 @@ typedef struct proto_agent_channel_instance_s{ } proto_agent_channel_instance_t; /*Send and receive messages using the channel registered for a specific agent*/ -int proto_agent_msg_send(mod_id_t mod_id, agent_id_t agent_id, void *data, int size, int priority); +int proto_agent_msg_send(mod_id_t mod_id, proto_agent_id_t agent_id, void *data, int size, int priority); -int proto_agent_msg_recv(mod_id_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority); +int proto_agent_msg_recv(mod_id_t mod_id, proto_agent_id_t agent_id, void **data, int *size, int *priority); /*Register a channel to an agent. Use ENB_AGENT_MAX to register the *same channel to all agents*/ -int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, agent_id_t agent_id); +int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id); /*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/ -void proto_agent_unregister_channel(mod_id_t mod_id, agent_id_t agent_id); +void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id); /*Create a new channel. Returns the id of the new channel or negative number otherwise*/ int proto_agent_create_channel(void *channel_info, -- GitLab From d454a95675508b4b0324654bd458362eed92cf93 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 13 Sep 2018 13:47:47 +0200 Subject: [PATCH 055/308] Reduce warnings in ASYNC_IF --- openair2/UTIL/ASYNC_IF/socket_link.c | 38 +++++++++++++--------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 8609b09811..8f06ed15ff 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -167,9 +167,8 @@ socket_link_t *new_link_udp_server(int port){ socket_link_t *ret = NULL; - struct sockaddr_in si_me, si_other; - int socket_server, i, slen = sizeof(si_other) , recv_bytes; - char buf[1500]; + struct sockaddr_in si_me; + int socket_server = -1; ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { @@ -201,7 +200,7 @@ socket_link_t *new_link_udp_server(int port){ return ret; error: - close(socket_server); + if (socket_server != -1) close(socket_server); if (ret != NULL) close(ret->socket_fd); free(ret); //printf("\n\n\nERROR PROTO_AGENT: ERROR in new_link_udp_server (see above), returning NULL\n"); @@ -219,10 +218,9 @@ socket_link_t *new_link_udp_client(char *server, int port){ } ret->socket_fd = -1; - struct sockaddr_in si_other, server_info; - int s, i, slen=sizeof(si_other); - char buf[1500]; - char message[1500]; + struct sockaddr_in si_other; + int s; + socklen_t slen; if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1){ goto error; @@ -258,14 +256,8 @@ socket_link_t *new_link_sctp_server(int port) { socket_link_t *ret = NULL; - ret = calloc(1, sizeof(socket_link_t)); - if (ret == NULL) { - LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - ret->socket_fd = -1; - int listenSock, temp; + int listenSock = -1, temp; struct sockaddr_in servaddr; listenSock = socket (AF_INET, SOCK_STREAM, IPPROTO_SCTP); @@ -296,13 +288,19 @@ socket_link_t *new_link_sctp_server(int port) close(listenSock); exit(1); } + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + ret->socket_fd = -1; - ret->socket_fd = accept (listenSock, (struct sockaddr *) NULL, (int *) NULL); + ret->socket_fd = accept (listenSock, NULL, NULL); return ret; error: - close(listenSock); + if (listenSock != -1) close(listenSock); if (ret != NULL) close(ret->socket_fd); free(ret); LOG_E(MAC,"ERROR in new_link_sctp_server (see above), returning NULL\n"); @@ -399,13 +397,13 @@ static int socket_udp_receive(int socket_fd, void *buf, int size) LOG_D(PROTO_AGENT,"UDP RECEIVE\n"); struct sockaddr_in client; - int slen = sizeof(client); + socklen_t slen; char *s = buf; int l; while (size) { l = recvfrom(socket_fd, s, size, 0, (struct sockaddr *) &client, &slen); - getsockname(s, (struct sockaddr *)&client, &slen); + getsockname(socket_fd, (struct sockaddr *)&client, &slen); LOG_D(PROTO_AGENT, "Got message from src port: %u\n", ntohs(client.sin_port)); if (l == -1) goto error; if (l == 0) goto socket_closed; @@ -511,7 +509,7 @@ int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_t if (socket_udp_send(link->socket_fd, sizebuf, 4, peer_addr, link->peer_port) == -1) goto error; - LOG_I(PROTO_AGENT,"sent %d bytes over the channel\n", (int32_t *)sizebuf); + LOG_I(PROTO_AGENT,"sent 4 bytes over the channel\n"); link->bytes_sent += 4; if (socket_udp_send(link->socket_fd, data, size, peer_addr, link->peer_port) == -1) -- GitLab From f736213d096e1beb2b02aadb0219a90f153ac386 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Thu, 13 Sep 2018 16:25:51 +0200 Subject: [PATCH 056/308] Update F1AP new code structure to closer implementing all the procedures --- cmake_targets/CMakeLists.txt | 36 +- openair2/F1AP/f1ap_common.c | 10 +- openair2/F1AP/f1ap_common.h | 12 + openair2/F1AP/f1ap_cu.c | 1881 ---------------- openair2/F1AP/f1ap_cu_interface_management.c | 767 +++++++ openair2/F1AP/f1ap_cu_interface_management.h | 44 + .../F1AP/{f1ap_du_defs.h => f1ap_cu_paging.c} | 16 +- .../F1AP/{f1ap_cu_defs.h => f1ap_cu_paging.h} | 16 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 170 ++ openair2/F1AP/f1ap_cu_rrc_message_transfer.h | 36 + ...f1ap_du.h => f1ap_cu_system_information.c} | 15 +- openair2/F1AP/f1ap_cu_system_information.h | 31 + openair2/F1AP/f1ap_cu_task.c | 172 ++ openair2/F1AP/f1ap_cu_task.h | 5 + openair2/F1AP/f1ap_cu_ue_context_management.c | 892 ++++++++ openair2/F1AP/f1ap_cu_ue_context_management.h | 31 + .../f1ap_cu_warning_message_transmission.c | 31 + .../f1ap_cu_warning_message_transmission.h | 31 + openair2/F1AP/f1ap_decoder.c | 6 - openair2/F1AP/f1ap_decoder.h | 2 - openair2/F1AP/f1ap_du.c | 1921 ----------------- openair2/F1AP/f1ap_du_interface_management.c | 792 +++++++ openair2/F1AP/f1ap_du_interface_management.h | 44 + openair2/F1AP/f1ap_du_paging.c | 31 + openair2/F1AP/f1ap_du_paging.h | 31 + openair2/F1AP/f1ap_du_rrc_message_transfer.c | 215 ++ openair2/F1AP/f1ap_du_rrc_message_transfer.h | 37 + openair2/F1AP/f1ap_du_system_information.c | 31 + openair2/F1AP/f1ap_du_system_information.h | 31 + openair2/F1AP/f1ap_du_task.c | 177 ++ openair2/F1AP/f1ap_du_task.h | 3 + openair2/F1AP/f1ap_du_ue_context_management.c | 723 +++++++ openair2/F1AP/f1ap_du_ue_context_management.h | 36 + .../f1ap_du_warning_message_transmission.c | 31 + .../f1ap_du_warning_message_transmission.h | 31 + openair2/F1AP/f1ap_encoder.c | 10 - openair2/F1AP/f1ap_encoder.h | 4 +- openair2/F1AP/f1ap_handlers.c | 203 +- openair2/F1AP/f1ap_itti_messaging.c | 3 +- openair2/F1AP/f1ap_messaging.c | 68 +- openair2/F1AP/f1ap_messaging.h | 6 - 41 files changed, 4521 insertions(+), 4111 deletions(-) delete mode 100644 openair2/F1AP/f1ap_cu.c create mode 100644 openair2/F1AP/f1ap_cu_interface_management.c create mode 100644 openair2/F1AP/f1ap_cu_interface_management.h rename openair2/F1AP/{f1ap_du_defs.h => f1ap_cu_paging.c} (81%) rename openair2/F1AP/{f1ap_cu_defs.h => f1ap_cu_paging.h} (81%) create mode 100644 openair2/F1AP/f1ap_cu_rrc_message_transfer.c create mode 100644 openair2/F1AP/f1ap_cu_rrc_message_transfer.h rename openair2/F1AP/{f1ap_du.h => f1ap_cu_system_information.c} (81%) create mode 100644 openair2/F1AP/f1ap_cu_system_information.h create mode 100644 openair2/F1AP/f1ap_cu_task.c create mode 100644 openair2/F1AP/f1ap_cu_ue_context_management.c create mode 100644 openair2/F1AP/f1ap_cu_ue_context_management.h create mode 100644 openair2/F1AP/f1ap_cu_warning_message_transmission.c create mode 100644 openair2/F1AP/f1ap_cu_warning_message_transmission.h delete mode 100644 openair2/F1AP/f1ap_du.c create mode 100644 openair2/F1AP/f1ap_du_interface_management.c create mode 100644 openair2/F1AP/f1ap_du_interface_management.h create mode 100644 openair2/F1AP/f1ap_du_paging.c create mode 100644 openair2/F1AP/f1ap_du_paging.h create mode 100644 openair2/F1AP/f1ap_du_rrc_message_transfer.c create mode 100644 openair2/F1AP/f1ap_du_rrc_message_transfer.h create mode 100644 openair2/F1AP/f1ap_du_system_information.c create mode 100644 openair2/F1AP/f1ap_du_system_information.h create mode 100644 openair2/F1AP/f1ap_du_task.c create mode 100644 openair2/F1AP/f1ap_du_ue_context_management.c create mode 100644 openair2/F1AP/f1ap_du_ue_context_management.h create mode 100644 openair2/F1AP/f1ap_du_warning_message_transmission.c create mode 100644 openair2/F1AP/f1ap_du_warning_message_transmission.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index eb3c048039..1ac20c3363 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -281,7 +281,7 @@ endif (${ENABLE_ITTI}) # (so creating new asn.1 objects instead of modifying the object attributes) # New C code source file, cmake must be re-run (instead of re-running make only) ############# -set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1") +# set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1") # set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1") set(asn1_generated_dir ${OPENAIR_BIN_DIR}) @@ -504,40 +504,30 @@ set(F1AP_ASN_FILES ${F1AP_ASN_DIR}/F1AP-Containers.asn ) -set(F1AP_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR}) -message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_C_DIR} ${F1AP_ASN_FILES}") -execute_process(COMMAND mkdir -p ${F1AP_C_DIR} - COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_C_DIR} ${F1AP_ASN_FILES} +set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR}) +message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}") +execute_process(COMMAND mkdir -p ${F1AP_ASN_GENERATED_C_DIR} + COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES} RESULT_VARIABLE ret OUTPUT_QUIET ERROR_QUIET) if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${asn1c_call}: error") + message(FATAL_ERROR "asn1c: error") endif (NOT ${ret} STREQUAL 0) -file(GLOB F1AP_source ${F1AP_C_DIR}/*.c) - -file(GLOB f1ap_h ${F1AP_C_DIR}/*.h) -set(f1ap_h ${f1ap_h} ) +file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c) add_library(F1AP_LIB - ${F1AP_source} - ) + ${F1AP_ASN_GENERATED_C_FILES} +) -include_directories ("${F1AP_C_DIR}") +include_directories ("${F1AP_ASN_GENERATED_C_DIR}") include_directories ("${F1AP_DIR}") -message(${F1AP_C_DIR}) -message(${F1AP_DIR}) +file(GLOB F1AP_C_FILES ${F1AP_DIR}/*.c) add_library(F1AP - ${F1AP_DIR}/f1ap_du.c - ${F1AP_DIR}/f1ap_cu.c - ${F1AP_DIR}/f1ap_itti_messaging.c - ${F1AP_DIR}/f1ap_encoder.c - ${F1AP_DIR}/f1ap_decoder.c - ${F1AP_DIR}/f1ap_handlers.c - ${F1AP_DIR}/f1ap_common.c - ) + ${F1AP_C_FILES} +) # Hardware dependant options diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 22468ed054..a5ad507901 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -30,10 +30,7 @@ * \warning */ -#include <stdint.h> - #include "f1ap_common.h" -//#include "S1AP-PDU.h" #if defined(EMIT_ASN_DEBUG_EXTERN) int asn_debug = 0; @@ -211,3 +208,10 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+cu_mod_idP]); return transaction_identifier[enb_mod_idP+cu_mod_idP]; } + +uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { + static uint8_t UE_identifier[NUMBER_OF_eNB_MAX]; + UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER; + //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]); + return UE_identifier[enb_mod_idP+CC_idP+UE_id]; +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 9ddf15a354..3dced33ac9 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -356,6 +356,17 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_Cells-To-Be-Broadcast-Item.h" #include "F1AP_QCI.h" +#include "conversions.h" +#include "platform_types.h" +#include "common/utils/LOG/log.h" +#include "intertask_interface.h" +#include "sctp_messages_types.h" +#include "f1ap_messages_types.h" +#include <arpa/inet.h> +#include "T.h" +#include "common/ran_context.h" +#include "msc.h" + /* Checking version of ASN1C compiler */ #if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) # error "You are compiling f1ap with the wrong version of ASN1C" @@ -415,5 +426,6 @@ typedef int (*f1ap_message_decoded_callback)( uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP); +uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id); #endif /* F1AP_COMMON_H_ */ diff --git a/openair2/F1AP/f1ap_cu.c b/openair2/F1AP/f1ap_cu.c deleted file mode 100644 index 0007d55790..0000000000 --- a/openair2/F1AP/f1ap_cu.c +++ /dev/null @@ -1,1881 +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 openair2/F1AP/CU_F1AP.c -* \brief data structures for F1 interface modules -* \author EURECOM/NTUST -* \date 2018 -* \version 0.1 -* \company Eurecom -* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, bing-kai.hong@eurecom.fr -* \note -* \warning -*/ - -#include "conversions.h" -#include "f1ap_common.h" -#include "f1ap_cu_defs.h" -#include "f1ap_encoder.h" -#include "f1ap_decoder.h" -#include "f1ap_cu_task.h" -#include "platform_types.h" -#include "common/utils/LOG/log.h" -#include "intertask_interface.h" -#include "f1ap_itti_messaging.h" -#include <arpa/inet.h> - -#include "T.h" - -#define MAX_F1AP_BUFFER_SIZE 4096 - -#include "common/ran_context.h" -extern RAN_CONTEXT_t RC; - -f1ap_setup_req_t *f1ap_du_data_from_du; - -// ============================================================================== -static -void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { - int result; - - DevAssert(sctp_data_ind != NULL); - - f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); - - result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); -} - -void CU_send_sctp_init_req(instance_t enb_id) { - // 1. get the itti msg, and retrive the enb_id from the message - // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port - // 3. creat an itti message to init - - LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ(create socket)\n"); - MessageDef *message_p = NULL; - - message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); - message_p->ittiMsg.sctp_init.port = F1AP_PORT_NUMBER; - message_p->ittiMsg.sctp_init.ppid = F1AP_SCTP_PPID; - message_p->ittiMsg.sctp_init.ipv4 = 1; - message_p->ittiMsg.sctp_init.ipv6 = 0; - message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; - message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr); - /* - * SR WARNING: ipv6 multi-homing fails sometimes for localhost. - * * * * Disable it for now. - */ - message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0; - message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1"; - - itti_send_msg_to_task(TASK_SCTP, enb_id, message_p); -} - -void *F1AP_CU_task(void *arg) { - //sctp_cu_init(); - - MessageDef *received_msg = NULL; - int result; - - LOG_I(CU_F1AP,"Starting F1AP at CU\n"); - - //f1ap_eNB_prepare_internal_data(); - - itti_mark_task_ready(TASK_CU_F1); - - CU_send_sctp_init_req(0); - - while (1) { - itti_receive_msg(TASK_CU_F1, &received_msg); - switch (ITTI_MSG_ID(received_msg)) { - - // case F1AP_CU_SCTP_REQ: - // LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ\n"); - - // break; - - case SCTP_NEW_ASSOCIATION_IND: - LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND\n"); - CU_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_ind); - break; - - case SCTP_NEW_ASSOCIATION_RESP: - LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); - CU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); - break; - - case SCTP_DATA_IND: - LOG_I(CU_F1AP, "SCTP_DATA_IND\n"); - CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); - break; - - case F1AP_SETUP_RESP: // from rrc - LOG_W(CU_F1AP, "F1AP_SETUP_RESP\n"); - // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - // &F1AP_SETUP_RESP(received_msg)); - CU_send_F1_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &F1AP_SETUP_RESP(received_msg)); - break; - - -// case F1AP_SETUP_RESPONSE: // This is from RRC -// CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) -// break; - -// case F1AP_SETUP_FAILURE: // This is from RRC -// CU_send_F1_SETUP_FAILURE(instance, *f1ap_setup_ind, &(F1AP_SETUP_FAILURE) f1ap_setup_failure) -// break; - - case TERMINATE_MESSAGE: - LOG_W(CU_F1AP, " *** Exiting CU_F1AP thread\n"); - itti_exit_task(); - break; - - default: - LOG_E(CU_F1AP, "CU Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); - break; - } // switch - 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; - } // while - - return NULL; -} - - -void CU_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { - //CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_ind); -} - -void CU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { - //CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_resp); - - DevAssert(sctp_new_association_resp != NULL); - - if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); - - //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; // exit -1 for debugging - } - - // go to an init func - f1ap_du_data_from_du = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); - // save the assoc id - f1ap_du_data_from_du->assoc_id = sctp_new_association_resp->assoc_id; - f1ap_du_data_from_du->sctp_in_streams = sctp_new_association_resp->in_streams; - f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams; -} - - -// ============================================================================== -void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { - F1AP_F1AP_PDU_t pdu; - - uint8_t *buffer; - uint32_t len; - /* Receiver */ - //f1ap_receiver(&buffer); - - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } - /* decode */ - //CU_F1AP_decode(args_p); - // fill in f1ap_setup_req message for RRC task - - - /* handle */ - - - // fill f1ap_setup_req_t - // send ITTI F1AP_SETUP_REQ to RRC - // return - - // send successful callback - //CU_send_F1_SETUP_RESPONSE(); - // or failure callback - //CU_send_F1_SETUP_FAILURE(); - -} - -void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) { -//void CU_send_F1_SETUP_RESPONSE(F1AP_F1SetupResponse_t *F1SetupResponse) { - //AssertFatal(1==0,"Not implemented yet\n"); - - module_id_t enb_mod_idP; - module_id_t cu_mod_idP; - - enb_mod_idP = (module_id_t)12; - cu_mod_idP = (module_id_t)34; - - F1AP_F1AP_PDU_t pdu; - F1AP_F1SetupResponse_t *out; - F1AP_F1SetupResponseIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); - pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; - pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_F1SetupResponse; - out = &pdu.choice.successfulOutcome->value.choice.F1SetupResponse; - - /* mandatory */ - /* c1. Transaction ID (integer value)*/ - ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c2. GNB_CU_Name */ - if (f1ap_setup_resp->gNB_CU_name != NULL) { - ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_Name; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name; - OCTET_STRING_fromBuf(&ie->value.choice.GNB_CU_Name, f1ap_setup_resp->gNB_CU_name, - strlen(f1ap_setup_resp->gNB_CU_name)); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* mandatory */ - /* c3. cells to be Activated list */ - ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; - - int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate; - printf("num_cells_to_activate = %d \n", num_cells_to_activate); - for (i=0; - i<num_cells_to_activate; - i++) { - - F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; - cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); - cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; - - /* 3.1 cells to be Activated list item */ - F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; - memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - cells_to_be_activated_list_item.nRCGI = nRCGI; - - /* optional */ - /* - nRPCI */ - if (1) { - cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 - } - - /* optional */ - /* - gNB-CU System Information */ - if (1) { - /* 3.1.2 gNB-CUSystem Information */ - F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; - cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); - cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; - cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; - - F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - - OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, - f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); - - printf("f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); - cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; - - - F1AP_ProtocolExtensionContainer_160P9_t p_160P9_t; - memset((void *)&p_160P9_t, 0, sizeof(F1AP_ProtocolExtensionContainer_160P9_t)); - - ASN_SEQUENCE_ADD(&p_160P9_t.list, - cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_item.iE_Extensions = &p_160P9_t; - - } - /* ADD */ - cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, - cells_to_be_activated_list_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - } - - // printf("\n"); - cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //printf("F1 setup response present = %d\n", out->value.present); - //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); - -} - -void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure) { - AssertFatal(1==0,"Not implemented yet\n"); - //AssertFatal(1==0,"Not implemented yet\n"); - //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); -} - - -void CU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_send_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void CU_send_RESET(F1AP_Reset_t *Reset) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_handle_RESET(F1AP_Reset_t *Reset) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(void) { - - printf("CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER\n"); - // decode the F1 message - // get the rrc message from the contauiner - // call func rrc_eNB_decode_ccch: <-- needs some update here - - // if size > 0 - // CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size) -} - -void CU_handle_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -//void CU_send_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { -void CU_send_DL_RRC_MESSAGE_TRANSFER(void) { - F1AP_F1AP_PDU_t pdu; - F1AP_DLRRCMessageTransfer_t *out; - F1AP_DLRRCMessageTransferIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_DLRRCMessageTransfer; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer; - out = &pdu.choice.initiatingMessage->value.choice.DLRRCMessageTransfer; - - /* mandatory */ - /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c3. oldgNB_DU_UE_F1AP_ID */ - if (0) { - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - //ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING; - //ie->value.choice. = 1; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* mandatory */ - /* c4. SRBID */ - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = 2L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c5. ExecuteDuplication */ - if (0) { - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ExecuteDuplication; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_ExecuteDuplication; - ie->value.choice.ExecuteDuplication = F1AP_ExecuteDuplication_true; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - // issue in here - /* mandatory */ - /* c6. RRCContainer */ - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "A", strlen("A")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c7. RAT_FrequencyPriorityInformation */ - if (0) { - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation; - - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 123L; - - //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; - //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - } - - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } - //AssertFatal(1==0,"Not implemented yet\n"); -} - - -void CU_handle_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_send_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -//void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { -void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP) { - F1AP_F1AP_PDU_t pdu; - F1AP_GNBCUConfigurationUpdate_t *out; - F1AP_GNBCUConfigurationUpdateIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - - // for test - int mcc = 208; - int mnc = 93; - int mnc_digit_length = 8; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate; - out = &pdu.choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; - - /* mandatory */ - /* c1. Transaction ID (integer value) */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - - /* mandatory */ - /* c2. Cells_to_be_Activated_List */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List; - - for (i=0; - i<1; - i++) { - - F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; - cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); - cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; - - /* 2.1 cells to be Activated list item */ - F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; - memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - cells_to_be_activated_list_item.nRCGI = nRCGI; - - /* optional */ - /* - nRPCI */ - if (0) { - cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 - } - - /* optional */ - /* - gNB-CU System Information */ - //if (1) { - - //} - /* ADD */ - cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, - cells_to_be_activated_list_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - - /* mandatory */ - /* c3. Cells_to_be_Deactivated_List */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List; - - for (i=0; - i<1; - i++) { - - F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *cells_to_be_deactivated_list_item_ies; - cells_to_be_deactivated_list_item_ies = (F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Deactivated_List_ItemIEs_t)); - cells_to_be_deactivated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; - - /* 3.1 cells to be Deactivated list item */ - F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item; - memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - cells_to_be_deactivated_list_item.nRCGI = nRCGI; - - //} - /* ADD */ - cells_to_be_deactivated_list_item_ies->value.choice.Cells_to_be_Deactivated_List_Item = cells_to_be_deactivated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Deactivated_List.list, - cells_to_be_deactivated_list_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* mandatory */ - /* c4. GNB_CU_TNL_Association_To_Add_List */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Add_List; - - for (i=0; - i<1; - i++) { - - F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *gnb_cu_tnl_association_to_add_item_ies; - gnb_cu_tnl_association_to_add_item_ies = (F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t)); - gnb_cu_tnl_association_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item; - gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject; - gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; - - /* 4.1 GNB_CU_TNL_Association_To_Add_Item */ - F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item; - memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t)); - - - /* 4.1.1 tNLAssociationTransportLayerAddress */ - F1AP_CP_TransportLayerAddress_t transportLayerAddress; - memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); - - // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; - // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); - // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); - - gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - - /* 4.1.2 tNLAssociationUsage */ - gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; - - - /* ADD */ - gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item; - ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list, - gnb_cu_tnl_association_to_add_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - - /* mandatory */ - /* c5. GNB_CU_TNL_Association_To_Remove_List */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List; - for (i=0; - i<1; - i++) { - - F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *gnb_cu_tnl_association_to_remove_item_ies; - gnb_cu_tnl_association_to_remove_item_ies = (F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t)); - gnb_cu_tnl_association_to_remove_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item; - gnb_cu_tnl_association_to_remove_item_ies->criticality = F1AP_Criticality_reject; - gnb_cu_tnl_association_to_remove_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item; - - /* 4.1 GNB_CU_TNL_Association_To_Remove_Item */ - F1AP_GNB_CU_TNL_Association_To_Remove_Item_t gnb_cu_tnl_association_to_remove_item; - memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t)); - - - /* 4.1.1 tNLAssociationTransportLayerAddress */ - F1AP_CP_TransportLayerAddress_t transportLayerAddress; - memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); - - // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; - // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); - // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); - - gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - - - /* ADD */ - gnb_cu_tnl_association_to_remove_item_ies->value.choice.GNB_CU_TNL_Association_To_Remove_Item = gnb_cu_tnl_association_to_remove_item; - ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, - gnb_cu_tnl_association_to_remove_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c6. GNB_CU_TNL_Association_To_Update_List */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Update_List; - for (i=0; - i<1; - i++) { - - F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *gnb_cu_tnl_association_to_update_item_ies; - gnb_cu_tnl_association_to_update_item_ies = (F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t)); - gnb_cu_tnl_association_to_update_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item; - gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject; - gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; - - /* 4.1 GNB_CU_TNL_Association_To_Update_Item */ - F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item; - memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t)); - - - /* 4.1.1 tNLAssociationTransportLayerAddress */ - F1AP_CP_TransportLayerAddress_t transportLayerAddress; - memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); - - // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; - // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); - // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); - - gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - - - /* 4.1.2 tNLAssociationUsage */ - if (1) { - gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t)); - *gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; - } - - /* ADD */ - gnb_cu_tnl_association_to_update_item_ies->value.choice.GNB_CU_TNL_Association_To_Update_Item = gnb_cu_tnl_association_to_update_item; - ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Update_List.list, - gnb_cu_tnl_association_to_update_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - - /* mandatory */ - /* c7. Cells_to_be_Barred_List */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Barred_List; - for (i=0; - i<1; - i++) { - - F1AP_Cells_to_be_Barred_ItemIEs_t *cells_to_be_barred_item_ies; - cells_to_be_barred_item_ies = (F1AP_Cells_to_be_Barred_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Barred_ItemIEs_t)); - cells_to_be_barred_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_barred_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_barred_item_ies->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item; - - /* 7.1 cells to be Deactivated list item */ - F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item; - memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - cells_to_be_barred_item.nRCGI = nRCGI; - - /* 7.2 cellBarred*/ - cells_to_be_barred_item.cellBarred = F1AP_CellBarred_not_barred; - - /* ADD */ - cells_to_be_barred_item_ies->value.choice.Cells_to_be_Barred_Item = cells_to_be_barred_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Barred_List.list, - cells_to_be_barred_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - - /* mandatory */ - /* c8. Protected_EUTRA_Resources_List */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Protected_EUTRA_Resources_List; - - for (i=0; - i<1; - i++) { - - - F1AP_Protected_EUTRA_Resources_ItemIEs_t *protected_eutra_resources_item_ies; - - /* 8.1 SpectrumSharingGroupID */ - protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); - protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; - protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; - protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_SpectrumSharingGroupID; - protected_eutra_resources_item_ies->value.choice.SpectrumSharingGroupID = 1L; - - ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); - - /* 8.2 ListofEUTRACellsinGNBDUCoordination */ - protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); - protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; - protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; - protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_ListofEUTRACellsinGNBDUCoordination; - - F1AP_Served_EUTRA_Cells_Information_t served_eutra_cells_information; - memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t)); - - F1AP_EUTRA_Mode_Info_t eUTRA_Mode_Info; - memset((void *)&eUTRA_Mode_Info, 0, sizeof(F1AP_EUTRA_Mode_Info_t)); - - // eUTRAFDD - eUTRA_Mode_Info.present = F1AP_EUTRA_Mode_Info_PR_eUTRAFDD; - F1AP_EUTRA_FDD_Info_t *eutra_fdd_info; - eutra_fdd_info = (F1AP_EUTRA_FDD_Info_t *)calloc(1, sizeof(F1AP_EUTRA_FDD_Info_t)); - eutra_fdd_info->uL_offsetToPointA = 123L; - eutra_fdd_info->dL_offsetToPointA = 456L; - eUTRA_Mode_Info.choice.eUTRAFDD = eutra_fdd_info; - - // eUTRATDD - // eUTRA_Mode_Info.present = F1AP_EUTRA_Mode_Info_PR_eUTRATDD; - // F1AP_EUTRA_TDD_Info_t *eutra_tdd_info; - // eutra_tdd_info = (F1AP_EUTRA_TDD_Info_t *)calloc(1, sizeof(F1AP_EUTRA_TDD_Info_t)); - // eutra_tdd_info->uL_offsetToPointA = 123L; - // eutra_tdd_info->dL_offsetToPointA = 456L; - // eUTRA_Mode_Info.choice.eUTRATDD = eutra_tdd_info; - - served_eutra_cells_information.eUTRA_Mode_Info = eUTRA_Mode_Info; - - OCTET_STRING_fromBuf(&served_eutra_cells_information.protectedEUTRAResourceIndication, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - - ASN_SEQUENCE_ADD(&protected_eutra_resources_item_ies->value.choice.ListofEUTRACellsinGNBDUCoordination.list, &served_eutra_cells_information); - - ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return; - } - - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } -} - -void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -//void CU_send_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { -void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { - F1AP_F1AP_PDU_t pdu; - F1AP_UEContextSetupRequest_t *out; - F1AP_UEContextSetupRequestIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - - // for test - int mcc = 208; - int mnc = 93; - int mnc_digit_length = 8; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextSetupRequest; - out = &pdu.choice.initiatingMessage->value.choice.UEContextSetupRequest; - - /* mandatory */ - /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c2. GNB_DU_UE_F1AP_ID */ - if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* mandatory */ - /* c3. SpCell_ID */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI; - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - - ie->value.choice.NRCGI = nRCGI; - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c4. ServCellIndex */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; - ie->value.choice.ServCellIndex = 2; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c5. CellULConfigured */ - if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SpCellULConfigured; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CellULConfigured; - ie->value.choice.CellULConfigured = F1AP_CellULConfigured_ul; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* mandatory */ - /* c6. CUtoDURRCInformation */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; - ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); - /* optional */ - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); - /* optional */ - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c7. Candidate_SpCell_List */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; - - for (i=0; - i<1; - i++) { - - F1AP_Candidate_SpCell_ItemIEs_t *candidate_spCell_item_ies; - candidate_spCell_item_ies = (F1AP_Candidate_SpCell_ItemIEs_t *)calloc(1, sizeof(F1AP_Candidate_SpCell_ItemIEs_t)); - candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 - candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; - candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; - - /* 5.1 Candidate_SpCell_Item */ - F1AP_Candidate_SpCell_Item_t candidate_spCell_item; - memset((void *)&candidate_spCell_item, 0, sizeof(F1AP_Candidate_SpCell_Item_t)); - - /* - candidate_SpCell_ID */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - - candidate_spCell_item.candidate_SpCell_ID = nRCGI; - - /* ADD */ - candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item = candidate_spCell_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Candidate_SpCell_List.list, - candidate_spCell_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c8. DRXCycle */ - if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRXCycle; - ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum - if (0) { - ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); - *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum - } - if (0) { - ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); - *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* optional */ - /* c9. ResourceCoordinationTransferContainer */ - if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ResourceCoordinationTransferContainer; - - ie->value.choice.ResourceCoordinationTransferContainer.buf = malloc(4); - ie->value.choice.ResourceCoordinationTransferContainer.size = 4; - *ie->value.choice.ResourceCoordinationTransferContainer.buf = "123"; - - - OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* mandatory */ - /* c10. SCell_ToBeSetup_List */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SCell_ToBeSetup_ItemIEs_t *scell_toBeSetup_item_ies; - scell_toBeSetup_item_ies = (F1AP_SCell_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeSetup_ItemIEs_t)); - scell_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_Item; //53 - scell_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - scell_toBeSetup_item_ies->value.present = F1AP_SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; - - /* 8.1 SCell_ToBeSetup_Item */ - F1AP_SCell_ToBeSetup_Item_t scell_toBeSetup_item; - memset((void *)&scell_toBeSetup_item, 0, sizeof(F1AP_SCell_ToBeSetup_Item_t)); - - // /* - sCell_ID */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - - scell_toBeSetup_item.sCell_ID = nRCGI; - - /* sCellIndex */ - scell_toBeSetup_item.sCellIndex = 3; // issue here - // /* ADD */ - scell_toBeSetup_item_ies->value.choice.SCell_ToBeSetup_Item = scell_toBeSetup_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetup_List.list, - scell_toBeSetup_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - // /* mandatory */ - /* c11. SRBs_ToBeSetup_List */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List; - ie->criticality = F1AP_Criticality_reject; // ? - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SRBs_ToBeSetup_ItemIEs_t *srbs_toBeSetup_item_ies; - srbs_toBeSetup_item_ies = (F1AP_SRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeSetup_ItemIEs_t)); - srbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_Item; // 73 - srbs_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - srbs_toBeSetup_item_ies->value.present = F1AP_SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; - - /* 9.1 SRBs_ToBeSetup_Item */ - F1AP_SRBs_ToBeSetup_Item_t srbs_toBeSetup_item; - memset((void *)&srbs_toBeSetup_item, 0, sizeof(F1AP_SRBs_ToBeSetup_Item_t)); - - /* - sRBID */ - srbs_toBeSetup_item.sRBID = 2L; - - /* ADD */ - srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item = srbs_toBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetup_List.list, - srbs_toBeSetup_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c12. DRBs_ToBeSetup_List */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_ToBeSetup_ItemIEs_t *drbs_toBeSetup_item_ies; - drbs_toBeSetup_item_ies = (F1AP_DRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetup_ItemIEs_t)); - drbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_Item; - drbs_toBeSetup_item_ies->criticality = F1AP_Criticality_reject; - drbs_toBeSetup_item_ies->value.present = F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; - - /* 10.1 DRBs_ToBeSetup_Item */ - F1AP_DRBs_ToBeSetup_Item_t drbs_toBeSetup_item; - memset((void *)&drbs_toBeSetup_item, 0, sizeof(F1AP_DRBs_ToBeSetup_Item_t)); - - /* dRBID */ - drbs_toBeSetup_item.dRBID = 30L; - - /* qoSInformation */ - drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; - - /* ULTunnels_ToBeSetup_List */ - int maxnoofULTunnels = 1; // 2; - for (i=0; - i<maxnoofULTunnels; - i++) { - /* ULTunnels_ToBeSetup_Item */ - F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; - - // gTPTunnel - uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1234", - strlen("1234")); - - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - - ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); - } - - /* rLCMode */ - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; // enum - - /* OPTIONAL */ - /* ULConfiguration */ - if (0) { - drbs_toBeSetup_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); - } - - /* ADD */ - drbs_toBeSetup_item_ies->value.choice.DRBs_ToBeSetup_Item = drbs_toBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeSetup_List.list, - drbs_toBeSetup_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* OPTIONAL */ - if (0) { - //F1AP_InactivityMonitoringRequest_t InactivityMonitoringRequest; - //F1AP_RAT_FrequencyPriorityInformation_t RAT_FrequencyPriorityInformation; - //F1AP_RRCContainer_t RRCContainer; - //F1AP_MaskedIMEISV_t MaskedIMEISV; - } - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return; - } - - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } - //AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_handle_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_handle_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void CU_handle_UE_CONTEXT_RELEASE_REQUEST(F1AP_UEContextReleaseRequest_t *UEContextReleaseRequest) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void CU_send_UE_CONTEXT_RELEASE_COMMAND(F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void CU_handle_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UEContextReleaseComplete) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -//void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { -void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { - F1AP_F1AP_PDU_t pdu; - F1AP_UEContextModificationRequest_t *out; - F1AP_UEContextModificationRequestIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - - // for test - int mcc = 208; - int mnc = 93; - int mnc_digit_length = 8; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextModification; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextModificationRequest; - out = &pdu.choice.initiatingMessage->value.choice.UEContextModificationRequest; - - /* mandatory */ - /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c3. NRCGI */ - if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_NRCGI; - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - ie->value.choice.NRCGI = nRCGI; - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* mandatory */ - /* c4. ServCellIndex */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex; - ie->value.choice.ServCellIndex = 5L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c5. DRXCycle */ - if (0) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRXCycle; - ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum - if (0) { - ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); - *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum - } - if (0) { - ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); - *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* optional */ - /* c5. CUtoDURRCInformation */ - if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_CUtoDURRCInformation; - ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); - /* optional */ - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); - /* optional */ - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* optional */ - /* c6. TransmissionStopIndicator */ - if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransmissionStopIndicator; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionStopIndicator; - ie->value.choice.TransmissionStopIndicator = F1AP_TransmissionStopIndicator_true; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* optional */ - /* c7. ResourceCoordinationTransferContainer */ - if (0) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ResourceCoordinationTransferContainer; - OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* optional */ - /* c7. RRCRconfigurationCompleteIndicator */ - if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCRconfigurationCompleteIndicator; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCRconfigurationCompleteIndicator; - ie->value.choice.RRCRconfigurationCompleteIndicator = F1AP_RRCRconfigurationCompleteIndicator_true; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* optional */ - /* c8. RRCContainer */ - if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* mandatory */ - /* c9. SCell_ToBeSetupMod_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeSetupMod_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SCell_ToBeSetupMod_ItemIEs_t *scell_toBeSetupMod_item_ies; - scell_toBeSetupMod_item_ies = (F1AP_SCell_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeSetupMod_ItemIEs_t)); - //memset((void *)&scell_toBeSetupMod_item_ies, 0, sizeof(F1AP_SCell_ToBeSetupMod_ItemIEs_t)); - scell_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_Item; - scell_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; - scell_toBeSetupMod_item_ies->value.present = F1AP_SCell_ToBeSetupMod_ItemIEs__value_PR_SCell_ToBeSetupMod_Item; - - /* 8.1 SCell_ToBeSetup_Item */ - F1AP_SCell_ToBeSetupMod_Item_t scell_toBeSetupMod_item; - memset((void *)&scell_toBeSetupMod_item, 0, sizeof(F1AP_SCell_ToBeSetupMod_Item_t)); - - // /* - sCell_ID */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - scell_toBeSetupMod_item.sCell_ID = nRCGI; - - /* sCellIndex */ - scell_toBeSetupMod_item.sCellIndex = 6; // issue here - - // /* ADD */ - scell_toBeSetupMod_item_ies->value.choice.SCell_ToBeSetupMod_Item = scell_toBeSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetupMod_List.list, - scell_toBeSetupMod_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c10. SCell_ToBeRemoved_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeRemoved_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SCell_ToBeRemoved_ItemIEs_t *scell_toBeRemoved_item_ies; - scell_toBeRemoved_item_ies = (F1AP_SCell_ToBeRemoved_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); - //memset((void *)&scell_toBeRemoved_item_ies, 0, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); - scell_toBeRemoved_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_Item; - scell_toBeRemoved_item_ies->criticality = F1AP_Criticality_ignore; - scell_toBeRemoved_item_ies->value.present = F1AP_SCell_ToBeRemoved_ItemIEs__value_PR_SCell_ToBeRemoved_Item; - - /* 10.1 SCell_ToBeRemoved_Item */ - F1AP_SCell_ToBeRemoved_Item_t scell_toBeRemoved_item; - memset((void *)&scell_toBeRemoved_item, 0, sizeof(F1AP_SCell_ToBeRemoved_Item_t)); - - /* - sCell_ID */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - scell_toBeRemoved_item.sCell_ID = nRCGI; - - /* ADD */ - scell_toBeRemoved_item_ies->value.choice.SCell_ToBeRemoved_Item = scell_toBeRemoved_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeRemoved_List.list, - scell_toBeRemoved_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c11. SRBs_ToBeSetupMod_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeSetupMod_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SRBs_ToBeSetupMod_ItemIEs_t *srbs_toBeSetupMod_item_ies; - srbs_toBeSetupMod_item_ies = (F1AP_SRBs_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeSetupMod_ItemIEs_t)); - //memset((void *)&srbs_toBeSetupMod_item_ies, 0, sizeof(F1AP_SRBs_ToBeSetupMod_ItemIEs_t)); - srbs_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_Item; - srbs_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; - srbs_toBeSetupMod_item_ies->value.present = F1AP_SRBs_ToBeSetupMod_ItemIEs__value_PR_SRBs_ToBeSetupMod_Item; - - /* 9.1 SRBs_ToBeSetupMod_Item */ - F1AP_SRBs_ToBeSetupMod_Item_t srbs_toBeSetupMod_item; - memset((void *)&srbs_toBeSetupMod_item, 0, sizeof(F1AP_SRBs_ToBeSetupMod_Item_t)); - - /* - sRBID */ - srbs_toBeSetupMod_item.sRBID = 3L; - - /* ADD */ - srbs_toBeSetupMod_item_ies->value.choice.SRBs_ToBeSetupMod_Item = srbs_toBeSetupMod_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetupMod_List.list, - srbs_toBeSetupMod_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* mandatory */ - /* c12. DRBs_ToBeSetupMod_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_ToBeSetupMod_ItemIEs_t *drbs_toBeSetupMod_item_ies; - drbs_toBeSetupMod_item_ies = (F1AP_DRBs_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetupMod_ItemIEs_t)); - drbs_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item; - drbs_toBeSetupMod_item_ies->criticality = F1AP_Criticality_reject; - drbs_toBeSetupMod_item_ies->value.present = F1AP_DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item; - - /* 12.1 DRBs_ToBeSetupMod_Item */ - F1AP_DRBs_ToBeSetupMod_Item_t drbs_toBeSetupMod_item; - memset((void *)&drbs_toBeSetupMod_item, 0, sizeof(F1AP_DRBs_ToBeSetupMod_Item_t)); - - /* dRBID */ - drbs_toBeSetupMod_item.dRBID = 30L; - - /* qoSInformation */ - drbs_toBeSetupMod_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS->qCI = 253L; - - /* ULTunnels_ToBeSetupMod_List */ - int j = 0; - int maxnoofULTunnels = 1; // 2; - for (j=0; - j<maxnoofULTunnels; - j++) { - /* ULTunnels_ToBeSetup_Item */ - - F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; - uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "4567", - strlen("4567")); - - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - - ASN_SEQUENCE_ADD(&drbs_toBeSetupMod_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); - } - - /* rLCMode */ - drbs_toBeSetupMod_item.rLCMode = F1AP_RLCMode_rlc_um; // enum - - /* OPTIONAL */ - /* ULConfiguration */ - if (0) { - drbs_toBeSetupMod_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); - } - - /* ADD */ - drbs_toBeSetupMod_item_ies->value.choice.DRBs_ToBeSetupMod_Item = drbs_toBeSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeSetupMod_List.list, - drbs_toBeSetupMod_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c13. DRBs_ToBeModified_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_ToBeModified_ItemIEs_t *drbs_toBeModified_item_ies; - drbs_toBeModified_item_ies = (F1AP_DRBs_ToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeModified_ItemIEs_t)); - drbs_toBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_Item; - drbs_toBeModified_item_ies->criticality = F1AP_Criticality_reject; - drbs_toBeModified_item_ies->value.present = F1AP_DRBs_ToBeModified_ItemIEs__value_PR_DRBs_ToBeModified_Item; - - /* 13.1 SRBs_ToBeModified_Item */ - F1AP_DRBs_ToBeModified_Item_t drbs_toBeModified_item; - memset((void *)&drbs_toBeModified_item, 0, sizeof(F1AP_DRBs_ToBeModified_Item_t)); - - /* dRBID */ - drbs_toBeModified_item.dRBID = 30L; - - /* qoSInformation */ - drbs_toBeModified_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; - - /* ULTunnels_ToBeModified_List */ - int j = 0; - int maxnoofULTunnels = 1; // 2; - for (j=0; - j<maxnoofULTunnels; - j++) { - /* ULTunnels_ToBeModified_Item */ - F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; - uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); - - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - - ASN_SEQUENCE_ADD(&drbs_toBeModified_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); - } - - /* OPTIONAL */ - /* ULConfiguration */ - if (0) { - drbs_toBeModified_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); - } - - /* ADD */ - drbs_toBeModified_item_ies->value.choice.DRBs_ToBeModified_Item = drbs_toBeModified_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeModified_List.list, - drbs_toBeModified_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c14. SRBs_ToBeReleased_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeReleased_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SRBs_ToBeReleased_ItemIEs_t *srbs_toBeReleased_item_ies; - srbs_toBeReleased_item_ies = (F1AP_SRBs_ToBeReleased_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeReleased_ItemIEs_t)); - //memset((void *)&srbs_toBeReleased_item_ies, 0, sizeof(F1AP_SRBs_ToBeReleased_ItemIEs_t)); - srbs_toBeReleased_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_Item; - srbs_toBeReleased_item_ies->criticality = F1AP_Criticality_ignore; - srbs_toBeReleased_item_ies->value.present = F1AP_SRBs_ToBeReleased_ItemIEs__value_PR_SRBs_ToBeReleased_Item; - - /* 9.1 SRBs_ToBeReleased_Item */ - F1AP_SRBs_ToBeReleased_Item_t srbs_toBeReleased_item; - memset((void *)&srbs_toBeReleased_item, 0, sizeof(F1AP_SRBs_ToBeReleased_Item_t)); - - /* - sRBID */ - srbs_toBeReleased_item.sRBID = 2L; - - /* ADD */ - srbs_toBeReleased_item_ies->value.choice.SRBs_ToBeReleased_Item = srbs_toBeReleased_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeReleased_List.list, - srbs_toBeReleased_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c15. DRBs_ToBeReleased_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_ToBeReleased_ItemIEs_t *drbs_toBeReleased_item_ies; - drbs_toBeReleased_item_ies = (F1AP_DRBs_ToBeReleased_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeReleased_ItemIEs_t)); - drbs_toBeReleased_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_Item; - drbs_toBeReleased_item_ies->criticality = F1AP_Criticality_reject; - drbs_toBeReleased_item_ies->value.present = F1AP_DRBs_ToBeReleased_ItemIEs__value_PR_DRBs_ToBeReleased_Item; - - /* 14.1 SRBs_ToBeReleased_Item */ - F1AP_DRBs_ToBeReleased_Item_t drbs_toBeReleased_item; - memset((void *)&drbs_toBeReleased_item, 0, sizeof(F1AP_DRBs_ToBeReleased_Item_t)); - - /* dRBID */ - drbs_toBeReleased_item.dRBID = 30L; - - /* ADD */ - drbs_toBeReleased_item_ies->value.choice.DRBs_ToBeReleased_Item = drbs_toBeReleased_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeReleased_List.list, - drbs_toBeReleased_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return; - } - - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } - -} - -void CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(F1AP_UEContextModificationFailure_t EContextModificationFailure) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(F1AP_UEContextModificationRequired_t *UEContextModificationRequired) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -static int F1AP_CU_decode_initiating_message(F1AP_InitiatingMessage_t *initiating_p) { - - switch (initiating_p->value.present) { - - case F1AP_InitiatingMessage__value_PR_NOTHING: /* No components present */ - AssertFatal(1==0,"Should not receive NOTHING on CU\n"); - break; - - case F1AP_InitiatingMessage__value_PR_Reset: - CU_send_RESET(&initiating_p->value.choice.Reset); - break; - case F1AP_InitiatingMessage__value_PR_F1SetupRequest: - CU_handle_F1_SETUP_REQUEST(&initiating_p->value.choice.F1SetupRequest); - break; - case F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate: - AssertFatal(1==0,"Should not receive GNBDUConfigurationUpdate on CU\n"); - break; - case F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate: - CU_handle_gNB_CU_CONFIGURATION_UPDATE(&initiating_p->value.choice.GNBCUConfigurationUpdate); - break; - case F1AP_InitiatingMessage__value_PR_UEContextSetupRequest: - CU_handle_UE_CONTEXT_SETUP_REQUEST(&initiating_p->value.choice.UEContextSetupRequest); - break; - case F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand: - CU_handle_UE_CONTEXT_SETUP_RELEASE_COMMAND(&initiating_p->value.choice.UEContextReleaseCommand); - break; - case F1AP_InitiatingMessage__value_PR_UEContextModificationRequest: - CU_handle_UE_CONTEXT_MODIFICATION_REQUEST(&initiating_p->value.choice.UEContextModificationRequest); - break; - case F1AP_InitiatingMessage__value_PR_UEContextModificationRequired: - AssertFatal(1==0,"Should not receive UECONTEXTMODIFICATIONREQUIRED on CU\n"); - break; - case F1AP_InitiatingMessage__value_PR_ErrorIndication: - AssertFatal(1==0,"Should not receive ErrorIndication on CU\n"); - break; - case F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest: - AssertFatal(1==0,"Should not receive UECONTEXTRELEASEREQUEST on CU\n"); - break; - case F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer: - CU_handle_DL_RRC_MESSAGE_TRANSFER(&initiating_p->value.choice.DLRRCMessageTransfer); - break; - case F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer: - AssertFatal(1==0,"Should not receive ULRRCMESSAGETRANSFER on CU\n"); - break; - case F1AP_InitiatingMessage__value_PR_PrivateMessage: - AssertFatal(1==0,"Should not receive PRIVATEMESSAGE on CU\n"); - break; - default: - AssertFatal(1==0,"Shouldn't get here\n"); - } - -} - -static int F1AP_CU_decode_successful_outcome(F1AP_SuccessfulOutcome_t *successfulOutcome_p) -{ - - switch (successfulOutcome_p->value.present) { - - case F1AP_SuccessfulOutcome__value_PR_NOTHING: /* No components present */ - AssertFatal(1==0,"Should not received NOTHING!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_ResetAcknowledge: - AssertFatal(1==0,"CU Should not receive ResetAcknowled!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_F1SetupResponse: - AssertFatal(1==0,"CU Should not receive F1SetupResponse!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: - CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(successfulOutcome_p->value.choice.GNBDUConfigurationUpdateAcknowledge); - break; - case F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge: - AssertFatal(1==0,"CU Should not receive GNBCUConfigurationUpdateAcknowledge!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse: - AssertFatal(1==0,"CU Should not receive UEContextSetupResponse!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete: - AssertFatal(1==0,"CU Should not receive UEContextReleaseComplete!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse: - AssertFatal(1==0,"CU Should not receive UEContextModificationResponse!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_UEContextModificationConfirm: - CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(successfulOutcome_p->value.choice.UEContextModificationConfirm); - break; - } -} - -static int F1AP_CU_decode_unsuccessful_outcome(F1AP_UnsuccessfulOutcome_t *unSuccessfulOutcome_p) -{ - - switch (unSuccessfulOutcome_p->value.present) { - - case F1AP_UnsuccessfulOutcome__value_PR_NOTHING: - AssertFatal(1==0,"Should not receive NOTHING!\n"); - break; /* No components present */ - case F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure: - AssertFatal(1==0,"Should not receive F1SetupFailure\n"); - break; - case F1AP_UnsuccessfulOutcome__value_PR_GNBDUConfigurationUpdateFailure: - CU_handle_gNB_CU_CONFIGURATION_FAILURE(unSuccessfulOutcome_p->value.choice.GNBDUConfigurationUpdateFailure); - break; - case F1AP_UnsuccessfulOutcome__value_PR_GNBCUConfigurationUpdateFailure: - AssertFatal(1==0,"Should not receive GNBCUConfigurationUpdateFailure\n"); - break; - case F1AP_UnsuccessfulOutcome__value_PR_UEContextSetupFailure: - CU_handle_UE_CONTEXT_SETUP_FAILURE(unSuccessfulOutcome_p->value.choice.UEContextSetupFailure); - break; - case F1AP_UnsuccessfulOutcome__value_PR_UEContextModificationFailure: - CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(unSuccessfulOutcome_p->value.choice.UEContextModificationFailure); - break; - } - -} diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c new file mode 100644 index 0000000000..e28a1ac811 --- /dev/null +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -0,0 +1,767 @@ +/* + * 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 f1ap_cu_interface_management.c + * \brief f1ap interface management for CU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include "f1ap_common.h" +#include "f1ap_du_interface_management.h" + +extern f1ap_setup_req_t *f1ap_du_data_from_du; +/* + Reset +*/ +void CU_send_RESET(F1AP_Reset_t *Reset) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_RESET(F1AP_Reset_t *Reset) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + Error Indication +*/ +void CU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + F1 Setup +*/ +int CU_handle_F1_SETUP_REQUEST(uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ + printf("CU_handle_F1_SETUP_REQUEST\n"); + + MessageDef *message_p; + F1AP_F1SetupRequest_t *container; + F1AP_F1SetupRequestIEs_t *ie; + int i = 0; + + + DevAssert(pdu != NULL); + + container = &pdu->choice.initiatingMessage->value.choice.F1SetupRequest; + + /* F1 Setup Request == Non UE-related procedure -> stream 0 */ + if (stream != 0) { + LOG_W(F1AP, "[SCTP %d] Received f1 setup request on stream != 0 (%d)\n", + assoc_id, stream); + } + + message_p = itti_alloc_new_message(TASK_RRC_ENB, F1AP_SETUP_REQ); + + /* assoc_id */ + F1AP_SETUP_REQ(message_p).assoc_id = assoc_id; + + /* gNB_DU_id */ + // this function exits if the ie is mandatory + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_ID, true); + asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &F1AP_SETUP_REQ(message_p).gNB_DU_id); + printf("F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); + + /* gNB_DU_name */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_Name, true); + F1AP_SETUP_REQ(message_p).gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char)); + memcpy(F1AP_SETUP_REQ(message_p).gNB_DU_name, ie->value.choice.GNB_DU_Name.buf, + ie->value.choice.GNB_DU_Name.size); + /* Convert the mme name to a printable string */ + F1AP_SETUP_REQ(message_p).gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; + printf ("F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); + + /* GNB_DU_Served_Cells_List */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); + F1AP_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; + printf ("F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available); + + int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available; + + for (i=0; i<num_cells_available; i++) { + F1AP_GNB_DU_Served_Cells_Item_t *served_celles_item_p; + + served_celles_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); + + /* tac */ + // @issue in here + OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); + printf ("F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); + + /* - nRCGI */ + TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], + F1AP_SETUP_REQ(message_p).mnc[i], + F1AP_SETUP_REQ(message_p).mnc_digit_length[i]); + + // @issue in here cellID + F1AP_SETUP_REQ(message_p).nr_cellid[i] = 1; + printf("[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, + F1AP_SETUP_REQ(message_p).mcc[i], + F1AP_SETUP_REQ(message_p).mnc[i], + F1AP_SETUP_REQ(message_p).nr_cellid[i]); + + /* - nRPCI */ + F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI; + printf ("F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); + + // System Information + /* mib */ + F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_celles_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); + memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_celles_item_p->gNB_DU_System_Information->mIB_message.buf, + served_celles_item_p->gNB_DU_System_Information->mIB_message.size); + /* Convert the mme name to a printable string */ + F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; + F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size; + printf ("F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); + + /* sib1 */ + F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); + memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_celles_item_p->gNB_DU_System_Information->sIB1_message.buf, + served_celles_item_p->gNB_DU_System_Information->sIB1_message.size); + /* Convert the mme name to a printable string */ + F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; + F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size; + printf ("F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); + } + + + *f1ap_du_data_from_du = F1AP_SETUP_REQ(message_p); + // char *measurement_timing_information[F1AP_MAX_NB_CELLS]; + // uint8_t ranac[F1AP_MAX_NB_CELLS]; + + // int fdd_flag = f1ap_setup_req->fdd_flag; + + // union { + // struct { + // uint32_t ul_nr_arfcn; + // uint8_t ul_scs; + // uint8_t ul_nrb; + + // uint32_t dl_nr_arfcn; + // uint8_t dl_scs; + // uint8_t dl_nrb; + + // uint32_t sul_active; + // uint32_t sul_nr_arfcn; + // uint8_t sul_scs; + // uint8_t sul_nrb; + + // uint8_t num_frequency_bands; + // uint16_t nr_band[32]; + // uint8_t num_sul_frequency_bands; + // uint16_t nr_sul_band[32]; + // } fdd; + // struct { + + // uint32_t nr_arfcn; + // uint8_t scs; + // uint8_t nrb; + + // uint32_t sul_active; + // uint32_t sul_nr_arfcn; + // uint8_t sul_scs; + // uint8_t sul_nrb; + + // uint8_t num_frequency_bands; + // uint16_t nr_band[32]; + // uint8_t num_sul_frequency_bands; + // uint16_t nr_sul_band[32]; + + // } tdd; + // } nr_mode_info[F1AP_MAX_NB_CELLS]; + + return itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(assoc_id), message_p); +} + +void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) { + + module_id_t enb_mod_idP; + module_id_t cu_mod_idP; + + enb_mod_idP = (module_id_t)12; + cu_mod_idP = (module_id_t)34; + + F1AP_F1AP_PDU_t pdu; + F1AP_F1SetupResponse_t *out; + F1AP_F1SetupResponseIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); + pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; + pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_F1SetupResponse; + out = &pdu.choice.successfulOutcome->value.choice.F1SetupResponse; + + /* mandatory */ + /* c1. Transaction ID (integer value)*/ + ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c2. GNB_CU_Name */ + if (f1ap_setup_resp->gNB_CU_name != NULL) { + ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_Name; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name; + OCTET_STRING_fromBuf(&ie->value.choice.GNB_CU_Name, f1ap_setup_resp->gNB_CU_name, + strlen(f1ap_setup_resp->gNB_CU_name)); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c3. cells to be Activated list */ + ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; + + int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate; + printf("num_cells_to_activate = %d \n", num_cells_to_activate); + for (i=0; + i<num_cells_to_activate; + i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; + cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); + cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + + /* 3.1 cells to be Activated list item */ + F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; + memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i], + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_activated_list_item.nRCGI = nRCGI; + + /* optional */ + /* - nRPCI */ + if (1) { + cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 + } + + /* optional */ + /* - gNB-CU System Information */ + if (1) { + /* 3.1.2 gNB-CUSystem Information */ + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; + cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); + cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; + cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; + + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); + + OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, + f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); + + printf("f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); + cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; + + + F1AP_ProtocolExtensionContainer_160P9_t p_160P9_t; + memset((void *)&p_160P9_t, 0, sizeof(F1AP_ProtocolExtensionContainer_160P9_t)); + + ASN_SEQUENCE_ADD(&p_160P9_t.list, + cells_to_be_activated_list_itemExtIEs); + cells_to_be_activated_list_item.iE_Extensions = &p_160P9_t; + + } + /* ADD */ + cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, + cells_to_be_activated_list_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + // printf("\n"); + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + //printf("F1 setup response present = %d\n", out->value.present); + //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); + +} + +void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure) { + AssertFatal(1==0,"Not implemented yet\n"); + //AssertFatal(1==0,"Not implemented yet\n"); + //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); +} + + + +/* + gNB-DU Configuration Update +*/ + +void CU_handle_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + + +/* + gNB-CU Configuration Update +*/ + +//void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { +void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP) { + F1AP_F1AP_PDU_t pdu; + F1AP_GNBCUConfigurationUpdate_t *out; + F1AP_GNBCUConfigurationUpdateIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0; + + // for test + int mcc = 208; + int mnc = 93; + int mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate; + out = &pdu.choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; + + /* mandatory */ + /* c1. Transaction ID (integer value) */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c2. Cells_to_be_Activated_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List; + + for (i=0; + i<1; + i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; + cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); + cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + + /* 2.1 cells to be Activated list item */ + F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; + memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_activated_list_item.nRCGI = nRCGI; + + /* optional */ + /* - nRPCI */ + if (0) { + cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 + } + + /* optional */ + /* - gNB-CU System Information */ + //if (1) { + + //} + /* ADD */ + cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, + cells_to_be_activated_list_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c3. Cells_to_be_Deactivated_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List; + + for (i=0; + i<1; + i++) { + + F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *cells_to_be_deactivated_list_item_ies; + cells_to_be_deactivated_list_item_ies = (F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Deactivated_List_ItemIEs_t)); + cells_to_be_deactivated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; + + /* 3.1 cells to be Deactivated list item */ + F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item; + memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_deactivated_list_item.nRCGI = nRCGI; + + //} + /* ADD */ + cells_to_be_deactivated_list_item_ies->value.choice.Cells_to_be_Deactivated_List_Item = cells_to_be_deactivated_list_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Deactivated_List.list, + cells_to_be_deactivated_list_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c4. GNB_CU_TNL_Association_To_Add_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Add_List; + + for (i=0; + i<1; + i++) { + + F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *gnb_cu_tnl_association_to_add_item_ies; + gnb_cu_tnl_association_to_add_item_ies = (F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t)); + gnb_cu_tnl_association_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item; + gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; + + /* 4.1 GNB_CU_TNL_Association_To_Add_Item */ + F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item; + memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t)); + + + /* 4.1.1 tNLAssociationTransportLayerAddress */ + F1AP_CP_TransportLayerAddress_t transportLayerAddress; + memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; + // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); + // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + + gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress; + + /* 4.1.2 tNLAssociationUsage */ + gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; + + + /* ADD */ + gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item; + ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list, + gnb_cu_tnl_association_to_add_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c5. GNB_CU_TNL_Association_To_Remove_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List; + for (i=0; + i<1; + i++) { + + F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *gnb_cu_tnl_association_to_remove_item_ies; + gnb_cu_tnl_association_to_remove_item_ies = (F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t)); + gnb_cu_tnl_association_to_remove_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item; + gnb_cu_tnl_association_to_remove_item_ies->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_remove_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item; + + /* 4.1 GNB_CU_TNL_Association_To_Remove_Item */ + F1AP_GNB_CU_TNL_Association_To_Remove_Item_t gnb_cu_tnl_association_to_remove_item; + memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t)); + + + /* 4.1.1 tNLAssociationTransportLayerAddress */ + F1AP_CP_TransportLayerAddress_t transportLayerAddress; + memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; + // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); + // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + + gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress; + + + /* ADD */ + gnb_cu_tnl_association_to_remove_item_ies->value.choice.GNB_CU_TNL_Association_To_Remove_Item = gnb_cu_tnl_association_to_remove_item; + ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, + gnb_cu_tnl_association_to_remove_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c6. GNB_CU_TNL_Association_To_Update_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Update_List; + for (i=0; + i<1; + i++) { + + F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *gnb_cu_tnl_association_to_update_item_ies; + gnb_cu_tnl_association_to_update_item_ies = (F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t)); + gnb_cu_tnl_association_to_update_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item; + gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; + + /* 4.1 GNB_CU_TNL_Association_To_Update_Item */ + F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item; + memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t)); + + + /* 4.1.1 tNLAssociationTransportLayerAddress */ + F1AP_CP_TransportLayerAddress_t transportLayerAddress; + memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); + // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; + // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); + // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + + gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress; + + + /* 4.1.2 tNLAssociationUsage */ + if (1) { + gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t)); + *gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; + } + + /* ADD */ + gnb_cu_tnl_association_to_update_item_ies->value.choice.GNB_CU_TNL_Association_To_Update_Item = gnb_cu_tnl_association_to_update_item; + ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Update_List.list, + gnb_cu_tnl_association_to_update_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c7. Cells_to_be_Barred_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Barred_List; + for (i=0; + i<1; + i++) { + + F1AP_Cells_to_be_Barred_ItemIEs_t *cells_to_be_barred_item_ies; + cells_to_be_barred_item_ies = (F1AP_Cells_to_be_Barred_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Barred_ItemIEs_t)); + cells_to_be_barred_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_barred_item_ies->criticality = F1AP_Criticality_reject; + cells_to_be_barred_item_ies->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item; + + /* 7.1 cells to be Deactivated list item */ + F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item; + memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + cells_to_be_barred_item.nRCGI = nRCGI; + + /* 7.2 cellBarred*/ + cells_to_be_barred_item.cellBarred = F1AP_CellBarred_not_barred; + + /* ADD */ + cells_to_be_barred_item_ies->value.choice.Cells_to_be_Barred_Item = cells_to_be_barred_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Barred_List.list, + cells_to_be_barred_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + + /* mandatory */ + /* c8. Protected_EUTRA_Resources_List */ + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Protected_EUTRA_Resources_List; + + for (i=0; + i<1; + i++) { + + + F1AP_Protected_EUTRA_Resources_ItemIEs_t *protected_eutra_resources_item_ies; + + /* 8.1 SpectrumSharingGroupID */ + protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); + protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; + protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; + protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_SpectrumSharingGroupID; + protected_eutra_resources_item_ies->value.choice.SpectrumSharingGroupID = 1L; + + ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); + + /* 8.2 ListofEUTRACellsinGNBDUCoordination */ + protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); + protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; + protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; + protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_ListofEUTRACellsinGNBDUCoordination; + + F1AP_Served_EUTRA_Cells_Information_t served_eutra_cells_information; + memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t)); + + F1AP_EUTRA_Mode_Info_t eUTRA_Mode_Info; + memset((void *)&eUTRA_Mode_Info, 0, sizeof(F1AP_EUTRA_Mode_Info_t)); + + // eUTRAFDD + eUTRA_Mode_Info.present = F1AP_EUTRA_Mode_Info_PR_eUTRAFDD; + F1AP_EUTRA_FDD_Info_t *eutra_fdd_info; + eutra_fdd_info = (F1AP_EUTRA_FDD_Info_t *)calloc(1, sizeof(F1AP_EUTRA_FDD_Info_t)); + eutra_fdd_info->uL_offsetToPointA = 123L; + eutra_fdd_info->dL_offsetToPointA = 456L; + eUTRA_Mode_Info.choice.eUTRAFDD = eutra_fdd_info; + + // eUTRATDD + // eUTRA_Mode_Info.present = F1AP_EUTRA_Mode_Info_PR_eUTRATDD; + // F1AP_EUTRA_TDD_Info_t *eutra_tdd_info; + // eutra_tdd_info = (F1AP_EUTRA_TDD_Info_t *)calloc(1, sizeof(F1AP_EUTRA_TDD_Info_t)); + // eutra_tdd_info->uL_offsetToPointA = 123L; + // eutra_tdd_info->dL_offsetToPointA = 456L; + // eUTRA_Mode_Info.choice.eUTRATDD = eutra_tdd_info; + + served_eutra_cells_information.eUTRA_Mode_Info = eUTRA_Mode_Info; + + OCTET_STRING_fromBuf(&served_eutra_cells_information.protectedEUTRAResourceIndication, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + + ASN_SEQUENCE_ADD(&protected_eutra_resources_item_ies->value.choice.ListofEUTRACellsinGNBDUCoordination.list, &served_eutra_cells_information); + + ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return; + } + + printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } +} + +void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h new file mode 100644 index 0000000000..a0b0ddb20c --- /dev/null +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -0,0 +1,44 @@ +/* + * 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 f1ap_cu_interface_management.h + * \brief f1ap interface management for CU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#ifndef F1AP_CU_INTERFACE_MANAGEMENT_H_ +#define F1AP_CU_INTERFACE_MANAGEMENT_H_ + +int CU_handle_F1_SETUP_REQUEST(uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp); + +void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure); + +#endif /* F1AP_CU_INTERFACE_MANAGEMENT_H_ */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_defs.h b/openair2/F1AP/f1ap_cu_paging.c similarity index 81% rename from openair2/F1AP/f1ap_du_defs.h rename to openair2/F1AP/f1ap_cu_paging.c index e8f18b0c12..b6bbedba2f 100644 --- a/openair2/F1AP/f1ap_du_defs.h +++ b/openair2/F1AP/f1ap_cu_paging.c @@ -19,9 +19,13 @@ * contact@openairinterface.org */ - -#ifndef DU_F1AP_DEFS_H_ -#define DU_F1AP_DEFS_H_ - - -#endif /* DU_F1AP_DEFS_H_ */ +/*! \file f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_defs.h b/openair2/F1AP/f1ap_cu_paging.h similarity index 81% rename from openair2/F1AP/f1ap_cu_defs.h rename to openair2/F1AP/f1ap_cu_paging.h index f569478367..b6bbedba2f 100644 --- a/openair2/F1AP/f1ap_cu_defs.h +++ b/openair2/F1AP/f1ap_cu_paging.h @@ -19,9 +19,13 @@ * contact@openairinterface.org */ - -#ifndef CU_F1AP_DEFS_H_ -#define CU_F1AP_DEFS_H_ - - -#endif /* CU_F1AP_DEFS_H_ */ +/*! \file f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c new file mode 100644 index 0000000000..b2a58a77bd --- /dev/null +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -0,0 +1,170 @@ +/* + * 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 f1ap_cu_rrc_message_transfer.c + * \brief f1ap rrc message transfer for CU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include "f1ap_common.h" +#include "f1ap_cu_rrc_message_transfer.h" + +/* + Initial UL RRC Message Transfer +*/ + +void CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(void) { + + printf("CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER\n"); + // decode the F1 message + // get the rrc message from the contauiner + // call func rrc_eNB_decode_ccch: <-- needs some update here + + // if size > 0 + // CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size) +} + + +/* + DL RRC Message Transfer. +*/ + +//void CU_send_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { +void CU_send_DL_RRC_MESSAGE_TRANSFER(void) { + F1AP_F1AP_PDU_t pdu; + F1AP_DLRRCMessageTransfer_t *out; + F1AP_DLRRCMessageTransferIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_DLRRCMessageTransfer; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer; + out = &pdu.choice.initiatingMessage->value.choice.DLRRCMessageTransfer; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. oldgNB_DU_UE_F1AP_ID */ + if (0) { + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + //ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING; + //ie->value.choice. = 1; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c4. SRBID */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID; + ie->value.choice.SRBID = 2L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c5. ExecuteDuplication */ + if (0) { + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ExecuteDuplication; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_ExecuteDuplication; + ie->value.choice.ExecuteDuplication = F1AP_ExecuteDuplication_true; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + // issue in here + /* mandatory */ + /* c6. RRCContainer */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "A", strlen("A")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c7. RAT_FrequencyPriorityInformation */ + if (0) { + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation; + + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 123L; + + //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; + //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } + //AssertFatal(1==0,"Not implemented yet\n"); +} + +/* + UL RRC Message Transfer +*/ + +void CU_handle_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { + AssertFatal(1==0,"Not implemented yet\n"); +} diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h new file mode 100644 index 0000000000..24d5a7528a --- /dev/null +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h @@ -0,0 +1,36 @@ +/* + * 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 f1ap_cu_rrc_message_transfer.h + * \brief f1ap rrc message transfer for CU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#ifndef F1AP_CU_RRC_MESSAGE_TRANSFER_H_ +#define F1AP_CU_RRC_MESSAGE_TRANSFER_H_ + +#endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du.h b/openair2/F1AP/f1ap_cu_system_information.c similarity index 81% rename from openair2/F1AP/f1ap_du.h rename to openair2/F1AP/f1ap_cu_system_information.c index ea2463662a..b6bbedba2f 100644 --- a/openair2/F1AP/f1ap_du.h +++ b/openair2/F1AP/f1ap_cu_system_information.c @@ -19,8 +19,13 @@ * contact@openairinterface.org */ -#ifndef DU_F1AP_DEFS_H_ -#define DU_F1AP_DEFS_H_ - - -#endif /* DU_F1AP_DEFS_H_ */ +/*! \file f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_system_information.h b/openair2/F1AP/f1ap_cu_system_information.h new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_cu_system_information.h @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c new file mode 100644 index 0000000000..742e57b404 --- /dev/null +++ b/openair2/F1AP/f1ap_cu_task.c @@ -0,0 +1,172 @@ +/* + * 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 openair2/F1AP/CU_F1AP.c +* \brief data structures for F1 interface modules +* \author EURECOM/NTUST +* \date 2018 +* \version 0.1 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, bing-kai.hong@eurecom.fr +* \note +* \warning +*/ + +#include "f1ap_common.h" +#include "f1ap_handlers.h" +#include "f1ap_cu_interface_management.h" +#include "f1ap_cu_task.h" + +extern RAN_CONTEXT_t RC; + +f1ap_setup_req_t *f1ap_du_data_from_du; + +void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { + // Nothing +} + +void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { + + DevAssert(sctp_new_association_resp != NULL); + + if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { + LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + sctp_new_association_resp->sctp_state, + instance, + sctp_new_association_resp->ulp_cnx_id); + + //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); + return; // exit -1 for debugging + } + + // go to an init func + f1ap_du_data_from_du = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); + // save the assoc id + f1ap_du_data_from_du->assoc_id = sctp_new_association_resp->assoc_id; + f1ap_du_data_from_du->sctp_in_streams = sctp_new_association_resp->in_streams; + f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams; +} + +void cu_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { + int result; + + DevAssert(sctp_data_ind != NULL); + + f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, + sctp_data_ind->buffer, sctp_data_ind->buffer_length); + + result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); +} + +void cu_task_send_sctp_init_req(instance_t enb_id) { + // 1. get the itti msg, and retrive the enb_id from the message + // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port + // 3. creat an itti message to init + + LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ(create socket)\n"); + MessageDef *message_p = NULL; + + message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); + message_p->ittiMsg.sctp_init.port = F1AP_PORT_NUMBER; + message_p->ittiMsg.sctp_init.ppid = F1AP_SCTP_PPID; + message_p->ittiMsg.sctp_init.ipv4 = 1; + message_p->ittiMsg.sctp_init.ipv6 = 0; + message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; + message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr); + /* + * SR WARNING: ipv6 multi-homing fails sometimes for localhost. + * * * * Disable it for now. + */ + message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0; + message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1"; + + itti_send_msg_to_task(TASK_SCTP, enb_id, message_p); +} + + +void *F1AP_CU_task(void *arg) { + + MessageDef *received_msg = NULL; + int result; + + LOG_I(CU_F1AP,"Starting F1AP at CU\n"); + + itti_mark_task_ready(TASK_CU_F1); + + cu_task_send_sctp_init_req(0); + + while (1) { + itti_receive_msg(TASK_CU_F1, &received_msg); + switch (ITTI_MSG_ID(received_msg)) { + + case SCTP_NEW_ASSOCIATION_IND: + LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND\n"); + cu_task_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_ind); + break; + + case SCTP_NEW_ASSOCIATION_RESP: + LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); + cu_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_resp); + break; + + case SCTP_DATA_IND: + LOG_I(CU_F1AP, "SCTP_DATA_IND\n"); + cu_task_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + break; + + case F1AP_SETUP_RESP: // from rrc + LOG_W(CU_F1AP, "F1AP_SETUP_RESP\n"); + // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // &F1AP_SETUP_RESP(received_msg)); + CU_send_F1_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_SETUP_RESP(received_msg)); + break; + + +// case F1AP_SETUP_RESPONSE: // This is from RRC +// CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) +// break; + +// case F1AP_SETUP_FAILURE: // This is from RRC +// CU_send_F1_SETUP_FAILURE(instance, *f1ap_setup_ind, &(F1AP_SETUP_FAILURE) f1ap_setup_failure) +// break; + + case TERMINATE_MESSAGE: + LOG_W(CU_F1AP, " *** Exiting CU_F1AP thread\n"); + itti_exit_task(); + break; + + default: + LOG_E(CU_F1AP, "CU Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + break; + } // switch + 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; + } // while + + return NULL; +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_task.h b/openair2/F1AP/f1ap_cu_task.h index 6904672f58..b12b22dc78 100644 --- a/openair2/F1AP/f1ap_cu_task.h +++ b/openair2/F1AP/f1ap_cu_task.h @@ -22,6 +22,11 @@ #ifndef CU_F1AP_TASK_H_ #define CU_F1AP_TASK_H_ +void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind); +void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); +void cu_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind); +void cu_task_send_sctp_init_req(instance_t enb_id); + void *F1AP_CU_task(void *arg); #endif /* CU_F1AP_TASK_H_ */ diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c new file mode 100644 index 0000000000..5be5e25ec0 --- /dev/null +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -0,0 +1,892 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +/* + UE Context Setup +*/ + +#include "f1ap_common.h" + +//void CU_send_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { +void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextSetupRequest_t *out; + F1AP_UEContextSetupRequestIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0; + + // for test + int mcc = 208; + int mnc = 93; + int mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextSetupRequest; + out = &pdu.choice.initiatingMessage->value.choice.UEContextSetupRequest; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c2. GNB_DU_UE_F1AP_ID */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c3. SpCell_ID */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI; + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + ie->value.choice.NRCGI = nRCGI; + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c4. ServCellIndex */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; + ie->value.choice.ServCellIndex = 2; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c5. CellULConfigured */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SpCellULConfigured; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CellULConfigured; + ie->value.choice.CellULConfigured = F1AP_CellULConfigured_ul; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c6. CUtoDURRCInformation */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; + ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); + /* optional */ + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); + /* optional */ + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c7. Candidate_SpCell_List */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; + + for (i=0; + i<1; + i++) { + + F1AP_Candidate_SpCell_ItemIEs_t *candidate_spCell_item_ies; + candidate_spCell_item_ies = (F1AP_Candidate_SpCell_ItemIEs_t *)calloc(1, sizeof(F1AP_Candidate_SpCell_ItemIEs_t)); + candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 + candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; + candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; + + /* 5.1 Candidate_SpCell_Item */ + F1AP_Candidate_SpCell_Item_t candidate_spCell_item; + memset((void *)&candidate_spCell_item, 0, sizeof(F1AP_Candidate_SpCell_Item_t)); + + /* - candidate_SpCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + candidate_spCell_item.candidate_SpCell_ID = nRCGI; + + /* ADD */ + candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item = candidate_spCell_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Candidate_SpCell_List.list, + candidate_spCell_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c8. DRXCycle */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRXCycle; + ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + if (0) { + ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); + *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum + } + if (0) { + ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); + *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c9. ResourceCoordinationTransferContainer */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ResourceCoordinationTransferContainer; + + ie->value.choice.ResourceCoordinationTransferContainer.buf = malloc(4); + ie->value.choice.ResourceCoordinationTransferContainer.size = 4; + *ie->value.choice.ResourceCoordinationTransferContainer.buf = "123"; + + + OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c10. SCell_ToBeSetup_List */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_ToBeSetup_ItemIEs_t *scell_toBeSetup_item_ies; + scell_toBeSetup_item_ies = (F1AP_SCell_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeSetup_ItemIEs_t)); + scell_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_Item; //53 + scell_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeSetup_item_ies->value.present = F1AP_SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; + + /* 8.1 SCell_ToBeSetup_Item */ + F1AP_SCell_ToBeSetup_Item_t scell_toBeSetup_item; + memset((void *)&scell_toBeSetup_item, 0, sizeof(F1AP_SCell_ToBeSetup_Item_t)); + + // /* - sCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + scell_toBeSetup_item.sCell_ID = nRCGI; + + /* sCellIndex */ + scell_toBeSetup_item.sCellIndex = 3; // issue here + // /* ADD */ + scell_toBeSetup_item_ies->value.choice.SCell_ToBeSetup_Item = scell_toBeSetup_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetup_List.list, + scell_toBeSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* mandatory */ + /* c11. SRBs_ToBeSetup_List */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List; + ie->criticality = F1AP_Criticality_reject; // ? + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_ToBeSetup_ItemIEs_t *srbs_toBeSetup_item_ies; + srbs_toBeSetup_item_ies = (F1AP_SRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeSetup_ItemIEs_t)); + srbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_Item; // 73 + srbs_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + srbs_toBeSetup_item_ies->value.present = F1AP_SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; + + /* 9.1 SRBs_ToBeSetup_Item */ + F1AP_SRBs_ToBeSetup_Item_t srbs_toBeSetup_item; + memset((void *)&srbs_toBeSetup_item, 0, sizeof(F1AP_SRBs_ToBeSetup_Item_t)); + + /* - sRBID */ + srbs_toBeSetup_item.sRBID = 2L; + + /* ADD */ + srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item = srbs_toBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetup_List.list, + srbs_toBeSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c12. DRBs_ToBeSetup_List */ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_ToBeSetup_ItemIEs_t *drbs_toBeSetup_item_ies; + drbs_toBeSetup_item_ies = (F1AP_DRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetup_ItemIEs_t)); + drbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_Item; + drbs_toBeSetup_item_ies->criticality = F1AP_Criticality_reject; + drbs_toBeSetup_item_ies->value.present = F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; + + /* 10.1 DRBs_ToBeSetup_Item */ + F1AP_DRBs_ToBeSetup_Item_t drbs_toBeSetup_item; + memset((void *)&drbs_toBeSetup_item, 0, sizeof(F1AP_DRBs_ToBeSetup_Item_t)); + + /* dRBID */ + drbs_toBeSetup_item.dRBID = 30L; + + /* qoSInformation */ + drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; + + /* ULTunnels_ToBeSetup_List */ + int maxnoofULTunnels = 1; // 2; + for (i=0; + i<maxnoofULTunnels; + i++) { + /* ULTunnels_ToBeSetup_Item */ + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; + + // gTPTunnel + uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1234", + strlen("1234")); + + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); + } + + /* rLCMode */ + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; // enum + + /* OPTIONAL */ + /* ULConfiguration */ + if (0) { + drbs_toBeSetup_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + } + + /* ADD */ + drbs_toBeSetup_item_ies->value.choice.DRBs_ToBeSetup_Item = drbs_toBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeSetup_List.list, + drbs_toBeSetup_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* OPTIONAL */ + if (0) { + //F1AP_InactivityMonitoringRequest_t InactivityMonitoringRequest; + //F1AP_RAT_FrequencyPriorityInformation_t RAT_FrequencyPriorityInformation; + //F1AP_RRCContainer_t RRCContainer; + //F1AP_MaskedIMEISV_t MaskedIMEISV; + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return; + } + + printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } + //AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + UE Context Release (gNB-CU initiated) +*/ + +void CU_handle_UE_CONTEXT_RELEASE_REQUEST(F1AP_UEContextReleaseRequest_t *UEContextReleaseRequest) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_send_UE_CONTEXT_RELEASE_COMMAND(F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void CU_handle_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UEContextReleaseComplete) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + UE Context Modification Required (gNB-DU initiated) +*/ + +//void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { +void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextModificationRequest_t *out; + F1AP_UEContextModificationRequestIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0; + + // for test + int mcc = 208; + int mnc = 93; + int mnc_digit_length = 8; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextModification; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextModificationRequest; + out = &pdu.choice.initiatingMessage->value.choice.UEContextModificationRequest; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. NRCGI */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_NRCGI; + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + ie->value.choice.NRCGI = nRCGI; + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c4. ServCellIndex */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex; + ie->value.choice.ServCellIndex = 5L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c5. DRXCycle */ + if (0) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRXCycle; + ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + if (0) { + ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); + *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum + } + if (0) { + ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); + *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c5. CUtoDURRCInformation */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_CUtoDURRCInformation; + ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); + /* optional */ + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); + /* optional */ + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c6. TransmissionStopIndicator */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransmissionStopIndicator; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionStopIndicator; + ie->value.choice.TransmissionStopIndicator = F1AP_TransmissionStopIndicator_true; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c7. ResourceCoordinationTransferContainer */ + if (0) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c7. RRCRconfigurationCompleteIndicator */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCRconfigurationCompleteIndicator; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCRconfigurationCompleteIndicator; + ie->value.choice.RRCRconfigurationCompleteIndicator = F1AP_RRCRconfigurationCompleteIndicator_true; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c8. RRCContainer */ + if (1) { + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c9. SCell_ToBeSetupMod_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_ToBeSetupMod_ItemIEs_t *scell_toBeSetupMod_item_ies; + scell_toBeSetupMod_item_ies = (F1AP_SCell_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeSetupMod_ItemIEs_t)); + //memset((void *)&scell_toBeSetupMod_item_ies, 0, sizeof(F1AP_SCell_ToBeSetupMod_ItemIEs_t)); + scell_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_Item; + scell_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeSetupMod_item_ies->value.present = F1AP_SCell_ToBeSetupMod_ItemIEs__value_PR_SCell_ToBeSetupMod_Item; + + /* 8.1 SCell_ToBeSetup_Item */ + F1AP_SCell_ToBeSetupMod_Item_t scell_toBeSetupMod_item; + memset((void *)&scell_toBeSetupMod_item, 0, sizeof(F1AP_SCell_ToBeSetupMod_Item_t)); + + // /* - sCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + scell_toBeSetupMod_item.sCell_ID = nRCGI; + + /* sCellIndex */ + scell_toBeSetupMod_item.sCellIndex = 6; // issue here + + // /* ADD */ + scell_toBeSetupMod_item_ies->value.choice.SCell_ToBeSetupMod_Item = scell_toBeSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetupMod_List.list, + scell_toBeSetupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c10. SCell_ToBeRemoved_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeRemoved_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_ToBeRemoved_ItemIEs_t *scell_toBeRemoved_item_ies; + scell_toBeRemoved_item_ies = (F1AP_SCell_ToBeRemoved_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); + //memset((void *)&scell_toBeRemoved_item_ies, 0, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); + scell_toBeRemoved_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_Item; + scell_toBeRemoved_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeRemoved_item_ies->value.present = F1AP_SCell_ToBeRemoved_ItemIEs__value_PR_SCell_ToBeRemoved_Item; + + /* 10.1 SCell_ToBeRemoved_Item */ + F1AP_SCell_ToBeRemoved_Item_t scell_toBeRemoved_item; + memset((void *)&scell_toBeRemoved_item, 0, sizeof(F1AP_SCell_ToBeRemoved_Item_t)); + + /* - sCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + scell_toBeRemoved_item.sCell_ID = nRCGI; + + /* ADD */ + scell_toBeRemoved_item_ies->value.choice.SCell_ToBeRemoved_Item = scell_toBeRemoved_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeRemoved_List.list, + scell_toBeRemoved_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c11. SRBs_ToBeSetupMod_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_ToBeSetupMod_ItemIEs_t *srbs_toBeSetupMod_item_ies; + srbs_toBeSetupMod_item_ies = (F1AP_SRBs_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeSetupMod_ItemIEs_t)); + //memset((void *)&srbs_toBeSetupMod_item_ies, 0, sizeof(F1AP_SRBs_ToBeSetupMod_ItemIEs_t)); + srbs_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_Item; + srbs_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + srbs_toBeSetupMod_item_ies->value.present = F1AP_SRBs_ToBeSetupMod_ItemIEs__value_PR_SRBs_ToBeSetupMod_Item; + + /* 9.1 SRBs_ToBeSetupMod_Item */ + F1AP_SRBs_ToBeSetupMod_Item_t srbs_toBeSetupMod_item; + memset((void *)&srbs_toBeSetupMod_item, 0, sizeof(F1AP_SRBs_ToBeSetupMod_Item_t)); + + /* - sRBID */ + srbs_toBeSetupMod_item.sRBID = 3L; + + /* ADD */ + srbs_toBeSetupMod_item_ies->value.choice.SRBs_ToBeSetupMod_Item = srbs_toBeSetupMod_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetupMod_List.list, + srbs_toBeSetupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c12. DRBs_ToBeSetupMod_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_ToBeSetupMod_ItemIEs_t *drbs_toBeSetupMod_item_ies; + drbs_toBeSetupMod_item_ies = (F1AP_DRBs_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetupMod_ItemIEs_t)); + drbs_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item; + drbs_toBeSetupMod_item_ies->criticality = F1AP_Criticality_reject; + drbs_toBeSetupMod_item_ies->value.present = F1AP_DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item; + + /* 12.1 DRBs_ToBeSetupMod_Item */ + F1AP_DRBs_ToBeSetupMod_Item_t drbs_toBeSetupMod_item; + memset((void *)&drbs_toBeSetupMod_item, 0, sizeof(F1AP_DRBs_ToBeSetupMod_Item_t)); + + /* dRBID */ + drbs_toBeSetupMod_item.dRBID = 30L; + + /* qoSInformation */ + drbs_toBeSetupMod_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS->qCI = 253L; + + /* ULTunnels_ToBeSetupMod_List */ + int j = 0; + int maxnoofULTunnels = 1; // 2; + for (j=0; + j<maxnoofULTunnels; + j++) { + /* ULTunnels_ToBeSetup_Item */ + + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; + uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "4567", + strlen("4567")); + + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_toBeSetupMod_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); + } + + /* rLCMode */ + drbs_toBeSetupMod_item.rLCMode = F1AP_RLCMode_rlc_um; // enum + + /* OPTIONAL */ + /* ULConfiguration */ + if (0) { + drbs_toBeSetupMod_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + } + + /* ADD */ + drbs_toBeSetupMod_item_ies->value.choice.DRBs_ToBeSetupMod_Item = drbs_toBeSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeSetupMod_List.list, + drbs_toBeSetupMod_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c13. DRBs_ToBeModified_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_ToBeModified_ItemIEs_t *drbs_toBeModified_item_ies; + drbs_toBeModified_item_ies = (F1AP_DRBs_ToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeModified_ItemIEs_t)); + drbs_toBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_Item; + drbs_toBeModified_item_ies->criticality = F1AP_Criticality_reject; + drbs_toBeModified_item_ies->value.present = F1AP_DRBs_ToBeModified_ItemIEs__value_PR_DRBs_ToBeModified_Item; + + /* 13.1 SRBs_ToBeModified_Item */ + F1AP_DRBs_ToBeModified_Item_t drbs_toBeModified_item; + memset((void *)&drbs_toBeModified_item, 0, sizeof(F1AP_DRBs_ToBeModified_Item_t)); + + /* dRBID */ + drbs_toBeModified_item.dRBID = 30L; + + /* qoSInformation */ + drbs_toBeModified_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; + + /* ULTunnels_ToBeModified_List */ + int j = 0; + int maxnoofULTunnels = 1; // 2; + for (j=0; + j<maxnoofULTunnels; + j++) { + /* ULTunnels_ToBeModified_Item */ + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; + uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_toBeModified_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); + } + + /* OPTIONAL */ + /* ULConfiguration */ + if (0) { + drbs_toBeModified_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + } + + /* ADD */ + drbs_toBeModified_item_ies->value.choice.DRBs_ToBeModified_Item = drbs_toBeModified_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeModified_List.list, + drbs_toBeModified_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c14. SRBs_ToBeReleased_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeReleased_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_ToBeReleased_ItemIEs_t *srbs_toBeReleased_item_ies; + srbs_toBeReleased_item_ies = (F1AP_SRBs_ToBeReleased_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeReleased_ItemIEs_t)); + //memset((void *)&srbs_toBeReleased_item_ies, 0, sizeof(F1AP_SRBs_ToBeReleased_ItemIEs_t)); + srbs_toBeReleased_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_Item; + srbs_toBeReleased_item_ies->criticality = F1AP_Criticality_ignore; + srbs_toBeReleased_item_ies->value.present = F1AP_SRBs_ToBeReleased_ItemIEs__value_PR_SRBs_ToBeReleased_Item; + + /* 9.1 SRBs_ToBeReleased_Item */ + F1AP_SRBs_ToBeReleased_Item_t srbs_toBeReleased_item; + memset((void *)&srbs_toBeReleased_item, 0, sizeof(F1AP_SRBs_ToBeReleased_Item_t)); + + /* - sRBID */ + srbs_toBeReleased_item.sRBID = 2L; + + /* ADD */ + srbs_toBeReleased_item_ies->value.choice.SRBs_ToBeReleased_Item = srbs_toBeReleased_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeReleased_List.list, + srbs_toBeReleased_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c15. DRBs_ToBeReleased_List */ + ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_ToBeReleased_ItemIEs_t *drbs_toBeReleased_item_ies; + drbs_toBeReleased_item_ies = (F1AP_DRBs_ToBeReleased_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeReleased_ItemIEs_t)); + drbs_toBeReleased_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_Item; + drbs_toBeReleased_item_ies->criticality = F1AP_Criticality_reject; + drbs_toBeReleased_item_ies->value.present = F1AP_DRBs_ToBeReleased_ItemIEs__value_PR_DRBs_ToBeReleased_Item; + + /* 14.1 SRBs_ToBeReleased_Item */ + F1AP_DRBs_ToBeReleased_Item_t drbs_toBeReleased_item; + memset((void *)&drbs_toBeReleased_item, 0, sizeof(F1AP_DRBs_ToBeReleased_Item_t)); + + /* dRBID */ + drbs_toBeReleased_item.dRBID = 30L; + + /* ADD */ + drbs_toBeReleased_item_ies->value.choice.DRBs_ToBeReleased_Item = drbs_toBeReleased_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeReleased_List.list, + drbs_toBeReleased_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return; + } + + printf("\n"); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } + +} + +void CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(F1AP_UEContextModificationFailure_t EContextModificationFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(F1AP_UEContextModificationRequired_t *UEContextModificationRequired) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { + AssertFatal(1==0,"Not implemented yet\n"); +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_warning_message_transmission.c b/openair2/F1AP/f1ap_cu_warning_message_transmission.c new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_cu_warning_message_transmission.c @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_cu_warning_message_transmission.h b/openair2/F1AP/f1ap_cu_warning_message_transmission.h new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_cu_warning_message_transmission.h @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 559b8f77d7..53d68c09ca 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -30,12 +30,6 @@ * \warning */ -#include <stdio.h> - -#include "assertions.h" - -#include "intertask_interface.h" - #include "f1ap_common.h" #include "f1ap_decoder.h" diff --git a/openair2/F1AP/f1ap_decoder.h b/openair2/F1AP/f1ap_decoder.h index c8522d6ca5..57814db34d 100644 --- a/openair2/F1AP/f1ap_decoder.h +++ b/openair2/F1AP/f1ap_decoder.h @@ -33,8 +33,6 @@ #ifndef F1AP_ENB_ENCODER_H_ #define F1AP_ENB_ENCODER_H_ -#include "f1ap_common.h" - int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length) __attribute__ ((warn_unused_result)); diff --git a/openair2/F1AP/f1ap_du.c b/openair2/F1AP/f1ap_du.c deleted file mode 100644 index a74ff2ff2c..0000000000 --- a/openair2/F1AP/f1ap_du.c +++ /dev/null @@ -1,1921 +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 openair2/F1AP/DU_F1AP.c -* \brief data structures for F1 interface modules -* \author EURECOM/NTUST -* \date 2018 -* \version 0.1 -* \company Eurecom -* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, bing-kai.hong@eurecom.fr -* \note -* \warning -*/ - -#include "conversions.h" -#include "f1ap_common.h" -#include "f1ap_du_defs.h" -#include "f1ap_encoder.h" -#include "f1ap_decoder.h" -#include "f1ap_du_task.h" -#include "platform_types.h" -#include "common/utils/LOG/log.h" -#include "intertask_interface.h" -#include "f1ap_itti_messaging.h" - -#include "T.h" - -static f1ap_setup_req_t *f1ap_du_data; - -uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { - static uint8_t UE_identifier[NUMBER_OF_eNB_MAX]; - UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER; - //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]); - return UE_identifier[enb_mod_idP+CC_idP+UE_id]; -} - -// ============================================================================== -static -void DU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) -{ - int result; - - DevAssert(sctp_data_ind != NULL); - - f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); - - result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); -} - -void *F1AP_DU_task(void *arg) { - - //sctp_cu_init(); - MessageDef *received_msg = NULL; - int result; - - LOG_I(DU_F1AP, "Starting F1AP at DU\n"); - - //f1ap_eNB_prepare_internal_data(); - - itti_mark_task_ready(TASK_DU_F1); - - // SCTP - while (1) { - itti_receive_msg(TASK_DU_F1, &received_msg); - - switch (ITTI_MSG_ID(received_msg)) { - - // case TERMINATE_MESSAGE: - // //F1AP_WARN(" *** Exiting F1AP DU thread\n"); - // itti_exit_task(); - // break; - - case F1AP_SETUP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app - // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, - // 2. store the message in f1ap context, that is also stored in RC - // 2. send a sctp_association req - LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n"); - DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &F1AP_SETUP_REQ(received_msg)); - break; - - case SCTP_NEW_ASSOCIATION_RESP: - // 1. store the respon - // 2. send the f1setup_req - LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); - DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); - break; - - case SCTP_DATA_IND: - // ex: any F1 incoming message for DU ends here - LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); - DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); - break; - - case TERMINATE_MESSAGE: - LOG_W(DU_F1AP, " *** Exiting DU_F1AP thread\n"); - itti_exit_task(); - break; - - default: - LOG_E(DU_F1AP, "DU Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); - break; - } // switch - 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; - } // while - - return NULL; -} - -// ============================================================================== - -void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { - - DevAssert(f1ap_setup_req != NULL); - - MessageDef *message_p = NULL; - sctp_new_association_req_t *sctp_new_association_req_p = NULL; - - message_p = itti_alloc_new_message(TASK_DU_F1, SCTP_NEW_ASSOCIATION_REQ); - - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - sctp_new_association_req_p->ulp_cnx_id = instance; - sctp_new_association_req_p->port = F1AP_PORT_NUMBER; - sctp_new_association_req_p->ppid = F1AP_SCTP_PPID; - - sctp_new_association_req_p->in_streams = f1ap_setup_req->sctp_in_streams; - sctp_new_association_req_p->out_streams = f1ap_setup_req->sctp_out_streams; - - // remote - memcpy(&sctp_new_association_req_p->remote_address, - &f1ap_setup_req->CU_f1_ip_address, - sizeof(f1ap_setup_req->CU_f1_ip_address)); - - // local - memcpy(&sctp_new_association_req_p->local_address, - &f1ap_setup_req->DU_f1_ip_address, - sizeof(f1ap_setup_req->DU_f1_ip_address)); - - // store data - f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); - *f1ap_du_data = *f1ap_setup_req; - //printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]); - printf("sib f1ap context %s\n", f1ap_du_data->sib1[0]); - - //du_f1ap_register_to_sctp - itti_send_msg_to_task(TASK_SCTP, instance, message_p); -} - -void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { - - DevAssert(sctp_new_association_resp != NULL); - - if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); - - //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; // exit -1 for debugging - } - - // save the assoc id - f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; - f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; - f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; - - - DU_send_F1_SETUP_REQUEST(instance); -} - - -// ============================================================================== - - -// SETUP REQUEST -void DU_send_F1_SETUP_REQUEST(instance_t instance) { - module_id_t enb_mod_idP; - module_id_t du_mod_idP; - - F1AP_F1AP_PDU_t pdu; - F1AP_F1SetupRequest_t *out; - F1AP_F1SetupRequestIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - int j = 0; - - /* Create */ - /* 0. pdu Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_F1Setup; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_F1SetupRequest; - out = &pdu.choice.initiatingMessage->value.choice.F1SetupRequest; - - /* mandatory */ - /* c1. Transaction ID (integer value) */ - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c2. GNB_DU_ID (integrer value) */ - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID; - asn_int642INTEGER(&ie->value.choice.GNB_DU_ID, f1ap_du_data->gNB_DU_id); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c3. GNB_DU_Name */ - if (f1ap_du_data->gNB_DU_name != NULL) { - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name; - OCTET_STRING_fromBuf(&ie->value.choice.GNB_DU_Name, f1ap_du_data->gNB_DU_name, - strlen(f1ap_du_data->gNB_DU_name)); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* mandatory */ - /* c4. serverd cells list */ - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; - - int num_cells_available = f1ap_du_data->num_cells_available; - printf("num_cells_available = %d \n", num_cells_available); - for (i=0; - i<num_cells_available; - i++) { - /* mandatory */ - /* 4.1 serverd cells item */ - - F1AP_GNB_DU_Served_Cells_ItemIEs_t *gnb_du_served_cell_list_item_ies; - gnb_du_served_cell_list_item_ies = (F1AP_GNB_DU_Served_Cells_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_DU_Served_Cells_ItemIEs_t)); - gnb_du_served_cell_list_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_DU_Served_Cells_Item; - gnb_du_served_cell_list_item_ies->criticality = F1AP_Criticality_reject; - gnb_du_served_cell_list_item_ies->value.present = F1AP_GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item; - - - F1AP_GNB_DU_Served_Cells_Item_t gnb_du_served_cells_item; - memset((void *)&gnb_du_served_cells_item, 0, sizeof(F1AP_GNB_DU_Served_Cells_Item_t)); - - /* 4.1.1 serverd cell Information */ - F1AP_Served_Cell_Information_t served_cell_information; - - memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); - - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); - served_cell_information.nRCGI = nRCGI; - - /* - nRPCI */ - served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 - - /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - &f1ap_du_data->tac[i], - 3); - - /* - Configured_EPS_TAC */ - if(0){ - served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); - OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, - "2", - 2); - } - - /* - broadcast PLMNs */ - // RK: add the num_available_broadcast_PLMNs to the message - int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs; - printf("num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); - for (j=0; - j<num_available_broadcast_PLMNs; // num_available_broadcast_PLMNs - j++) { - /* > PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //MCC_MNC_TO_PLMNID(208, 95, 2, &broadcastPLMNs_Item->pLMN_Identity); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } - - // // /* - CHOICE NR-MODE-Info */ - F1AP_NR_Mode_Info_t nR_Mode_Info; - //f1ap_du_data->fdd_flag = 1; - if (f1ap_du_data->fdd_flag) { // FDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; - /* > FDD >> FDD Info */ - F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); - /* >>> UL NRFreqInfo */ - fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_arfcn; - - F1AP_FreqBandNrItem_t ul_freqBandNrItem; - memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 777L; - - F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; - memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); - - /* >>> DL NRFreqInfo */ - fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_arfcn; - - F1AP_FreqBandNrItem_t dl_freqBandNrItem; - memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 777L; - - F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; - memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - dl_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); - - /* >>> UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.ul_nrb; - /* >>> DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.dl_nrb; - - nR_Mode_Info.choice.fDD = fDD_Info; - } else { // TDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; - - /* > TDD >> TDD Info */ - F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); - /* >>> ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].tdd.nr_arfcn; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - // RK: missing params - nr_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; - memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - - tDD_Info->transmission_Bandwidth.nRSCS= f1ap_du_data->nr_mode_info[i].tdd.scs; - tDD_Info->transmission_Bandwidth.nRNRB= f1ap_du_data->nr_mode_info[i].tdd.nrb; - - nR_Mode_Info.choice.tDD = tDD_Info; - } - - served_cell_information.nR_Mode_Info = nR_Mode_Info; - - /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = "0"; //&f1ap_du_data->measurement_timing_information[i]; // sept. 2018 - - OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, - measurementTimingConfiguration, - strlen(measurementTimingConfiguration)); - gnb_du_served_cells_item.served_Cell_Information = served_cell_information; // - - /* 4.1.2 gNB-DU System Information */ - F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - f1ap_du_data->mib[i],//f1ap_du_data->mib, - f1ap_du_data->mib_length[i]); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - f1ap_du_data->sib1[i], - f1ap_du_data->sib1_length[i]); - - gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; // - - /* ADD */ - gnb_du_served_cell_list_item_ies->value.choice.GNB_DU_Served_Cells_Item = gnb_du_served_cells_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.GNB_DU_Served_Cells_List.list, - gnb_du_served_cell_list_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - } - - du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); -} - - -// SETUP SUCCESSFUL -void DU_handle_F1_SETUP_RESPONSE() { - - AssertFatal(0,"Not implemented yet\n"); - /* decode */ - //DU_F1AP_decode(args_p); - - /* handle */ - - /* save state */ -} - -// ============================================================================== - -// SETUP FAILURE -void DU_handle_F1_SETUP_FAILURE(struct F1AP_F1AP_PDU_t *pdu_p) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_send_ERROR_INDICATION(struct F1AP_F1AP_PDU_t *pdu_p) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_handle_RESET(F1AP_Reset_t *Reset) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_send_RESET(F1AP_Reset_t *Reset) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( - module_id_t module_idP, - int CC_idP, - int UE_id, - rnti_t rntiP, - uint8_t *sduP, - sdu_size_t sdu_lenP -) -{ - F1AP_F1AP_PDU_t pdu; - F1AP_InitialULRRCMessageTransfer_t *out; - F1AP_InitialULRRCMessageTransferIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_InitialULRRCMessageTransfer; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_InitialULRRCMessageTransfer; - out = &pdu.choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer; - - - /* mandatory */ - /* c1. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = F1AP_get_UE_identifier(module_idP, CC_idP, UE_id); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c2. NRCGI */ - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_NRCGI; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; - - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[0], f1ap_du_data->mnc[0], f1ap_du_data->mnc_digit_length[0], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - ie->value.choice.NRCGI = nRCGI; - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c3. C_RNTI */ // 16 - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_C_RNTI; - C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c4. RRCContainer */ - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c5. DUtoCURRCContainer */ - if (0) { - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, "dummy_val", - strlen("dummy_val")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - } - - printf("\n"); - - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //AssertFatal(1==0,"Not implemented yet\n"); -} - -//void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -void DU_send_UL_RRC_MESSAGE_TRANSFER(void) { - F1AP_F1AP_PDU_t pdu; - F1AP_ULRRCMessageTransfer_t *out; - F1AP_ULRRCMessageTransferIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_ULRRCMessageTransfer; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer; - out = &pdu.choice.initiatingMessage->value.choice.ULRRCMessageTransfer; - - /* mandatory */ - /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c3. SRBID */ - ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = 1; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - // issue in here - /* mandatory */ - /* c4. RRCContainer */ - ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - } - - printf("\n"); - - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_handle_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -//void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { -void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP, f1ap_setup_req_t *f1ap_du_data) { - F1AP_F1AP_PDU_t pdu; - F1AP_GNBDUConfigurationUpdate_t *out; - F1AP_GNBDUConfigurationUpdateIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - int j = 0; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBDUConfigurationUpdate; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate; - out = &pdu.choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; - - /* mandatory */ - /* c1. Transaction ID (integer value) */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* mandatory */ - /* c2. Served_Cells_To_Add */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Add_List; - - for (j=0; - j<1; - j++) { - // - F1AP_Served_Cells_To_Add_ItemIEs_t *served_cells_to_add_item_ies; - served_cells_to_add_item_ies = (F1AP_Served_Cells_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Add_ItemIEs_t)); - served_cells_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_Item; - served_cells_to_add_item_ies->criticality = F1AP_Criticality_reject; - served_cells_to_add_item_ies->value.present = F1AP_Served_Cells_To_Add_ItemIEs__value_PR_Served_Cells_To_Add_Item; - - F1AP_Served_Cells_To_Add_Item_t served_cells_to_add_item; - memset((void *)&served_cells_to_add_item, 0, sizeof(F1AP_Served_Cells_To_Add_Item_t)); - - /* 2.1.1 serverd cell Information */ - F1AP_Served_Cell_Information_t served_cell_information; - - memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - served_cell_information.nRCGI = nRCGI; - - /* - nRPCI */ - served_cell_information.nRPCI = 321L; // int 0..1007 - - /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - "10", - 3); - - /* - Configured_EPS_TAC */ - if(1){ - served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); - OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, - "2", - 2); - } - - /* - broadcast PLMNs */ - int maxnoofBPLMNS = 1; - for (i=0; - i<maxnoofBPLMNS; - i++) { - /* > PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } - - // // /* - CHOICE NR-MODE-Info */ - F1AP_NR_Mode_Info_t nR_Mode_Info; - - if ("FDD") { - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; - /* > FDD >> FDD Info */ - F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); - /* >>> UL NRFreqInfo */ - fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; - - F1AP_FreqBandNrItem_t ul_freqBandNrItem; - memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 888L; - - F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; - memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); - - /* >>> DL NRFreqInfo */ - fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; - - F1AP_FreqBandNrItem_t dl_freqBandNrItem; - memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; - memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); - - /* >>> UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - /* >>> DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - - nR_Mode_Info.choice.fDD = fDD_Info; - } else { // TDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; - - /* > TDD >> TDD Info */ - F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); - /* >>> ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - nr_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; - memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - - tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; - tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; - - nR_Mode_Info.choice.tDD = tDD_Info; - } - - served_cell_information.nR_Mode_Info = nR_Mode_Info; - - /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = "0"; // sept. 2018 - - OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, - measurementTimingConfiguration, - strlen(measurementTimingConfiguration)); - served_cells_to_add_item.served_Cell_Information = served_cell_information; // - - /* 2.1.2 gNB-DU System Information */ - F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - "1", - sizeof("1")); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - "1", - sizeof("1")); - served_cells_to_add_item.gNB_DU_System_Information = gNB_DU_System_Information; // - - /* ADD */ - served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item = served_cells_to_add_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Add_List.list, - served_cells_to_add_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* mandatory */ - /* c3. Served_Cells_To_Modify */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List; - - for (i=0; - i<1; - i++) { - // - F1AP_Served_Cells_To_Modify_ItemIEs_t *served_cells_to_modify_item_ies; - served_cells_to_modify_item_ies = (F1AP_Served_Cells_To_Modify_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Modify_ItemIEs_t)); - served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item; - served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject; - served_cells_to_modify_item_ies->value.present = F1AP_Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item; - - F1AP_Served_Cells_To_Modify_Item_t served_cells_to_modify_item; - memset((void *)&served_cells_to_modify_item, 0, sizeof(F1AP_Served_Cells_To_Modify_Item_t)); - - /* 3.1 oldNRCGI */ - F1AP_NRCGI_t oldNRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], - &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); - served_cells_to_modify_item.oldNRCGI = oldNRCGI; - - - /* 3.2.1 serverd cell Information */ - F1AP_Served_Cell_Information_t served_cell_information; - memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - served_cell_information.nRCGI = nRCGI; - - /* - nRPCI */ - served_cell_information.nRPCI = 321L; // int 0..1007 - - /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - "10", - 3); - - /* - Configured_EPS_TAC */ - if(1){ - served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); - OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, - "2", - 2); - } - - /* - broadcast PLMNs */ - int maxnoofBPLMNS = 1; - for (i=0; - i<maxnoofBPLMNS; - i++) { - /* > PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } - - // // /* - CHOICE NR-MODE-Info */ - F1AP_NR_Mode_Info_t nR_Mode_Info; - - if ("FDD") { - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; - /* > FDD >> FDD Info */ - F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); - /* >>> UL NRFreqInfo */ - fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; - - F1AP_FreqBandNrItem_t ul_freqBandNrItem; - memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 888L; - - F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; - memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); - - /* >>> DL NRFreqInfo */ - fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; - - F1AP_FreqBandNrItem_t dl_freqBandNrItem; - memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; - memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); - - /* >>> UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - /* >>> DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - - nR_Mode_Info.choice.fDD = fDD_Info; - } else { // TDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; - - /* > TDD >> TDD Info */ - F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); - /* >>> ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - nr_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; - memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - - tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; - tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; - - nR_Mode_Info.choice.tDD = tDD_Info; - } - - served_cell_information.nR_Mode_Info = nR_Mode_Info; - - /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = "0"; // sept. 2018 - - OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, - measurementTimingConfiguration, - strlen(measurementTimingConfiguration)); - served_cells_to_modify_item.served_Cell_Information = served_cell_information; // - - /* 3.2.2 gNB-DU System Information */ - F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - "1", - sizeof("1")); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - "1", - sizeof("1")); - served_cells_to_modify_item.gNB_DU_System_Information = gNB_DU_System_Information; // - - /* ADD */ - served_cells_to_modify_item_ies->value.choice.Served_Cells_To_Modify_Item = served_cells_to_modify_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Modify_List.list, - served_cells_to_modify_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* mandatory */ - /* c4. Served_Cells_To_Delete */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List; - - for (i=0; - i<1; - i++) { - // - F1AP_Served_Cells_To_Delete_ItemIEs_t *served_cells_to_delete_item_ies; - served_cells_to_delete_item_ies = (F1AP_Served_Cells_To_Delete_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Delete_ItemIEs_t)); - served_cells_to_delete_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_Item; - served_cells_to_delete_item_ies->criticality = F1AP_Criticality_reject; - served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; - - F1AP_Served_Cells_To_Delete_Item_t served_cells_to_delete_item; - memset((void *)&served_cells_to_delete_item, 0, sizeof(F1AP_Served_Cells_To_Delete_Item_t)); - - /* 3.1 oldNRCGI */ - F1AP_NRCGI_t oldNRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], - &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); - served_cells_to_delete_item.oldNRCGI = oldNRCGI; - - /* ADD */ - served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item = served_cells_to_delete_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Delete_List.list, - served_cells_to_delete_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* mandatory */ - /* c5. Active_Cells_List */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Active_Cells_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Active_Cells_List; - - for (i=0; - i<1; - i++) { - // - F1AP_Active_Cells_ItemIEs_t *active_cells_item_ies; - active_cells_item_ies = (F1AP_Active_Cells_ItemIEs_t *)calloc(1, sizeof(F1AP_Active_Cells_ItemIEs_t)); - active_cells_item_ies->id = F1AP_ProtocolIE_ID_id_Active_Cells_Item; - active_cells_item_ies->criticality = F1AP_Criticality_reject; - active_cells_item_ies->value.present = F1AP_Active_Cells_ItemIEs__value_PR_Active_Cells_Item; - - F1AP_Active_Cells_Item_t active_cells_item; - memset((void *)&active_cells_item, 0, sizeof(F1AP_Active_Cells_Item_t)); - - /* 3.1 oldNRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - active_cells_item.nRCGI = nRCGI; - - /* ADD */ - active_cells_item_ies->value.choice.Active_Cells_Item = active_cells_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Active_Cells_List.list, - active_cells_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - } - - printf("\n"); - - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } -} - -void DU_handle_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpdateAcknowledge_t GNBDUConfigurationUpdateAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void DU_handle_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_send_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void DU_handle_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -//void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { -void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { - F1AP_F1AP_PDU_t pdu; - F1AP_UEContextSetupResponse_t *out; - F1AP_UEContextSetupResponseIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); - pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; - pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse; - out = &pdu.choice.successfulOutcome->value.choice.UEContextSetupResponse; - - /* mandatory */ - /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c3. DUtoCURRCInformation */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; - - OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", - strlen("asdsa")); - /* OPTIONAL */ - if (0) { - ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); - OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa", - strlen("asdsa")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* optional */ - /* c4. ResourceCoordinationTransferContainer */ - if (0) { - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_ResourceCoordinationTransferContainer; - OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa", - strlen("asdsa")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - // /* */ - /* c5. DRBs_Setup_List */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_Setup_ItemIEs_t *drbs_setup_item_ies; - drbs_setup_item_ies = (F1AP_DRBs_Setup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_Setup_ItemIEs_t)); - drbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_Item; - drbs_setup_item_ies->criticality = F1AP_Criticality_ignore; - drbs_setup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; - - /* 5.1 DRBs_Setup_Item */ - F1AP_DRBs_Setup_Item_t drbs_setup_item; - memset((void *)&drbs_setup_item, 0, sizeof(F1AP_DRBs_Setup_Item_t)); - - drbs_setup_item.dRBID = 12; - - int j; - for (j=0; - j<1; - j++) { - - F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; - dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - - // F1AP_TransportLayerAddress_t transportLayerAddress; - // transportLayerAddress.buf = malloc((36+7)/8); - // transportLayerAddress.size = (36+7)/8; - // transportLayerAddress.bits_unused = 4; - // *transportLayerAddress.buf = 123; - // dLUPTNLInformation_ToBeSetup_Item.dL_GTP_Tunnel_EndPoint.transportLayerAddress = transportLayerAddress; - - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); - - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - - ASN_SEQUENCE_ADD(&drbs_setup_item.dLUPTNLInformation_ToBeSetup_List.list, - dLUPTNLInformation_ToBeSetup_Item); - } - - // /* ADD */ - drbs_setup_item_ies->value.choice.DRBs_Setup_Item = drbs_setup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Setup_List.list, - drbs_setup_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - // /* */ - /* c6. SRBs_FailedToBeSetup_List */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SRBs_FailedToBeSetup_ItemIEs_t *srbs_failedToBeSetup_item_ies; - srbs_failedToBeSetup_item_ies = (F1AP_SRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetup_ItemIEs_t)); - srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; - srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; - - /* 6.1 SRBs_Setup_Item */ - F1AP_SRBs_FailedToBeSetup_Item_t srbs_failedToBeSetup_item; - memset((void *)&srbs_failedToBeSetup_item, 0, sizeof(F1AP_SRBs_FailedToBeSetup_Item_t)); - - srbs_failedToBeSetup_item.sRBID = 13; - srbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - srbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; - srbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; - - // /* ADD */ - srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item = srbs_failedToBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetup_List.list, - srbs_failedToBeSetup_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - // /* */ - /* c7. DRBs_FailedToBeSetup_List */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_FailedToBeSetup_ItemIEs_t *drbs_failedToBeSetup_item_ies; - drbs_failedToBeSetup_item_ies = (F1AP_DRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetup_ItemIEs_t)); - drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; - drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; - - /* 7.1 DRBs_Setup_Item */ - F1AP_DRBs_FailedToBeSetup_Item_t drbs_failedToBeSetup_item; - memset((void *)&drbs_failedToBeSetup_item, 0, sizeof(F1AP_DRBs_FailedToBeSetup_Item_t)); - - drbs_failedToBeSetup_item.dRBID = 14; - drbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - drbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; - - // /* ADD */ - drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item = drbs_failedToBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetup_List.list, - drbs_failedToBeSetup_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - // /* */ - /* c8. SCell_FailedtoSetup_List */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SCell_FailedtoSetup_ItemIEs_t *sCell_FailedtoSetup_item_ies; - sCell_FailedtoSetup_item_ies = (F1AP_SCell_FailedtoSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetup_ItemIEs_t)); - sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; - sCell_FailedtoSetup_item_ies->criticality = F1AP_Criticality_ignore; - sCell_FailedtoSetup_item_ies->value.present = F1AP_SCell_FailedtoSetup_ItemIEs__value_PR_SCell_FailedtoSetup_Item; - - /* 8.1 DRBs_Setup_Item */ - F1AP_SCell_FailedtoSetup_Item_t sCell_FailedtoSetup_item; - memset((void *)&sCell_FailedtoSetup_item, 0, sizeof(F1AP_SCell_FailedtoSetup_Item_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; // issue here - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); -// - // INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); - // nRCGI.nRCellIdentity.buf = malloc((36+7)/8); - - // nRCGI.nRCellIdentity.size = (36+7)/8; - // nRCGI.nRCellIdentity.bits_unused = 4; - - // nRCGI.nRCellIdentity.buf[0] = 123; - - //nRCGI.nRCellIdentity = 15; - - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - - sCell_FailedtoSetup_item.sCell_ID = nRCGI; - - sCell_FailedtoSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - sCell_FailedtoSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; - sCell_FailedtoSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; - - // /* ADD */ - sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item = sCell_FailedtoSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetup_List.list, - sCell_FailedtoSetup_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - // /* */ - /* c9. CriticalityDiagnostics */ - if (0) { - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_CriticalityDiagnostics; - ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextSetup; - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); - *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; - ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; - ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - *ie->value.choice.CriticalityDiagnostics.transactionID = 0; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return; - } - - printf("\n"); - - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); -} - -void DU_send_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void DU_send_UE_CONTEXT_RELEASE_REQUEST(F1AP_UEContextReleaseRequest_t *UEContextReleaseRequest) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void DU_handle_UE_CONTEXT_RELEASE_COMMAND(F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -void DU_send_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UEContextReleaseComplete) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -//void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { -void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { - F1AP_F1AP_PDU_t pdu; - F1AP_UEContextModificationResponse_t *out; - F1AP_UEContextModificationResponseIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - - /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); - pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextModification; - pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse; - out = &pdu.choice.successfulOutcome->value.choice.UEContextModificationResponse; - - /* mandatory */ - /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* optional */ - /* c3. ResourceCoordinationTransferContainer */ - if (0) { - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_ResourceCoordinationTransferContainer; - OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* optional */ - /* c4. DUtoCURRCInformation */ - if (0) { - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation; - - OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - /* OPTIONAL */ - if (1) { - ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); - OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - } - - - /* mandatory */ - /* c5. DRBs_SetupMod_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_SetupMod_ItemIEs_t *drbs_setupMod_item_ies; - drbs_setupMod_item_ies = (F1AP_DRBs_SetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_SetupMod_ItemIEs_t)); - drbs_setupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_Item; - drbs_setupMod_item_ies->criticality = F1AP_Criticality_reject; - drbs_setupMod_item_ies->value.present = F1AP_DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item; - - /* 10.1 DRBs_SetupMod_Item */ - F1AP_DRBs_SetupMod_Item_t drbs_setupMod_item; - memset((void *)&drbs_setupMod_item, 0, sizeof(F1AP_DRBs_SetupMod_Item_t)); - - /* dRBID */ - drbs_setupMod_item.dRBID = 30L; - - /* DLTunnels_SetupMod_List */ - int j = 0; - int maxnoofDLUPTNLInformation = 1; // 2; - for (j=0; - j<maxnoofDLUPTNLInformation; - j++) { - /* DLTunnels_ToBeSetup_Item */ - F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; - dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); - - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - - ASN_SEQUENCE_ADD(&drbs_setupMod_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); - } - - /* ADD */ - drbs_setupMod_item_ies->value.choice.DRBs_SetupMod_Item = drbs_setupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_SetupMod_List.list, - drbs_setupMod_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* mandatory */ - /* c6. DRBs_Modified_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_Modified_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_Modified_ItemIEs_t *drbs_modified_item_ies; - drbs_modified_item_ies = (F1AP_DRBs_Modified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_Modified_ItemIEs_t)); - drbs_modified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_Item; - drbs_modified_item_ies->criticality = F1AP_Criticality_reject; - drbs_modified_item_ies->value.present = F1AP_DRBs_Modified_ItemIEs__value_PR_DRBs_Modified_Item; - - /* 13.1 SRBs_modified_Item */ - F1AP_DRBs_Modified_Item_t drbs_modified_item; - memset((void *)&drbs_modified_item, 0, sizeof(F1AP_DRBs_Modified_Item_t)); - - /* dRBID */ - drbs_modified_item.dRBID = 25L; - - /* ULTunnels_Modified_List */ - int maxnoofULTunnels = 1; // 2; - int j = 0; - for (j=0; - j<maxnoofULTunnels; - j++) { - /* DLTunnels_Modified_Item */ - F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; - dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); - - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - - ASN_SEQUENCE_ADD(&drbs_modified_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); - } - - /* ADD */ - drbs_modified_item_ies->value.choice.DRBs_Modified_Item = drbs_modified_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Modified_List.list, - drbs_modified_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c7. SRBs_FailedToBeSetupMod_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SRBs_FailedToBeSetupMod_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *srbs_failedToBeSetupMod_item_ies; - srbs_failedToBeSetupMod_item_ies = (F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t)); - srbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_Item; - srbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; - srbs_failedToBeSetupMod_item_ies->value.present = F1AP_SRBs_FailedToBeSetupMod_ItemIEs__value_PR_SRBs_FailedToBeSetupMod_Item; - - /* 9.1 SRBs_FailedToBeSetupMod_Item */ - F1AP_SRBs_FailedToBeSetupMod_Item_t srbs_failedToBeSetupMod_item; - memset((void *)&srbs_failedToBeSetupMod_item, 0, sizeof(F1AP_SRBs_FailedToBeSetupMod_Item_t)); - - /* - sRBID */ - srbs_failedToBeSetupMod_item.sRBID = 50L; - - srbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - srbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; - - /* ADD */ - srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item = srbs_failedToBeSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetupMod_List.list, - srbs_failedToBeSetupMod_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c8. DRBs_FailedToBeSetupMod_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeSetupMod_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *drbs_failedToBeSetupMod_item_ies; - drbs_failedToBeSetupMod_item_ies = (F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t)); - drbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_Item; - drbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_reject; - drbs_failedToBeSetupMod_item_ies->value.present = F1AP_DRBs_FailedToBeSetupMod_ItemIEs__value_PR_DRBs_FailedToBeSetupMod_Item; - - /* 10.1 DRBs_ToBeSetupMod_Item */ - F1AP_DRBs_FailedToBeSetupMod_Item_t drbs_failedToBeSetupMod_item; - memset((void *)&drbs_failedToBeSetupMod_item, 0, sizeof(F1AP_DRBs_FailedToBeSetupMod_Item_t)); - - /* dRBID */ - drbs_failedToBeSetupMod_item.dRBID = 30L; - - drbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - drbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; - - /* ADD */ - drbs_failedToBeSetupMod_item_ies->value.choice.DRBs_FailedToBeSetupMod_Item = drbs_failedToBeSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetupMod_List.list, - drbs_failedToBeSetupMod_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - - /* mandatory */ - /* c9. SCell_FailedtoSetupMod_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SCell_FailedtoSetupMod_List; - - for (i=0; - i<1; - i++) { - // - F1AP_SCell_FailedtoSetupMod_ItemIEs_t *scell_failedtoSetupMod_item_ies; - scell_failedtoSetupMod_item_ies = (F1AP_SCell_FailedtoSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetupMod_ItemIEs_t)); - scell_failedtoSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_Item; - scell_failedtoSetupMod_item_ies->criticality = F1AP_Criticality_ignore; - scell_failedtoSetupMod_item_ies->value.present = F1AP_SCell_FailedtoSetupMod_ItemIEs__value_PR_SCell_FailedtoSetupMod_Item; - - /* 8.1 SCell_ToBeSetup_Item */ - F1AP_SCell_FailedtoSetupMod_Item_t scell_failedtoSetupMod_item; - memset((void *)&scell_failedtoSetupMod_item, 0, sizeof(F1AP_SCell_FailedtoSetupMod_Item_t)); - - /* - sCell_ID */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - - scell_failedtoSetupMod_item.sCell_ID = nRCGI; - - scell_failedtoSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - scell_failedtoSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; - - /* ADD */ - scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item = scell_failedtoSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetupMod_List.list, - scell_failedtoSetupMod_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ - /* c10. DRBs_FailedToBeModified_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeModified_List; - - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_FailedToBeModified_ItemIEs_t *drbs_failedToBeModified_item_ies; - drbs_failedToBeModified_item_ies = (F1AP_DRBs_FailedToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeModified_ItemIEs_t)); - drbs_failedToBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_Item; - drbs_failedToBeModified_item_ies->criticality = F1AP_Criticality_reject; - drbs_failedToBeModified_item_ies->value.present = F1AP_DRBs_FailedToBeModified_ItemIEs__value_PR_DRBs_FailedToBeModified_Item; - - /* 13.1 DRBs_FailedToBeModified_Item */ - F1AP_DRBs_FailedToBeModified_Item_t drbs_failedToBeModified_item; - memset((void *)&drbs_failedToBeModified_item, 0, sizeof(F1AP_DRBs_FailedToBeModified_Item_t)); - - /* dRBID */ - drbs_failedToBeModified_item.dRBID = 30L; - - drbs_failedToBeModified_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - drbs_failedToBeModified_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; - - /* ADD */ - drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item = drbs_failedToBeModified_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeModified_List.list, - drbs_failedToBeModified_item_ies); - - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - // /* */ - /* c11. CriticalityDiagnostics */ - if (0) { - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_CriticalityDiagnostics; - ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextModification; - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); - *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; - ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; - ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - *ie->value.choice.CriticalityDiagnostics.transactionID = 0; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return; - } - - printf("\n"); - - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - -} - -void DU_send_UE_CONTEXT_MODIFICATION_FAILURE(F1AP_UEContextModificationFailure_t UEContextModificationFailure) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(F1AP_UEContextModificationRequired_t *UEContextModificationRequired) { - AssertFatal(1==0,"Not implemented yet\n"); -} - -void DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { - AssertFatal(1==0,"Not implemented yet\n"); -} - - -static int F1AP_DU_decode_initiating_message(F1AP_InitiatingMessage_t *initiating_p) { - - switch (initiating_p->value.present) { - - case F1AP_InitiatingMessage__value_PR_NOTHING: /* No components present */ - AssertFatal(1==0,"Should not receive NOTHING on DU\n"); - break; - - case F1AP_InitiatingMessage__value_PR_Reset: - DU_handle_RESET(&initiating_p->value.choice.Reset); - break; - /*case F1AP_Initiatingpdu__value_PR_F1SetupRequest: - DU_send_F1_SETUP_REQUEST(&initiating_p->value.choice.F1SetupRequest); - break;*/ - case F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate: - AssertFatal(1==0,"Should not receive GNBDUConfigurationUpdate on DU\n"); - break; - case F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate: - DU_handle_gNB_CU_CONFIGURATION_UPDATE(&initiating_p->value.choice.GNBCUConfigurationUpdate); - break; - case F1AP_InitiatingMessage__value_PR_UEContextSetupRequest: - DU_handle_UE_CONTEXT_SETUP_REQUEST(&initiating_p->value.choice.UEContextSetupRequest); - break; - case F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand: - DU_handle_UE_CONTEXT_RELEASE_COMMAND(&initiating_p->value.choice.UEContextReleaseCommand); - break; - case F1AP_InitiatingMessage__value_PR_UEContextModificationRequest: - DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(&initiating_p->value.choice.UEContextModificationRequest); - break; - case F1AP_InitiatingMessage__value_PR_UEContextModificationRequired: - AssertFatal(1==0,"Should not receive UECONTEXTMODIFICATIONREQUIRED on DU\n"); - break; - case F1AP_InitiatingMessage__value_PR_ErrorIndication: - AssertFatal(1==0,"Should not receive ErrorIndication on DU\n"); - break; - case F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest: - AssertFatal(1==0,"Should not receive UECONTEXTRELEASEREQUEST on DU\n"); - break; - case F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer: - DU_handle_DL_RRC_Message_TRANSFER(&initiating_p->value.choice.DLRRCMessageTransfer); - break; - case F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer: - AssertFatal(1==0,"Should not receive ULRRCmessageTRANSFER on DU\n"); - break; - case F1AP_InitiatingMessage__value_PR_PrivateMessage: - AssertFatal(1==0,"Should not receive PRIVATEmessage on DU\n"); - break; - default: - AssertFatal(1==0,"Shouldn't get here\n"); - } - -} - -static int F1AP_DU_decode_successful_outcome(F1AP_SuccessfulOutcome_t *successfulOutcome_p) { - - switch (successfulOutcome_p->value.present) { - - case F1AP_SuccessfulOutcome__value_PR_NOTHING: /* No components present */ - AssertFatal(1==0,"Should not received NOTHING!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_ResetAcknowledge: - AssertFatal(1==0,"DU Should not receive ResetAcknowled!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_F1SetupResponse: - AssertFatal(1==0,"DU Should not receive F1SetupResponse!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: - DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(successfulOutcome_p->value.choice.GNBDUConfigurationUpdateAcknowledge); - break; - case F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge: - AssertFatal(1==0,"DU Should not receive GNBCUConfigurationUpdateAcknowledge!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse: - AssertFatal(1==0,"DU Should not receive UEContextSetupResponse!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete: - AssertFatal(1==0,"DU Should not receive UEContextReleaseComplete!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse: - AssertFatal(1==0,"DU Should not receive UEContextModificationResponse!\n"); - break; - case F1AP_SuccessfulOutcome__value_PR_UEContextModificationConfirm: - DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(successfulOutcome_p->value.choice.UEContextModificationConfirm); - break; - } -} - -static int F1AP_DU_decode_unsuccessful_outcome(F1AP_UnsuccessfulOutcome_t *unSuccessfulOutcome_p) { - - switch (unSuccessfulOutcome_p->value.present) { - - case F1AP_UnsuccessfulOutcome__value_PR_NOTHING: - AssertFatal(1==0,"Should not receive NOTHING!\n"); - break; /* No components present */ - case F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure: - AssertFatal(1==0,"Should not receive F1SetupFailure\n"); - break; - case F1AP_UnsuccessfulOutcome__value_PR_GNBDUConfigurationUpdateFailure: - DU_handle_gNB_DU_CONFIGURATION_FAILURE(unSuccessfulOutcome_p->value.choice.GNBDUConfigurationUpdateFailure); - break; - case F1AP_UnsuccessfulOutcome__value_PR_GNBCUConfigurationUpdateFailure: - AssertFatal(1==0,"Should not receive GNBCUConfigurationUpdateFailure\n"); - break; - case F1AP_UnsuccessfulOutcome__value_PR_UEContextSetupFailure: - DU_send_UE_CONTEXT_SETUP_FAILURE(unSuccessfulOutcome_p->value.choice.UEContextSetupFailure); - break; - case F1AP_UnsuccessfulOutcome__value_PR_UEContextModificationFailure: - DU_send_UE_CONTEXT_MODIFICATION_FAILURE(unSuccessfulOutcome_p->value.choice.UEContextModificationFailure); - break; - } - -} - -static int F1AP_DU_encode_initiating_message(F1AP_InitiatingMessage_t *initiating_p) { - return -1; -} - -static int F1AP_DU_encode_successful_outcome(F1AP_SuccessfulOutcome_t *successfulOutcome_p) -{ - return -1; -} - -static int F1AP_DU_encode_unsuccessful_outcome(F1AP_UnsuccessfulOutcome_t *unSuccessfulOutcome_p) -{ - return -1; -} - -#define MAX_F1AP_BUFFER_SIZE 4096 - - -// or init function - -void DU_F1AP_init(void* args_p ) { - -} diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c new file mode 100644 index 0000000000..2efd22fb23 --- /dev/null +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -0,0 +1,792 @@ +/* + * 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 f1ap_du_interface_management.c + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include "f1ap_common.h" +#include "f1ap_du_interface_management.h" + +extern f1ap_setup_req_t *f1ap_du_data; + + +/* + Reset +*/ + + +void DU_handle_RESET(F1AP_Reset_t *Reset) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_RESET(F1AP_Reset_t *Reset) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + Error Indication +*/ + +void DU_send_ERROR_INDICATION(struct F1AP_F1AP_PDU_t *pdu_p) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + F1 Setup +*/ + +// SETUP REQUEST +void DU_send_F1_SETUP_REQUEST(instance_t instance) { + module_id_t enb_mod_idP; + module_id_t du_mod_idP; + + F1AP_F1AP_PDU_t pdu; + F1AP_F1SetupRequest_t *out; + F1AP_F1SetupRequestIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0; + int j = 0; + + /* Create */ + /* 0. pdu Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_F1Setup; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_F1SetupRequest; + out = &pdu.choice.initiatingMessage->value.choice.F1SetupRequest; + + /* mandatory */ + /* c1. Transaction ID (integer value) */ + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_ID (integrer value) */ + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID; + asn_int642INTEGER(&ie->value.choice.GNB_DU_ID, f1ap_du_data->gNB_DU_id); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. GNB_DU_Name */ + if (f1ap_du_data->gNB_DU_name != NULL) { + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name; + OCTET_STRING_fromBuf(&ie->value.choice.GNB_DU_Name, f1ap_du_data->gNB_DU_name, + strlen(f1ap_du_data->gNB_DU_name)); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c4. serverd cells list */ + ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; + + int num_cells_available = f1ap_du_data->num_cells_available; + printf("num_cells_available = %d \n", num_cells_available); + for (i=0; + i<num_cells_available; + i++) { + /* mandatory */ + /* 4.1 serverd cells item */ + + F1AP_GNB_DU_Served_Cells_ItemIEs_t *gnb_du_served_cell_list_item_ies; + gnb_du_served_cell_list_item_ies = (F1AP_GNB_DU_Served_Cells_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_DU_Served_Cells_ItemIEs_t)); + gnb_du_served_cell_list_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_DU_Served_Cells_Item; + gnb_du_served_cell_list_item_ies->criticality = F1AP_Criticality_reject; + gnb_du_served_cell_list_item_ies->value.present = F1AP_GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item; + + + F1AP_GNB_DU_Served_Cells_Item_t gnb_du_served_cells_item; + memset((void *)&gnb_du_served_cells_item, 0, sizeof(F1AP_GNB_DU_Served_Cells_Item_t)); + + /* 4.1.1 serverd cell Information */ + F1AP_Served_Cell_Information_t served_cell_information; + + memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); + + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); + served_cell_information.nRCGI = nRCGI; + + /* - nRPCI */ + served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 + + /* - fiveGS_TAC */ + OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + &f1ap_du_data->tac[i], + 3); + + /* - Configured_EPS_TAC */ + if(0){ + served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + "2", + 2); + } + + /* - broadcast PLMNs */ + // RK: add the num_available_broadcast_PLMNs to the message + int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs; + printf("num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); + for (j=0; + j<num_available_broadcast_PLMNs; // num_available_broadcast_PLMNs + j++) { + /* > PLMN BroadcastPLMNs Item */ + F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); + //MCC_MNC_TO_PLMNID(208, 95, 2, &broadcastPLMNs_Item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); + } + + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t nR_Mode_Info; + //f1ap_du_data->fdd_flag = 1; + if (f1ap_du_data->fdd_flag) { // FDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + /* > FDD >> FDD Info */ + F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* >>> UL NRFreqInfo */ + fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_arfcn; + + F1AP_FreqBandNrItem_t ul_freqBandNrItem; + memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + ul_freqBandNrItem.freqBandIndicatorNr = 777L; + + F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; + memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + + /* >>> DL NRFreqInfo */ + fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_arfcn; + + F1AP_FreqBandNrItem_t dl_freqBandNrItem; + memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + dl_freqBandNrItem.freqBandIndicatorNr = 777L; + + F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; + memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + + /* >>> UL Transmission Bandwidth */ + fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.ul_nrb; + /* >>> DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.dl_nrb; + + nR_Mode_Info.choice.fDD = fDD_Info; + } else { // TDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + + /* > TDD >> TDD Info */ + F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + /* >>> ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].tdd.nr_arfcn; // Integer + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + // RK: missing params + nr_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + + tDD_Info->transmission_Bandwidth.nRSCS= f1ap_du_data->nr_mode_info[i].tdd.scs; + tDD_Info->transmission_Bandwidth.nRNRB= f1ap_du_data->nr_mode_info[i].tdd.nrb; + + nR_Mode_Info.choice.tDD = tDD_Info; + } + + served_cell_information.nR_Mode_Info = nR_Mode_Info; + + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = "0"; //&f1ap_du_data->measurement_timing_information[i]; // sept. 2018 + + OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + gnb_du_served_cells_item.served_Cell_Information = served_cell_information; // + + /* 4.1.2 gNB-DU System Information */ + F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + f1ap_du_data->mib[i],//f1ap_du_data->mib, + f1ap_du_data->mib_length[i]); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + f1ap_du_data->sib1[i], + f1ap_du_data->sib1_length[i]); + + gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; // + + /* ADD */ + gnb_du_served_cell_list_item_ies->value.choice.GNB_DU_Served_Cells_Item = gnb_du_served_cells_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.GNB_DU_Served_Cells_List.list, + gnb_du_served_cell_list_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); +} + +int DU_handle_F1_SETUP_RESPONSE(uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ + printf("DU_handle_F1_SETUP_RESPONSE\n"); + + return 0; +} + +// SETUP FAILURE +void DU_handle_F1_SETUP_FAILURE(F1AP_F1AP_PDU_t *pdu_p) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + gNB-DU Configuration Update +*/ + +//void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { +void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP, f1ap_setup_req_t *f1ap_du_data) { + F1AP_F1AP_PDU_t pdu; + F1AP_GNBDUConfigurationUpdate_t *out; + F1AP_GNBDUConfigurationUpdateIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0; + int j = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBDUConfigurationUpdate; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate; + out = &pdu.choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; + + /* mandatory */ + /* c1. Transaction ID (integer value) */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c2. Served_Cells_To_Add */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Add_List; + + for (j=0; + j<1; + j++) { + // + F1AP_Served_Cells_To_Add_ItemIEs_t *served_cells_to_add_item_ies; + served_cells_to_add_item_ies = (F1AP_Served_Cells_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Add_ItemIEs_t)); + served_cells_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_Item; + served_cells_to_add_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_add_item_ies->value.present = F1AP_Served_Cells_To_Add_ItemIEs__value_PR_Served_Cells_To_Add_Item; + + F1AP_Served_Cells_To_Add_Item_t served_cells_to_add_item; + memset((void *)&served_cells_to_add_item, 0, sizeof(F1AP_Served_Cells_To_Add_Item_t)); + + /* 2.1.1 serverd cell Information */ + F1AP_Served_Cell_Information_t served_cell_information; + + memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + served_cell_information.nRCGI = nRCGI; + + /* - nRPCI */ + served_cell_information.nRPCI = 321L; // int 0..1007 + + /* - fiveGS_TAC */ + OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + "10", + 3); + + /* - Configured_EPS_TAC */ + if(1){ + served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + "2", + 2); + } + + /* - broadcast PLMNs */ + int maxnoofBPLMNS = 1; + for (i=0; + i<maxnoofBPLMNS; + i++) { + /* > PLMN BroadcastPLMNs Item */ + F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); + //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); + } + + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t nR_Mode_Info; + + if ("FDD") { + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + /* > FDD >> FDD Info */ + F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* >>> UL NRFreqInfo */ + fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; + + F1AP_FreqBandNrItem_t ul_freqBandNrItem; + memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + ul_freqBandNrItem.freqBandIndicatorNr = 888L; + + F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; + memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + + /* >>> DL NRFreqInfo */ + fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; + + F1AP_FreqBandNrItem_t dl_freqBandNrItem; + memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + dl_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; + memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + + /* >>> UL Transmission Bandwidth */ + fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + /* >>> DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.fDD = fDD_Info; + } else { // TDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + + /* > TDD >> TDD Info */ + F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + /* >>> ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + nr_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + + tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; + tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.tDD = tDD_Info; + } + + served_cell_information.nR_Mode_Info = nR_Mode_Info; + + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = "0"; // sept. 2018 + + OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + served_cells_to_add_item.served_Cell_Information = served_cell_information; // + + /* 2.1.2 gNB-DU System Information */ + F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + "1", + sizeof("1")); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + "1", + sizeof("1")); + served_cells_to_add_item.gNB_DU_System_Information = gNB_DU_System_Information; // + + /* ADD */ + served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item = served_cells_to_add_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Add_List.list, + served_cells_to_add_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c3. Served_Cells_To_Modify */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List; + + for (i=0; + i<1; + i++) { + // + F1AP_Served_Cells_To_Modify_ItemIEs_t *served_cells_to_modify_item_ies; + served_cells_to_modify_item_ies = (F1AP_Served_Cells_To_Modify_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Modify_ItemIEs_t)); + served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item; + served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_modify_item_ies->value.present = F1AP_Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item; + + F1AP_Served_Cells_To_Modify_Item_t served_cells_to_modify_item; + memset((void *)&served_cells_to_modify_item, 0, sizeof(F1AP_Served_Cells_To_Modify_Item_t)); + + /* 3.1 oldNRCGI */ + F1AP_NRCGI_t oldNRCGI; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + &oldNRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); + served_cells_to_modify_item.oldNRCGI = oldNRCGI; + + + /* 3.2.1 serverd cell Information */ + F1AP_Served_Cell_Information_t served_cell_information; + memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + served_cell_information.nRCGI = nRCGI; + + /* - nRPCI */ + served_cell_information.nRPCI = 321L; // int 0..1007 + + /* - fiveGS_TAC */ + OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + "10", + 3); + + /* - Configured_EPS_TAC */ + if(1){ + served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + "2", + 2); + } + + /* - broadcast PLMNs */ + int maxnoofBPLMNS = 1; + for (i=0; + i<maxnoofBPLMNS; + i++) { + /* > PLMN BroadcastPLMNs Item */ + F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); + //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); + } + + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t nR_Mode_Info; + + if ("FDD") { + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + /* > FDD >> FDD Info */ + F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* >>> UL NRFreqInfo */ + fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; + + F1AP_FreqBandNrItem_t ul_freqBandNrItem; + memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + ul_freqBandNrItem.freqBandIndicatorNr = 888L; + + F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; + memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + + /* >>> DL NRFreqInfo */ + fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; + + F1AP_FreqBandNrItem_t dl_freqBandNrItem; + memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + dl_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; + memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + + /* >>> UL Transmission Bandwidth */ + fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + /* >>> DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.fDD = fDD_Info; + } else { // TDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + + /* > TDD >> TDD Info */ + F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + /* >>> ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + nr_freqBandNrItem.freqBandIndicatorNr = 555L; + + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + + tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; + tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + + nR_Mode_Info.choice.tDD = tDD_Info; + } + + served_cell_information.nR_Mode_Info = nR_Mode_Info; + + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = "0"; // sept. 2018 + + OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + served_cells_to_modify_item.served_Cell_Information = served_cell_information; // + + /* 3.2.2 gNB-DU System Information */ + F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + "1", + sizeof("1")); + + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + "1", + sizeof("1")); + served_cells_to_modify_item.gNB_DU_System_Information = gNB_DU_System_Information; // + + /* ADD */ + served_cells_to_modify_item_ies->value.choice.Served_Cells_To_Modify_Item = served_cells_to_modify_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Modify_List.list, + served_cells_to_modify_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c4. Served_Cells_To_Delete */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List; + + for (i=0; + i<1; + i++) { + // + F1AP_Served_Cells_To_Delete_ItemIEs_t *served_cells_to_delete_item_ies; + served_cells_to_delete_item_ies = (F1AP_Served_Cells_To_Delete_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Delete_ItemIEs_t)); + served_cells_to_delete_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_Item; + served_cells_to_delete_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; + + F1AP_Served_Cells_To_Delete_Item_t served_cells_to_delete_item; + memset((void *)&served_cells_to_delete_item, 0, sizeof(F1AP_Served_Cells_To_Delete_Item_t)); + + /* 3.1 oldNRCGI */ + F1AP_NRCGI_t oldNRCGI; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + &oldNRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); + served_cells_to_delete_item.oldNRCGI = oldNRCGI; + + /* ADD */ + served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item = served_cells_to_delete_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Delete_List.list, + served_cells_to_delete_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c5. Active_Cells_List */ + ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Active_Cells_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Active_Cells_List; + + for (i=0; + i<1; + i++) { + // + F1AP_Active_Cells_ItemIEs_t *active_cells_item_ies; + active_cells_item_ies = (F1AP_Active_Cells_ItemIEs_t *)calloc(1, sizeof(F1AP_Active_Cells_ItemIEs_t)); + active_cells_item_ies->id = F1AP_ProtocolIE_ID_id_Active_Cells_Item; + active_cells_item_ies->criticality = F1AP_Criticality_reject; + active_cells_item_ies->value.present = F1AP_Active_Cells_ItemIEs__value_PR_Active_Cells_Item; + + F1AP_Active_Cells_Item_t active_cells_item; + memset((void *)&active_cells_item, 0, sizeof(F1AP_Active_Cells_Item_t)); + + /* 3.1 oldNRCGI */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + active_cells_item.nRCGI = nRCGI; + + /* ADD */ + active_cells_item_ies->value.choice.Active_Cells_Item = active_cells_item; + + ASN_SEQUENCE_ADD(&ie->value.choice.Active_Cells_List.list, + active_cells_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + printf("\n"); + + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); + + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + } +} + + + +void DU_handle_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpdateAcknowledge_t GNBDUConfigurationUpdateAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + gNB-CU Configuration Update +*/ + +void DU_handle_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { + AssertFatal(1==0,"Not implemented yet\n"); +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h new file mode 100644 index 0000000000..1ee1be658f --- /dev/null +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -0,0 +1,44 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#ifndef F1AP_DU_INTERFACE_MANAGEMENT_H_ +#define F1AP_DU_INTERFACE_MANAGEMENT_H_ + +void DU_send_F1_SETUP_REQUEST(instance_t instance); + +int DU_handle_F1_SETUP_RESPONSE(uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +void DU_handle_F1_SETUP_FAILURE(F1AP_F1AP_PDU_t *pdu_p); + +#endif /* F1AP_DU_INTERFACE_MANAGEMENT_H_ */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_paging.c b/openair2/F1AP/f1ap_du_paging.c new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_du_paging.c @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_paging.h b/openair2/F1AP/f1ap_du_paging.h new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_du_paging.h @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c new file mode 100644 index 0000000000..7e2a113329 --- /dev/null +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -0,0 +1,215 @@ +/* + * 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 f1ap_du_rrc_message_transfer.c + * \brief f1ap rrc message transfer for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include "f1ap_common.h" +#include "f1ap_du_rrc_message_transfer.h" +// undefine C_RNTI from +// openair1/PHY/LTE_TRANSPORT/transport_common.h which +// replaces in ie->value.choice.C_RNTI, causing +// a compile error +#undef C_RNTI + +extern f1ap_setup_req_t *f1ap_du_data; + +/* DL RRC Message Transfer */ +void DU_handle_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +//void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { +void DU_send_UL_RRC_MESSAGE_TRANSFER(void) { + F1AP_F1AP_PDU_t pdu; + F1AP_ULRRCMessageTransfer_t *out; + F1AP_ULRRCMessageTransferIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_ULRRCMessageTransfer; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer; + out = &pdu.choice.initiatingMessage->value.choice.ULRRCMessageTransfer; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. SRBID */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; + ie->value.choice.SRBID = 1; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // issue in here + /* mandatory */ + /* c4. RRCContainer */ + ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + printf("\n"); + + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + //AssertFatal(1==0,"Not implemented yet\n"); +} + +/* UL RRC Message Transfer */ +void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( + module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP, + uint8_t *sduP, + sdu_size_t sdu_lenP +) { + F1AP_F1AP_PDU_t pdu; + F1AP_InitialULRRCMessageTransfer_t *out; + F1AP_InitialULRRCMessageTransferIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_InitialULRRCMessageTransfer; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_InitialULRRCMessageTransfer; + out = &pdu.choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer; + + + /* mandatory */ + /* c1. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = F1AP_get_UE_identifier(module_idP, CC_idP, UE_id); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. NRCGI */ + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_NRCGI; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; + + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[0], f1ap_du_data->mnc[0], f1ap_du_data->mnc_digit_length[0], + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + ie->value.choice.NRCGI = nRCGI; + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. C_RNTI */ // 16 + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_C_RNTI; + C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c4. RRCContainer */ + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c5. DUtoCURRCContainer */ + if (0) { + ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, "dummy_val", + strlen("dummy_val")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + printf("\n"); + + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + //AssertFatal(1==0,"Not implemented yet\n"); +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h new file mode 100644 index 0000000000..24a48fdcdd --- /dev/null +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -0,0 +1,37 @@ +/* + * 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 f1ap_du_rrc_message_transfer.h + * \brief f1ap rrc message transfer for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + + +#ifndef F1AP_DU_RRC_MESSAGE_TRANSFER_H_ +#define F1AP_DU_RRC_MESSAGE_TRANSFER_H_ + +#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_system_information.c b/openair2/F1AP/f1ap_du_system_information.c new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_du_system_information.c @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_system_information.h b/openair2/F1AP/f1ap_du_system_information.h new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_du_system_information.h @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c new file mode 100644 index 0000000000..091428b1e7 --- /dev/null +++ b/openair2/F1AP/f1ap_du_task.c @@ -0,0 +1,177 @@ +/* + * 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 openair2/F1AP/DU_F1AP.c +* \brief data structures for F1 interface modules +* \author EURECOM/NTUST +* \date 2018 +* \version 0.1 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, bing-kai.hong@eurecom.fr +* \note +* \warning +*/ + +#include "f1ap_common.h" +#include "f1ap_handlers.h" +#include "f1ap_du_interface_management.h" +#include "f1ap_du_task.h" + +f1ap_setup_req_t *f1ap_du_data; + +void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { + + DevAssert(f1ap_setup_req != NULL); + + MessageDef *message_p = NULL; + sctp_new_association_req_t *sctp_new_association_req_p = NULL; + + message_p = itti_alloc_new_message(TASK_DU_F1, SCTP_NEW_ASSOCIATION_REQ); + + sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; + sctp_new_association_req_p->ulp_cnx_id = instance; + sctp_new_association_req_p->port = F1AP_PORT_NUMBER; + sctp_new_association_req_p->ppid = F1AP_SCTP_PPID; + + sctp_new_association_req_p->in_streams = f1ap_setup_req->sctp_in_streams; + sctp_new_association_req_p->out_streams = f1ap_setup_req->sctp_out_streams; + + // remote + memcpy(&sctp_new_association_req_p->remote_address, + &f1ap_setup_req->CU_f1_ip_address, + sizeof(f1ap_setup_req->CU_f1_ip_address)); + + // local + memcpy(&sctp_new_association_req_p->local_address, + &f1ap_setup_req->DU_f1_ip_address, + sizeof(f1ap_setup_req->DU_f1_ip_address)); + + // store data + f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); + *f1ap_du_data = *f1ap_setup_req; + //printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]); + printf("sib f1ap context %s\n", f1ap_du_data->sib1[0]); + + //du_f1ap_register_to_sctp + itti_send_msg_to_task(TASK_SCTP, instance, message_p); +} + +void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { + + DevAssert(sctp_new_association_resp != NULL); + + if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { + LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + sctp_new_association_resp->sctp_state, + instance, + sctp_new_association_resp->ulp_cnx_id); + + //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); + return; // exit -1 for debugging + } + + // save the assoc id + f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; + f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; + f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; + + + DU_send_F1_SETUP_REQUEST(instance); +} + +void du_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) +{ + int result; + + DevAssert(sctp_data_ind != NULL); + + f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, + sctp_data_ind->buffer, sctp_data_ind->buffer_length); + + result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); +} + + +void *F1AP_DU_task(void *arg) { + + //sctp_cu_init(); + MessageDef *received_msg = NULL; + int result; + + LOG_I(DU_F1AP, "Starting F1AP at DU\n"); + + //f1ap_eNB_prepare_internal_data(); + + itti_mark_task_ready(TASK_DU_F1); + + // SCTP + while (1) { + itti_receive_msg(TASK_DU_F1, &received_msg); + + switch (ITTI_MSG_ID(received_msg)) { + + // case TERMINATE_MESSAGE: + // //F1AP_WARN(" *** Exiting F1AP DU thread\n"); + // itti_exit_task(); + // break; + + case F1AP_SETUP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app + // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, + // 2. store the message in f1ap context, that is also stored in RC + // 2. send a sctp_association req + LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n"); + du_task_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_SETUP_REQ(received_msg)); + break; + + case SCTP_NEW_ASSOCIATION_RESP: + // 1. store the respon + // 2. send the f1setup_req + LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); + du_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_resp); + break; + + case SCTP_DATA_IND: + // ex: any F1 incoming message for DU ends here + LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); + du_task_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + break; + + case TERMINATE_MESSAGE: + LOG_W(DU_F1AP, " *** Exiting DU_F1AP thread\n"); + itti_exit_task(); + break; + + default: + LOG_E(DU_F1AP, "DU Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + break; + } // switch + 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; + } // while + + return NULL; +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_task.h b/openair2/F1AP/f1ap_du_task.h index 579c2a9761..ffae6ac339 100644 --- a/openair2/F1AP/f1ap_du_task.h +++ b/openair2/F1AP/f1ap_du_task.h @@ -22,6 +22,9 @@ #ifndef DU_F1AP_TASK_H_ #define DU_F1AP_TASK_H_ +void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req); +void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); +void du_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind); void *F1AP_DU_task(void *arg); #endif /* DU_F1AP_TASK_H_ */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c new file mode 100644 index 0000000000..281e5f58a6 --- /dev/null +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -0,0 +1,723 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#include "f1ap_common.h" +#include "f1ap_du_ue_context_management.h" + +extern f1ap_setup_req_t *f1ap_du_data; + +/* + UE Context Setup +*/ + +void DU_handle_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +//void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { +void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextSetupResponse_t *out; + F1AP_UEContextSetupResponseIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); + pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse; + out = &pdu.choice.successfulOutcome->value.choice.UEContextSetupResponse; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. DUtoCURRCInformation */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; + + OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", + strlen("asdsa")); + /* OPTIONAL */ + if (0) { + ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); + OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa", + strlen("asdsa")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c4. ResourceCoordinationTransferContainer */ + if (0) { + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa", + strlen("asdsa")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + // /* */ + /* c5. DRBs_Setup_List */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_Setup_ItemIEs_t *drbs_setup_item_ies; + drbs_setup_item_ies = (F1AP_DRBs_Setup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_Setup_ItemIEs_t)); + drbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_Item; + drbs_setup_item_ies->criticality = F1AP_Criticality_ignore; + drbs_setup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; + + /* 5.1 DRBs_Setup_Item */ + F1AP_DRBs_Setup_Item_t drbs_setup_item; + memset((void *)&drbs_setup_item, 0, sizeof(F1AP_DRBs_Setup_Item_t)); + + drbs_setup_item.dRBID = 12; + + int j; + for (j=0; + j<1; + j++) { + + F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; + dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + // F1AP_TransportLayerAddress_t transportLayerAddress; + // transportLayerAddress.buf = malloc((36+7)/8); + // transportLayerAddress.size = (36+7)/8; + // transportLayerAddress.bits_unused = 4; + // *transportLayerAddress.buf = 123; + // dLUPTNLInformation_ToBeSetup_Item.dL_GTP_Tunnel_EndPoint.transportLayerAddress = transportLayerAddress; + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_setup_item.dLUPTNLInformation_ToBeSetup_List.list, + dLUPTNLInformation_ToBeSetup_Item); + } + + // /* ADD */ + drbs_setup_item_ies->value.choice.DRBs_Setup_Item = drbs_setup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Setup_List.list, + drbs_setup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c6. SRBs_FailedToBeSetup_List */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_FailedToBeSetup_ItemIEs_t *srbs_failedToBeSetup_item_ies; + srbs_failedToBeSetup_item_ies = (F1AP_SRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetup_ItemIEs_t)); + srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; + srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; + + /* 6.1 SRBs_Setup_Item */ + F1AP_SRBs_FailedToBeSetup_Item_t srbs_failedToBeSetup_item; + memset((void *)&srbs_failedToBeSetup_item, 0, sizeof(F1AP_SRBs_FailedToBeSetup_Item_t)); + + srbs_failedToBeSetup_item.sRBID = 13; + srbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + srbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + srbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; + + // /* ADD */ + srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item = srbs_failedToBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetup_List.list, + srbs_failedToBeSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c7. DRBs_FailedToBeSetup_List */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_FailedToBeSetup_ItemIEs_t *drbs_failedToBeSetup_item_ies; + drbs_failedToBeSetup_item_ies = (F1AP_DRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetup_ItemIEs_t)); + drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; + drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; + + /* 7.1 DRBs_Setup_Item */ + F1AP_DRBs_FailedToBeSetup_Item_t drbs_failedToBeSetup_item; + memset((void *)&drbs_failedToBeSetup_item, 0, sizeof(F1AP_DRBs_FailedToBeSetup_Item_t)); + + drbs_failedToBeSetup_item.dRBID = 14; + drbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + drbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + drbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; + + // /* ADD */ + drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item = drbs_failedToBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetup_List.list, + drbs_failedToBeSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c8. SCell_FailedtoSetup_List */ + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_FailedtoSetup_ItemIEs_t *sCell_FailedtoSetup_item_ies; + sCell_FailedtoSetup_item_ies = (F1AP_SCell_FailedtoSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetup_ItemIEs_t)); + sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; + sCell_FailedtoSetup_item_ies->criticality = F1AP_Criticality_ignore; + sCell_FailedtoSetup_item_ies->value.present = F1AP_SCell_FailedtoSetup_ItemIEs__value_PR_SCell_FailedtoSetup_Item; + + /* 8.1 DRBs_Setup_Item */ + F1AP_SCell_FailedtoSetup_Item_t sCell_FailedtoSetup_item; + memset((void *)&sCell_FailedtoSetup_item, 0, sizeof(F1AP_SCell_FailedtoSetup_Item_t)); + + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; // issue here + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); +// + // INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); + // nRCGI.nRCellIdentity.buf = malloc((36+7)/8); + + // nRCGI.nRCellIdentity.size = (36+7)/8; + // nRCGI.nRCellIdentity.bits_unused = 4; + + // nRCGI.nRCellIdentity.buf[0] = 123; + + //nRCGI.nRCellIdentity = 15; + + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + sCell_FailedtoSetup_item.sCell_ID = nRCGI; + + sCell_FailedtoSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + sCell_FailedtoSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + sCell_FailedtoSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; + + // /* ADD */ + sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item = sCell_FailedtoSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetup_List.list, + sCell_FailedtoSetup_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c9. CriticalityDiagnostics */ + if (0) { + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_CriticalityDiagnostics; + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + *ie->value.choice.CriticalityDiagnostics.transactionID = 0; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return; + } + + printf("\n"); + + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); +} + +void DU_send_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +/* + UE Context Release Request (gNB-DU initiated). +*/ + +void DU_send_UE_CONTEXT_RELEASE_REQUEST(F1AP_UEContextReleaseRequest_t *UEContextReleaseRequest) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_handle_UE_CONTEXT_RELEASE_COMMAND(F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +void DU_send_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UEContextReleaseComplete) { + AssertFatal(1==0,"Not implemented yet\n"); +} + + +/* + UE Context Modification (gNB-CU initiated) +*/ + +void DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +//void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { +void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextModificationResponse_t *out; + F1AP_UEContextModificationResponseIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); + pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextModification; + pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse; + out = &pdu.choice.successfulOutcome->value.choice.UEContextModificationResponse; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. ResourceCoordinationTransferContainer */ + if (0) { + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c4. DUtoCURRCInformation */ + if (0) { + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation; + + OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + /* OPTIONAL */ + if (1) { + ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); + OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + } + + + /* mandatory */ + /* c5. DRBs_SetupMod_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_SetupMod_ItemIEs_t *drbs_setupMod_item_ies; + drbs_setupMod_item_ies = (F1AP_DRBs_SetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_SetupMod_ItemIEs_t)); + drbs_setupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_Item; + drbs_setupMod_item_ies->criticality = F1AP_Criticality_reject; + drbs_setupMod_item_ies->value.present = F1AP_DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item; + + /* 10.1 DRBs_SetupMod_Item */ + F1AP_DRBs_SetupMod_Item_t drbs_setupMod_item; + memset((void *)&drbs_setupMod_item, 0, sizeof(F1AP_DRBs_SetupMod_Item_t)); + + /* dRBID */ + drbs_setupMod_item.dRBID = 30L; + + /* DLTunnels_SetupMod_List */ + int j = 0; + int maxnoofDLUPTNLInformation = 1; // 2; + for (j=0; + j<maxnoofDLUPTNLInformation; + j++) { + /* DLTunnels_ToBeSetup_Item */ + F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; + dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_setupMod_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); + } + + /* ADD */ + drbs_setupMod_item_ies->value.choice.DRBs_SetupMod_Item = drbs_setupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_SetupMod_List.list, + drbs_setupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c6. DRBs_Modified_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_Modified_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_Modified_ItemIEs_t *drbs_modified_item_ies; + drbs_modified_item_ies = (F1AP_DRBs_Modified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_Modified_ItemIEs_t)); + drbs_modified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_Item; + drbs_modified_item_ies->criticality = F1AP_Criticality_reject; + drbs_modified_item_ies->value.present = F1AP_DRBs_Modified_ItemIEs__value_PR_DRBs_Modified_Item; + + /* 13.1 SRBs_modified_Item */ + F1AP_DRBs_Modified_Item_t drbs_modified_item; + memset((void *)&drbs_modified_item, 0, sizeof(F1AP_DRBs_Modified_Item_t)); + + /* dRBID */ + drbs_modified_item.dRBID = 25L; + + /* ULTunnels_Modified_List */ + int maxnoofULTunnels = 1; // 2; + int j = 0; + for (j=0; + j<maxnoofULTunnels; + j++) { + /* DLTunnels_Modified_Item */ + F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; + dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + + TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + + ASN_SEQUENCE_ADD(&drbs_modified_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); + } + + /* ADD */ + drbs_modified_item_ies->value.choice.DRBs_Modified_Item = drbs_modified_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Modified_List.list, + drbs_modified_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c7. SRBs_FailedToBeSetupMod_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SRBs_FailedToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *srbs_failedToBeSetupMod_item_ies; + srbs_failedToBeSetupMod_item_ies = (F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t)); + srbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_Item; + srbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + srbs_failedToBeSetupMod_item_ies->value.present = F1AP_SRBs_FailedToBeSetupMod_ItemIEs__value_PR_SRBs_FailedToBeSetupMod_Item; + + /* 9.1 SRBs_FailedToBeSetupMod_Item */ + F1AP_SRBs_FailedToBeSetupMod_Item_t srbs_failedToBeSetupMod_item; + memset((void *)&srbs_failedToBeSetupMod_item, 0, sizeof(F1AP_SRBs_FailedToBeSetupMod_Item_t)); + + /* - sRBID */ + srbs_failedToBeSetupMod_item.sRBID = 50L; + + srbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + srbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; + srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + + /* ADD */ + srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item = srbs_failedToBeSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetupMod_List.list, + srbs_failedToBeSetupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c8. DRBs_FailedToBeSetupMod_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *drbs_failedToBeSetupMod_item_ies; + drbs_failedToBeSetupMod_item_ies = (F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t)); + drbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_Item; + drbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_reject; + drbs_failedToBeSetupMod_item_ies->value.present = F1AP_DRBs_FailedToBeSetupMod_ItemIEs__value_PR_DRBs_FailedToBeSetupMod_Item; + + /* 10.1 DRBs_ToBeSetupMod_Item */ + F1AP_DRBs_FailedToBeSetupMod_Item_t drbs_failedToBeSetupMod_item; + memset((void *)&drbs_failedToBeSetupMod_item, 0, sizeof(F1AP_DRBs_FailedToBeSetupMod_Item_t)); + + /* dRBID */ + drbs_failedToBeSetupMod_item.dRBID = 30L; + + drbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + drbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; + drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + + /* ADD */ + drbs_failedToBeSetupMod_item_ies->value.choice.DRBs_FailedToBeSetupMod_Item = drbs_failedToBeSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetupMod_List.list, + drbs_failedToBeSetupMod_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + + /* mandatory */ + /* c9. SCell_FailedtoSetupMod_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_List; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SCell_FailedtoSetupMod_List; + + for (i=0; + i<1; + i++) { + // + F1AP_SCell_FailedtoSetupMod_ItemIEs_t *scell_failedtoSetupMod_item_ies; + scell_failedtoSetupMod_item_ies = (F1AP_SCell_FailedtoSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetupMod_ItemIEs_t)); + scell_failedtoSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_Item; + scell_failedtoSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + scell_failedtoSetupMod_item_ies->value.present = F1AP_SCell_FailedtoSetupMod_ItemIEs__value_PR_SCell_FailedtoSetupMod_Item; + + /* 8.1 SCell_ToBeSetup_Item */ + F1AP_SCell_FailedtoSetupMod_Item_t scell_failedtoSetupMod_item; + memset((void *)&scell_failedtoSetupMod_item, 0, sizeof(F1AP_SCell_FailedtoSetupMod_Item_t)); + + /* - sCell_ID */ + F1AP_NRCGI_t nRCGI; + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + &nRCGI.pLMN_Identity); + + NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + + scell_failedtoSetupMod_item.sCell_ID = nRCGI; + + scell_failedtoSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + scell_failedtoSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; + scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + + /* ADD */ + scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item = scell_failedtoSetupMod_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetupMod_List.list, + scell_failedtoSetupMod_item_ies); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c10. DRBs_FailedToBeModified_List */ + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeModified_List; + + for (i=0; + i<1; + i++) { + // + F1AP_DRBs_FailedToBeModified_ItemIEs_t *drbs_failedToBeModified_item_ies; + drbs_failedToBeModified_item_ies = (F1AP_DRBs_FailedToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeModified_ItemIEs_t)); + drbs_failedToBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_Item; + drbs_failedToBeModified_item_ies->criticality = F1AP_Criticality_reject; + drbs_failedToBeModified_item_ies->value.present = F1AP_DRBs_FailedToBeModified_ItemIEs__value_PR_DRBs_FailedToBeModified_Item; + + /* 13.1 DRBs_FailedToBeModified_Item */ + F1AP_DRBs_FailedToBeModified_Item_t drbs_failedToBeModified_item; + memset((void *)&drbs_failedToBeModified_item, 0, sizeof(F1AP_DRBs_FailedToBeModified_Item_t)); + + /* dRBID */ + drbs_failedToBeModified_item.dRBID = 30L; + + drbs_failedToBeModified_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + drbs_failedToBeModified_item.cause->present = F1AP_Cause_PR_radioNetwork; + drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + + /* ADD */ + drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item = drbs_failedToBeModified_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeModified_List.list, + drbs_failedToBeModified_item_ies); + + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + // /* */ + /* c11. CriticalityDiagnostics */ + if (0) { + ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_CriticalityDiagnostics; + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextModification; + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + *ie->value.choice.CriticalityDiagnostics.transactionID = 0; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + return; + } + + printf("\n"); + + /* decode */ + // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + // printf("Failed to decode F1 setup request\n"); + // } + //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); + +} + +void DU_send_UE_CONTEXT_MODIFICATION_FAILURE(F1AP_UEContextModificationFailure_t UEContextModificationFailure) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(F1AP_UEContextModificationRequired_t *UEContextModificationRequired) { + AssertFatal(1==0,"Not implemented yet\n"); +} + +void DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { + AssertFatal(1==0,"Not implemented yet\n"); +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h new file mode 100644 index 0000000000..4771c1a66d --- /dev/null +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -0,0 +1,36 @@ +/* + * 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 f1ap_du_ue_context_management.h + * \brief f1ap ue context management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ + +#ifndef F1AP_DU_UE_CONTEXT_MANAGEMENT_H_ +#define F1AP_DU_UE_CONTEXT_MANAGEMENT_H_ + +#endif /* F1AP_DU_UE_CONTEXT_MANAGEMENT_H_ */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_warning_message_transmission.c b/openair2/F1AP/f1ap_du_warning_message_transmission.c new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_du_warning_message_transmission.c @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_warning_message_transmission.h b/openair2/F1AP/f1ap_du_warning_message_transmission.h new file mode 100644 index 0000000000..b6bbedba2f --- /dev/null +++ b/openair2/F1AP/f1ap_du_warning_message_transmission.h @@ -0,0 +1,31 @@ +/* + * 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 f1ap_du_interface_management.h + * \brief f1ap interface management for DU + * \author EURECOM/NTUST + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr + * \note + * \warning + */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index c7c9ebf040..355e52ad95 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -30,16 +30,6 @@ * \warning */ -#include <stdio.h> -#include <string.h> -#include <stdint.h> - -#include "assertions.h" - -#include "conversions.h" - -#include "intertask_interface.h" - #include "f1ap_common.h" #include "f1ap_encoder.h" diff --git a/openair2/F1AP/f1ap_encoder.h b/openair2/F1AP/f1ap_encoder.h index 682395890a..695245d39b 100644 --- a/openair2/F1AP/f1ap_encoder.h +++ b/openair2/F1AP/f1ap_encoder.h @@ -33,9 +33,7 @@ #ifndef F1AP_ENCODER_H_ #define F1AP_ENCODER_H_ -#include "f1ap_common.h" - -int f1ap_encode_pdu(F1AP_F1AP_PDU_t *message, uint8_t **buffer, uint32_t *len) +int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) __attribute__ ((warn_unused_result)); #endif /* F1AP_ENCODER_H_ */ diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 530c411aa6..e4178e358c 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -30,54 +30,31 @@ * \warning */ -#include <stdint.h> - -#include "intertask_interface.h" - -#include "asn1_conversions.h" - #include "f1ap_common.h" -// #include "f1ap_eNB.h" #include "f1ap_handlers.h" -#include "f1ap_decoder.h" - -#include "f1ap_default_values.h" - -#include "assertions.h" -#include "conversions.h" -#include "msc.h" +#include "f1ap_cu_interface_management.h" +#include "f1ap_du_interface_management.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; - -static -int f1ap_handle_f1_setup_request(uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); - -static -int f1ap_handle_f1_setup_response(uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); - /* Handlers matrix. Only f1 related procedure present here */ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* Reset */ - { f1ap_handle_f1_setup_request, f1ap_handle_f1_setup_response, 0 }, /* F1Setup */ + { CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, 0 }, /* F1Setup */ { 0, 0, 0 }, /* ErrorIndication */ - { f1ap_handle_f1_setup_request, 0, 0 }, /* gNBDUConfigurationUpdate */ - { f1ap_handle_f1_setup_request, 0, 0 }, /* gNBCUConfigurationUpdate */ - { f1ap_handle_f1_setup_request, 0, 0 }, /* UEContextSetup */ + { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* gNBDUConfigurationUpdate */ + { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* gNBCUConfigurationUpdate */ + { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* UEContextSetup */ { 0, 0, 0 }, /* UEContextRelease */ - { f1ap_handle_f1_setup_request, 0, 0 }, /* UEContextModification */ + { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* UEContextModification */ { 0, 0, 0 }, /* UEContextModificationRequired */ { 0, 0, 0 }, /* UEMobilityCommand */ { 0, 0, 0 }, /* UEContextReleaseRequest */ - { f1ap_handle_f1_setup_request, 0, 0 }, /* InitialULRRCMessageTransfer */ - { f1ap_handle_f1_setup_request, 0, 0 }, /* DLRRCMessageTransfer */ - { f1ap_handle_f1_setup_request, 0, 0 }, /* ULRRCMessageTransfer */ + { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* InitialULRRCMessageTransfer */ + { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* DLRRCMessageTransfer */ + { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* ULRRCMessageTransfer */ { 0, 0, 0 }, /* privateMessage */ { 0, 0, 0 }, /* UEInactivityNotification */ { 0, 0, 0 }, /* GNBDUResourceCoordination */ @@ -141,162 +118,4 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, (assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return ret; -} - -static -int f1ap_handle_f1_setup_request(uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) -{ - printf("f1ap_handle_f1_setup_request\n"); - - MessageDef *message_p; - F1AP_F1SetupRequest_t *container; - F1AP_F1SetupRequestIEs_t *ie; - int i = 0; - - - DevAssert(pdu != NULL); - - container = &pdu->choice.initiatingMessage->value.choice.F1SetupRequest; - - /* F1 Setup Request == Non UE-related procedure -> stream 0 */ - if (stream != 0) { - LOG_W(F1AP, "[SCTP %d] Received f1 setup request on stream != 0 (%d)\n", - assoc_id, stream); - } - - message_p = itti_alloc_new_message(TASK_RRC_ENB, F1AP_SETUP_REQ); - - /* assoc_id */ - F1AP_SETUP_REQ(message_p).assoc_id = assoc_id; - - /* gNB_DU_id */ - // this function exits if the ie is mandatory - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_gNB_DU_ID, true); - asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &F1AP_SETUP_REQ(message_p).gNB_DU_id); - printf("F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); - - /* gNB_DU_name */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_gNB_DU_Name, true); - F1AP_SETUP_REQ(message_p).gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char)); - memcpy(F1AP_SETUP_REQ(message_p).gNB_DU_name, ie->value.choice.GNB_DU_Name.buf, - ie->value.choice.GNB_DU_Name.size); - /* Convert the mme name to a printable string */ - F1AP_SETUP_REQ(message_p).gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; - printf ("F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); - - /* GNB_DU_Served_Cells_List */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); - F1AP_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; - printf ("F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available); - - int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available; - - for (i=0; i<num_cells_available; i++) { - F1AP_GNB_DU_Served_Cells_Item_t *served_celles_item_p; - - served_celles_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); - - /* tac */ - // @issue in here - OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); - printf ("F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); - - /* - nRCGI */ - TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], - F1AP_SETUP_REQ(message_p).mnc[i], - F1AP_SETUP_REQ(message_p).mnc_digit_length[i]); - - // @issue in here cellID - F1AP_SETUP_REQ(message_p).nr_cellid[i] = 1; - printf("[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, - F1AP_SETUP_REQ(message_p).mcc[i], - F1AP_SETUP_REQ(message_p).mnc[i], - F1AP_SETUP_REQ(message_p).nr_cellid[i]); - - /* - nRPCI */ - F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI; - printf ("F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); - - // System Information - /* mib */ - F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_celles_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); - memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_celles_item_p->gNB_DU_System_Information->mIB_message.buf, - served_celles_item_p->gNB_DU_System_Information->mIB_message.size); - /* Convert the mme name to a printable string */ - F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; - F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size; - printf ("F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); - - /* sib1 */ - F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); - memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_celles_item_p->gNB_DU_System_Information->sIB1_message.buf, - served_celles_item_p->gNB_DU_System_Information->sIB1_message.size); - /* Convert the mme name to a printable string */ - F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; - F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size; - printf ("F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); - } - - - *f1ap_du_data_from_du = F1AP_SETUP_REQ(message_p); - // char *measurement_timing_information[F1AP_MAX_NB_CELLS]; - // uint8_t ranac[F1AP_MAX_NB_CELLS]; - - // int fdd_flag = f1ap_setup_req->fdd_flag; - - // union { - // struct { - // uint32_t ul_nr_arfcn; - // uint8_t ul_scs; - // uint8_t ul_nrb; - - // uint32_t dl_nr_arfcn; - // uint8_t dl_scs; - // uint8_t dl_nrb; - - // uint32_t sul_active; - // uint32_t sul_nr_arfcn; - // uint8_t sul_scs; - // uint8_t sul_nrb; - - // uint8_t num_frequency_bands; - // uint16_t nr_band[32]; - // uint8_t num_sul_frequency_bands; - // uint16_t nr_sul_band[32]; - // } fdd; - // struct { - - // uint32_t nr_arfcn; - // uint8_t scs; - // uint8_t nrb; - - // uint32_t sul_active; - // uint32_t sul_nr_arfcn; - // uint8_t sul_scs; - // uint8_t sul_nrb; - - // uint8_t num_frequency_bands; - // uint16_t nr_band[32]; - // uint8_t num_sul_frequency_bands; - // uint16_t nr_sul_band[32]; - - // } tdd; - // } nr_mode_info[F1AP_MAX_NB_CELLS]; - - return itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(assoc_id), message_p); -} - -static -int f1ap_handle_f1_setup_response(uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) -{ - printf("f1ap_handle_f1_setup_response\n"); - - return 0; -} +} \ No newline at end of file diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index e51b5ad99b..c7ec5065f3 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -19,8 +19,7 @@ * contact@openairinterface.org */ -#include "intertask_interface.h" - +#include "f1ap_common.h" #include "f1ap_itti_messaging.h" void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, diff --git a/openair2/F1AP/f1ap_messaging.c b/openair2/F1AP/f1ap_messaging.c index 1be0ee9829..fb189eaed3 100644 --- a/openair2/F1AP/f1ap_messaging.c +++ b/openair2/F1AP/f1ap_messaging.c @@ -31,58 +31,36 @@ */ -#include "intertask_interface.h" - +#include "f1ap_common.h" #include "f1ap_messaging.h" -void f1ap_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_F1AP, 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 f1ap_send_nas_downlink_ind(instance_t instance, - uint16_t ue_initial_id, - uint32_t eNB_ue_s1ap_id, - uint8_t *nas_pdu, - uint32_t nas_pdu_length) -{ - MessageDef *message_p; - f1ap_downlink_nas_t *f1ap_downlink_nas; +// void f1ap_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_F1AP, F1AP_DOWNLINK_NAS); +// message_p = itti_alloc_new_message(TASK_F1AP, SCTP_DATA_REQ); - f1ap_downlink_nas = &message_p->ittiMsg.f1ap_downlink_nas; +// sctp_data_req = &message_p->ittiMsg.sctp_data_req; - f1ap_downlink_nas->ue_initial_id = ue_initial_id; - f1ap_downlink_nas->eNB_ue_s1ap_id = eNB_ue_f1ap_id; - f1ap_downlink_nas->nas_pdu.buffer = nas_pdu; - f1ap_downlink_nas->nas_pdu.length = nas_pdu_length; +// 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_RRC_ENB, instance, message_p); -} +// itti_send_msg_to_task(TASK_SCTP, instance, message_p); +// } -void f1ap_send_sctp_close_association(instance_t instance, int32_t assoc_id) -{ - MessageDef *message_p = NULL; - sctp_close_association_t *sctp_close_association_p = NULL; +// void f1ap_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_F1AP, SCTP_CLOSE_ASSOCIATION); - sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; - sctp_close_association_p->assoc_id = assoc_id; +// message_p = itti_alloc_new_message(TASK_F1AP, 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); -} +// itti_send_msg_to_task(TASK_SCTP, instance, message_p); +// } diff --git a/openair2/F1AP/f1ap_messaging.h b/openair2/F1AP/f1ap_messaging.h index 8d224ab75b..9ad0388d01 100644 --- a/openair2/F1AP/f1ap_messaging.h +++ b/openair2/F1AP/f1ap_messaging.h @@ -37,12 +37,6 @@ void f1ap_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, uint32_t buffer_length, uint16_t stream); -void f1ap_send_nas_downlink_ind(instance_t instance, - uint16_t ue_initial_id, - uint32_t eNB_ue_f1ap_id, - uint8_t *nas_pdu, - uint32_t nas_pdu_length); - void f1ap_send_sctp_close_association(instance_t instance, int32_t assoc_id); -- GitLab From 9a4fce616379cf84c8f6ddbe41cf6f2e97afddee Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 13 Sep 2018 18:59:47 +0200 Subject: [PATCH 057/308] Unify headers for interface_management, remove some warnings --- openair2/F1AP/f1ap_cu_interface_management.c | 64 ++++++++++++------- openair2/F1AP/f1ap_cu_interface_management.h | 60 ++++++++++++++++-- openair2/F1AP/f1ap_du_interface_management.c | 66 ++++++++++++-------- openair2/F1AP/f1ap_du_interface_management.h | 64 +++++++++++++++++-- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 4 +- 5 files changed, 197 insertions(+), 61 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index e28a1ac811..517c319e4d 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -31,25 +31,25 @@ */ #include "f1ap_common.h" +#include "f1ap_encoder.h" +#include "f1ap_decoder.h" #include "f1ap_du_interface_management.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; -/* - Reset -*/ -void CU_send_RESET(F1AP_Reset_t *Reset) { + +void CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { +void CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_RESET(F1AP_Reset_t *Reset) { +void CU_handle_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { +void CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -57,11 +57,11 @@ void CU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { /* Error Indication */ -void CU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { +void CU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { +void CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -69,9 +69,10 @@ void CU_send_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { /* F1 Setup */ -int CU_handle_F1_SETUP_REQUEST(uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) +void CU_handle_F1_SETUP_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { printf("CU_handle_F1_SETUP_REQUEST\n"); @@ -213,10 +214,11 @@ int CU_handle_F1_SETUP_REQUEST(uint32_t assoc_id, // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - return itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(assoc_id), message_p); + itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); } -void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) { +void CU_send_F1_SETUP_RESPONSE(instance_t instance, + f1ap_setup_resp_t *f1ap_setup_resp) { module_id_t enb_mod_idP; module_id_t cu_mod_idP; @@ -350,7 +352,8 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setu } -void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure) { +void CU_send_F1_SETUP_FAILURE(instance_t instance, + F1AP_F1SetupFailure_t *F1SetupFailure) { AssertFatal(1==0,"Not implemented yet\n"); //AssertFatal(1==0,"Not implemented yet\n"); //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); @@ -362,15 +365,18 @@ void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure) { gNB-DU Configuration Update */ -void CU_handle_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { +void CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, + F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure) { +void CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, + F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge) { +void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -381,7 +387,7 @@ void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpda */ //void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { -void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP) { +void CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP) { F1AP_F1AP_PDU_t pdu; F1AP_GNBCUConfigurationUpdate_t *out; F1AP_GNBCUConfigurationUpdateIEs_t *ie; @@ -411,7 +417,7 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du ie->id = F1AP_ProtocolIE_ID_id_TransactionID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, du_mod_idP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -758,10 +764,22 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du } } -void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { +void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, + F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { +void CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); -} \ No newline at end of file +} + +void CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, + F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest) { + AssertFatal(0, "Not implemented yet\n"); +} + +void CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, + F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse) { + AssertFatal(0, "Not implemented yet\n"); +} diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h index a0b0ddb20c..8b4b88dc4e 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.h +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -33,12 +33,62 @@ #ifndef F1AP_CU_INTERFACE_MANAGEMENT_H_ #define F1AP_CU_INTERFACE_MANAGEMENT_H_ -int CU_handle_F1_SETUP_REQUEST(uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +/* + * Reset + */ +void CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); +void CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); +void CU_handle_RESET(instance_t instance, F1AP_Reset_t *Reset); +void CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); + +/* + * Error Indication + */ +void CU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); +void CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); + +/* + * F1 Setup + */ +void CU_handle_F1_SETUP_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp); -void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure); +void CU_send_F1_SETUP_FAILURE(instance_t instance, F1AP_F1SetupFailure_t *F1SetupFailure); + +/* + * gNB-DU Configuration Update + */ +void CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, + F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate); + +void CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, + F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure); + +void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge); + +/* + * gNB-CU Configuration Update + */ +void CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP); + +void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, + F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure); + +void CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge); + +/* + * gNB-DU Resource Coordination + */ +void CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, + F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest); + +void CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, + F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse); -#endif /* F1AP_CU_INTERFACE_MANAGEMENT_H_ */ \ No newline at end of file +#endif /* F1AP_CU_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 2efd22fb23..43348f5d51 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -31,29 +31,26 @@ */ #include "f1ap_common.h" +#include "f1ap_encoder.h" +#include "f1ap_decoder.h" #include "f1ap_du_interface_management.h" extern f1ap_setup_req_t *f1ap_du_data; -/* - Reset -*/ - - -void DU_handle_RESET(F1AP_Reset_t *Reset) { +void DU_handle_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { +void DU_send_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_RESET(F1AP_Reset_t *Reset) { +void DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { +void DU_handle_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -62,11 +59,11 @@ void DU_handle_RESET_ACKKNOWLEDGE(F1AP_ResetAcknowledge_t *ResetAcknowledge) { Error Indication */ -void DU_send_ERROR_INDICATION(struct F1AP_F1AP_PDU_t *pdu_p) { +void DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_ERROR_INDICATION(F1AP_ErrorIndication_t *ErrorIndication) { +void DU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -305,9 +302,10 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); } -int DU_handle_F1_SETUP_RESPONSE(uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) +int DU_handle_F1_SETUP_RESPONSE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { printf("DU_handle_F1_SETUP_RESPONSE\n"); @@ -315,7 +313,7 @@ int DU_handle_F1_SETUP_RESPONSE(uint32_t assoc_id, } // SETUP FAILURE -void DU_handle_F1_SETUP_FAILURE(F1AP_F1AP_PDU_t *pdu_p) { +void DU_handle_F1_SETUP_FAILURE(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -325,7 +323,9 @@ void DU_handle_F1_SETUP_FAILURE(F1AP_F1AP_PDU_t *pdu_p) { */ //void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { -void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du_mod_idP, f1ap_setup_req_t *f1ap_du_data) { +void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, + instance_t du_mod_idP, + f1ap_setup_req_t *f1ap_du_data) { F1AP_F1AP_PDU_t pdu; F1AP_GNBDUConfigurationUpdate_t *out; F1AP_GNBDUConfigurationUpdateIEs_t *ie; @@ -351,7 +351,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du ie->id = F1AP_ProtocolIE_ID_id_TransactionID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, du_mod_idP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -766,27 +766,39 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du -void DU_handle_gNB_DU_CONFIGURATION_FAILURE(F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure) { +void DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, + F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBDUConfigurationUpdateAcknowledge_t GNBDUConfigurationUpdateAcknowledge) { +void DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + F1AP_GNBDUConfigurationUpdateAcknowledge_t GNBDUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } -/* - gNB-CU Configuration Update -*/ - -void DU_handle_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { +void DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, + F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { +void DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, + F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { +void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); -} \ No newline at end of file +} + + +void DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, + F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest) { + AssertFatal(0, "Not implemented yet\n"); +} + +void DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, + F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse) { + AssertFatal(0, "Not implemented yet\n"); +} diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index 1ee1be658f..7e925b0b97 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -33,12 +33,66 @@ #ifndef F1AP_DU_INTERFACE_MANAGEMENT_H_ #define F1AP_DU_INTERFACE_MANAGEMENT_H_ +/* + * Reset + */ +void DU_handle_RESET(instance_t instance, F1AP_Reset_t *Reset); +void DU_send_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); +void DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); +void DU_handle_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); + +/* + * Error Indication + */ +void DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p); +void DU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); + + +/* + * F1 Setup + */ void DU_send_F1_SETUP_REQUEST(instance_t instance); -int DU_handle_F1_SETUP_RESPONSE(uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_F1_SETUP_RESPONSE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +void DU_handle_F1_SETUP_FAILURE(instance_t instance, F1AP_F1AP_PDU_t *pdu_p); + +/* + * gNB-DU Configuration Update + */ +void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, + instance_t du_mod_idP, + f1ap_setup_req_t *f1ap_du_data); + +void DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, + F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure); + +void DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + F1AP_GNBDUConfigurationUpdateAcknowledge_t GNBDUConfigurationUpdateAcknowledge); + +/* + * gNB-CU Configuration Update + */ +void DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, + F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate); + +void DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, + F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure); + +void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge); + + +/* + * gNB-DU Resource Coordination + */ +void DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, + F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest); -void DU_handle_F1_SETUP_FAILURE(F1AP_F1AP_PDU_t *pdu_p); +void DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, + F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse); -#endif /* F1AP_DU_INTERFACE_MANAGEMENT_H_ */ \ No newline at end of file +#endif /* F1AP_DU_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 7e2a113329..a7befd38e2 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -31,6 +31,8 @@ */ #include "f1ap_common.h" +#include "f1ap_encoder.h" +#include "f1ap_decoder.h" #include "f1ap_du_rrc_message_transfer.h" // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which @@ -212,4 +214,4 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( // printf("Failed to decode F1 setup request\n"); // } //AssertFatal(1==0,"Not implemented yet\n"); -} \ No newline at end of file +} -- GitLab From ef1627fac7f71f102fba9b5bb75be05b8d4514f5 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Thu, 13 Sep 2018 19:55:01 +0200 Subject: [PATCH 058/308] INITIAL_UL_RRC_MESSAGE at DU and CU respectively is developped --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 98 +++++++++++++++++++- openair2/F1AP/f1ap_cu_rrc_message_transfer.h | 3 + openair2/F1AP/f1ap_du_interface_management.c | 7 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 4 +- openair2/F1AP/f1ap_handlers.c | 3 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 8 +- openair2/RRC/LTE/L2_interface.c | 78 ++++++++-------- openair2/RRC/LTE/rrc_proto.h | 2 +- 8 files changed, 152 insertions(+), 51 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index b2a58a77bd..fb59a57901 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -32,18 +32,112 @@ #include "f1ap_common.h" #include "f1ap_cu_rrc_message_transfer.h" +// undefine C_RNTI from +// openair1/PHY/LTE_TRANSPORT/transport_common.h which +// replaces in ie->value.choice.C_RNTI, causing +// a compile error +#undef C_RNTI /* Initial UL RRC Message Transfer */ -void CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(void) { +int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { - printf("CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER\n"); + printf("CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); // decode the F1 message // get the rrc message from the contauiner // call func rrc_eNB_decode_ccch: <-- needs some update here + MessageDef *message_p; + F1AP_InitialULRRCMessageTransfer_t *container; + F1AP_InitialULRRCMessageTransferIEs_t *ie; + + SRB_INFO* Srb_info; + protocol_ctxt_t ctxt; + rnti_t rnti; + uint8_t *ccch_sdu; + sdu_size_t ccch_sdu_len; + int CC_id =0; + int instance=0; + uint64_t du_ue_f1ap_id; + + DevAssert(pdu != NULL); + + if (stream != 0) { + LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", + assoc_id, stream); + return -1; + } + + container = &pdu->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer; + + /* GNB_DU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + + /* NRCGI */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_NRCGI, true); + instance = 0; ///ie->value.choice. ?? //@Todo + + /* RNTI */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_C_RNTI, true); + BIT_STRING_TO_CELL_IDENTITY(&ie->value.choice.C_RNTI, rnti); + + /* RRC Container */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_RRCContainer, true); + + ccch_sdu = calloc(ie->value.choice.RRCContainer.size + 1, sizeof(char)); + memcpy(ccch_sdu, ie->value.choice.RRCContainer.buf, + ie->value.choice.RRCContainer.size); + /* Convert the mme name to a printable string */ + ccch_sdu[ie->value.choice.RRCContainer.size] = '\0'; + printf ("RRCContainer %s \n", ccch_sdu); + + ccch_sdu_len = ie->value.choice.RRCContainer.size; + + // create an ITTI message + message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, ccch_sdu, ccch_sdu_len); + RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; + RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; + RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; + RRC_MAC_CCCH_DATA_IND (message_p).enb_index = instance; // CU instance + RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; + RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; + itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); + + + // OR creat the ctxt and srb_info struct required by rrc_eNB_decode_ccch +/* + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, // to fix + ENB_FLAG_YES, + rnti, + 0, // frame + 0); // slot + + CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; + srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; + + if (ccch_sdu_len >= RRC_BUFFER_SIZE_MAX) { + LOG_E(RRC, "CCCH message has size %d > %d\n",ccch_sdu_len,RRC_BUFFER_SIZE_MAX); + break; + } + memcpy(srb_info_p->Rx_buffer.Payload, + ccch_sdu, + ccch_sdu_len); + srb_info->Rx_buffer.payload_size = ccch_sdu_len; + rrc_eNB_decode_ccch(&ctxt, srb_info, CC_id); + */ // if size > 0 // CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size) } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h index 24d5a7528a..77fd25da29 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h @@ -33,4 +33,7 @@ #ifndef F1AP_CU_RRC_MESSAGE_TRANSFER_H_ #define F1AP_CU_RRC_MESSAGE_TRANSFER_H_ +int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */ \ No newline at end of file diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 2efd22fb23..2675944eab 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -310,7 +310,6 @@ int DU_handle_F1_SETUP_RESPONSE(uint32_t assoc_id, F1AP_F1AP_PDU_t *pdu) { printf("DU_handle_F1_SETUP_RESPONSE\n"); - return 0; } @@ -382,7 +381,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du /* - nRCGI */ F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; /* - nRPCI */ @@ -536,7 +535,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du F1AP_NRCGI_t oldNRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &oldNRCGI.nRCellIdentity); served_cells_to_modify_item.oldNRCGI = oldNRCGI; @@ -548,7 +547,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; /* - nRPCI */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 7e2a113329..f8606e0eef 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -163,7 +163,7 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[0], f1ap_du_data->mnc[0], f1ap_du_data->mnc_digit_length[0], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); ie->value.choice.NRCGI = nRCGI; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -206,7 +206,7 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( printf("\n"); - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); + du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); /* decode */ // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { // printf("Failed to decode F1 setup request\n"); diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index e4178e358c..25b2234d6c 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -34,6 +34,7 @@ #include "f1ap_handlers.h" #include "f1ap_cu_interface_management.h" #include "f1ap_du_interface_management.h" +#include "f1ap_cu_rrc_message_transfer.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; @@ -52,7 +53,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* UEContextModificationRequired */ { 0, 0, 0 }, /* UEMobilityCommand */ { 0, 0, 0 }, /* UEContextReleaseRequest */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* InitialULRRCMessageTransfer */ + { CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* InitialULRRCMessageTransfer */ { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* DLRRCMessageTransfer */ { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* ULRRCMessageTransfer */ { 0, 0, 0 }, /* privateMessage */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index b8cf85a0a3..f55f22b8d4 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -367,7 +367,7 @@ rx_sdu(const module_id_t enb_mod_idP, ra = &mac->common_channels[CC_idP].ra[ii]; if ((ra->rnti == current_rnti) && (ra->state != IDLE)) { //int RC.cudu.du_flag = 1; - int du_flag = 1; + //int du_flag = 1; mac_rrc_data_ind( enb_mod_idP, CC_idP, @@ -377,7 +377,7 @@ rx_sdu(const module_id_t enb_mod_idP, (uint8_t *) payload_ptr, rx_lengths[i], 0, - du_flag + RC.rrc[enb_mod_idP]->node_type ); // prepare transmission of Msg4(RRCConnectionReconfiguration) ra->state = MSGCRNTI; @@ -619,7 +619,7 @@ rx_sdu(const module_id_t enb_mod_idP, } //int RC.cudu.du_flag = 1; - int du_flag = 1; + //int du_flag = 1; mac_rrc_data_ind( enb_mod_idP, CC_idP, @@ -629,7 +629,7 @@ rx_sdu(const module_id_t enb_mod_idP, (uint8_t *) payload_ptr, rx_lengths[i], 0, - du_flag + RC.rrc[enb_mod_idP]->node_type ); diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index e848ac47a9..02335aa99a 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -226,31 +226,31 @@ mac_rrc_data_req( } //-------------------------------------------------------------------------- -int8_t -mac_du_data_ind( - const module_id_t module_idP, - const int CC_idP, - const int UE_id, - const rnti_t rntiP, - const uint8_t *sduP, - const sdu_size_t sdu_lenP -) -//-------------------------------------------------------------------------- -{ - printf( - "[F1 %d][RAPROC] CC_id %d current_rnti %x Received Msg3 from already registered UE %d: length %d, offset %ld\n", - module_idP, CC_idP, rntiP, - UE_id, sdu_lenP, sduP); - - DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( - module_idP, - CC_idP, - UE_id, - rntiP, - sduP, - sdu_lenP - ); -} +// int8_t +// mac_du_data_ind( +// const module_id_t module_idP, +// const int CC_idP, +// const int UE_id, +// const rnti_t rntiP, +// const uint8_t *sduP, +// const sdu_size_t sdu_lenP +// ) +// //-------------------------------------------------------------------------- +// { +// printf( +// "[F1 %d][RAPROC] CC_id %d current_rnti %x Received Msg3 from already registered UE %d: length %d, offset %ld\n", +// module_idP, CC_idP, rntiP, +// UE_id, sdu_lenP, sduP); + +// DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( +// module_idP, +// CC_idP, +// UE_id, +// rntiP, +// sduP, +// sdu_lenP +// ); +// } //------------------------------------------------------------------------------ int8_t @@ -265,21 +265,25 @@ mac_rrc_data_ind( const uint8_t* sduP, const sdu_size_t sdu_lenP, const uint8_t mbsfn_sync_areaP, - const int du_flag + const int node_type ) //-------------------------------------------------------------------------- { - - // navid update / Bing-Kai modify - if (du_flag) { - mac_du_data_ind( - module_idP, - CC_id, - UE_id, - rntiP, - sduP, - sdu_lenP); - } + LOG_E(RRC, "node_type == %d \n" , node_type); + if (node_type == ngran_eNB_DU) { + LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %d length %d for UE id %d RNTI %x \n", + module_idP, srb_idP, sdu_lenP, UE_id, rntiP); + + DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( + module_idP, + CC_id, + UE_id, + rntiP, + sduP, + sdu_lenP + ); + return(0); + } SRB_INFO *Srb_info; protocol_ctxt_t ctxt; diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index 0c87d18094..68c8655714 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -428,7 +428,7 @@ mac_rrc_data_ind( const uint8_t* sduP, const sdu_size_t sdu_lenP, const uint8_t mbsfn_sync_areaP, - const int du_flag + const int node_type ); int8_t -- GitLab From 5d06dcc30619f85fbbefd904ddae5a10c6c73dd8 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Thu, 13 Sep 2018 20:12:04 +0200 Subject: [PATCH 059/308] fix Segmentation fault when f1ap_message_decoded_callback have not define instance_t for arguments --- openair2/F1AP/f1ap_common.h | 1 + openair2/F1AP/f1ap_cu_task.c | 7 ++++--- openair2/F1AP/f1ap_cu_task.h | 2 +- openair2/F1AP/f1ap_du_task.c | 7 ++++--- openair2/F1AP/f1ap_du_task.h | 2 +- openair2/F1AP/f1ap_handlers.c | 4 ++-- openair2/F1AP/f1ap_handlers.h | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 3dced33ac9..384f261de2 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -419,6 +419,7 @@ inline void ASN_DEBUG(const char *fmt, ...); /** \brief Function callback prototype. **/ typedef int (*f1ap_message_decoded_callback)( + instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *message_p diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 742e57b404..c7deb55e16 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -65,12 +65,12 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams; } -void cu_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { +void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { int result; DevAssert(sctp_data_ind != NULL); - f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, + f1ap_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream, sctp_data_ind->buffer, sctp_data_ind->buffer_length); result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); @@ -132,7 +132,8 @@ void *F1AP_CU_task(void *arg) { case SCTP_DATA_IND: LOG_I(CU_F1AP, "SCTP_DATA_IND\n"); - cu_task_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + cu_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_SETUP_RESP: // from rrc diff --git a/openair2/F1AP/f1ap_cu_task.h b/openair2/F1AP/f1ap_cu_task.h index b12b22dc78..60747efbcb 100644 --- a/openair2/F1AP/f1ap_cu_task.h +++ b/openair2/F1AP/f1ap_cu_task.h @@ -24,7 +24,7 @@ void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind); void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); -void cu_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind); +void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind); void cu_task_send_sctp_init_req(instance_t enb_id); void *F1AP_CU_task(void *arg); diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 091428b1e7..1bc49270f0 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -97,13 +97,13 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat DU_send_F1_SETUP_REQUEST(instance); } -void du_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) +void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { int result; DevAssert(sctp_data_ind != NULL); - f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, + f1ap_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream, sctp_data_ind->buffer, sctp_data_ind->buffer_length); result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); @@ -154,7 +154,8 @@ void *F1AP_DU_task(void *arg) { case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); - du_task_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + du_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_data_ind); break; case TERMINATE_MESSAGE: diff --git a/openair2/F1AP/f1ap_du_task.h b/openair2/F1AP/f1ap_du_task.h index ffae6ac339..47d0827809 100644 --- a/openair2/F1AP/f1ap_du_task.h +++ b/openair2/F1AP/f1ap_du_task.h @@ -24,7 +24,7 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req); void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); -void du_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind); +void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind); void *F1AP_DU_task(void *arg); #endif /* DU_F1AP_TASK_H_ */ diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 25b2234d6c..62b1f3226e 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -78,7 +78,7 @@ static const char *f1ap_direction_String[] = { return(f1ap_direction_String[f1ap_dir]); } -int f1ap_handle_message(uint32_t assoc_id, int32_t stream, +int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, const uint8_t * const data, const uint32_t data_length) { F1AP_F1AP_PDU_t pdu; @@ -116,7 +116,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, /* Calling the right handler */ ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) - (assoc_id, stream, &pdu); + (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return ret; } \ No newline at end of file diff --git a/openair2/F1AP/f1ap_handlers.h b/openair2/F1AP/f1ap_handlers.h index c3a7b7b225..631249a324 100644 --- a/openair2/F1AP/f1ap_handlers.h +++ b/openair2/F1AP/f1ap_handlers.h @@ -33,7 +33,7 @@ #ifndef F1AP_HANDLERS_H_ #define F1AP_HANDLERS_H_ -int f1ap_handle_message(uint32_t assoc_id, int32_t stream, +int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, const uint8_t * const data, const uint32_t data_length); #endif /* F1AP_HANDLERS_H_ */ -- GitLab From cedc13d7eade43d03ee17a8b2dd6ae0aaba974eb Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 14 Sep 2018 11:04:50 +0200 Subject: [PATCH 060/308] Implement the F1_SETUP_FAILURE procedure --- openair2/F1AP/f1ap_cu_interface_management.c | 100 ++++++++++++++++--- openair2/F1AP/f1ap_cu_interface_management.h | 2 +- openair2/F1AP/f1ap_du_interface_management.c | 9 +- openair2/F1AP/f1ap_du_interface_management.h | 5 +- openair2/F1AP/f1ap_handlers.c | 14 +-- 5 files changed, 105 insertions(+), 25 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 517c319e4d..4564c99794 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -128,7 +128,6 @@ void CU_handle_F1_SETUP_REQUEST(instance_t instance, served_celles_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); /* tac */ - // @issue in here OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); printf ("F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); @@ -213,8 +212,11 @@ void CU_handle_F1_SETUP_REQUEST(instance_t instance, // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - - itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); + if (num_cells_available < 1) { + itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); + } else { + CU_send_F1_SETUP_FAILURE(instance); + } } void CU_send_F1_SETUP_RESPONSE(instance_t instance, @@ -352,11 +354,86 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, } -void CU_send_F1_SETUP_FAILURE(instance_t instance, - F1AP_F1SetupFailure_t *F1SetupFailure) { - AssertFatal(1==0,"Not implemented yet\n"); - //AssertFatal(1==0,"Not implemented yet\n"); - //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); +void CU_send_F1_SETUP_FAILURE(instance_t instance) { + printf("CU_send_F1_SETUP_FAILURE\n"); + + module_id_t enb_mod_idP; + module_id_t cu_mod_idP; + + enb_mod_idP = (module_id_t)12; + cu_mod_idP = (module_id_t)34; + + F1AP_F1AP_PDU_t pdu; + F1AP_F1SetupFailure_t *out; + F1AP_F1SetupFailureIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_unsuccessfulOutcome; + pdu.choice.unsuccessfulOutcome = (F1AP_UnsuccessfulOutcome_t *)calloc(1, sizeof(F1AP_UnsuccessfulOutcome_t)); + pdu.choice.unsuccessfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; + pdu.choice.unsuccessfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.unsuccessfulOutcome->value.present = F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure; + out = &pdu.choice.unsuccessfulOutcome->value.choice.F1SetupFailure; + + /* mandatory */ + /* c1. Transaction ID (integer value)*/ + ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupFailureIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. Cause */ + ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cause; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupFailureIEs__value_PR_Cause; + ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + ie->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. TimeToWait */ + if (0) { + ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TimeToWait; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupFailureIEs__value_PR_TimeToWait; + ie->value.choice.TimeToWait = F1AP_TimeToWait_v10s; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c4. CriticalityDiagnostics*/ + if (0) { + ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupFailureIEs__value_PR_CriticalityDiagnostics; + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + *ie->value.choice.CriticalityDiagnostics.transactionID = 0; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); } @@ -756,12 +833,7 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod return; } - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); } void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h index 8b4b88dc4e..9902d1a58f 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.h +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -57,7 +57,7 @@ void CU_handle_F1_SETUP_REQUEST(instance_t instance, void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp); -void CU_send_F1_SETUP_FAILURE(instance_t instance, F1AP_F1SetupFailure_t *F1SetupFailure); +void CU_send_F1_SETUP_FAILURE(instance_t instance); /* * gNB-DU Configuration Update diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 82e2ab0f01..dfcd6048a3 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -312,8 +312,13 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, } // SETUP FAILURE -void DU_handle_F1_SETUP_FAILURE(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { - AssertFatal(1==0,"Not implemented yet\n"); +int DU_handle_F1_SETUP_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ + LOG_E(DU_F1AP, "DU_handle_F1_SETUP_FAILURE\n"); + return 0; } diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index 7e925b0b97..1c23ad987f 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -58,7 +58,10 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -void DU_handle_F1_SETUP_FAILURE(instance_t instance, F1AP_F1AP_PDU_t *pdu_p); +int DU_handle_F1_SETUP_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-DU Configuration Update diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 62b1f3226e..068fdf5849 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -43,19 +43,19 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* Reset */ - { CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, 0 }, /* F1Setup */ + { CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, DU_handle_F1_SETUP_FAILURE }, /* F1Setup */ { 0, 0, 0 }, /* ErrorIndication */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* gNBDUConfigurationUpdate */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* gNBCUConfigurationUpdate */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* UEContextSetup */ + { 0, 0, 0 }, /* gNBDUConfigurationUpdate */ + { 0, 0, 0 }, /* gNBCUConfigurationUpdate */ + { 0, 0, 0 }, /* UEContextSetup */ { 0, 0, 0 }, /* UEContextRelease */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* UEContextModification */ + { 0, 0, 0 }, /* UEContextModification */ { 0, 0, 0 }, /* UEContextModificationRequired */ { 0, 0, 0 }, /* UEMobilityCommand */ { 0, 0, 0 }, /* UEContextReleaseRequest */ { CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* InitialULRRCMessageTransfer */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* DLRRCMessageTransfer */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* ULRRCMessageTransfer */ + { 0, 0, 0 }, /* DLRRCMessageTransfer */ + { 0, 0, 0 }, /* ULRRCMessageTransfer */ { 0, 0, 0 }, /* privateMessage */ { 0, 0, 0 }, /* UEInactivityNotification */ { 0, 0, 0 }, /* GNBDUResourceCoordination */ -- GitLab From 30977ecc12feb850a94bd5a0ec0e7bb525a7ded8 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 14 Sep 2018 15:12:37 +0200 Subject: [PATCH 061/308] Replace some dummy value with DU from exist define in f1ap_setup_req_t --- openair2/ENB_APP/enb_config.c | 2 +- openair2/F1AP/f1ap_cu_interface_management.c | 2 +- openair2/F1AP/f1ap_du_interface_management.c | 14 +++++++------- openair2/F1AP/f1ap_du_ue_context_management.c | 14 ++------------ 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index b6e16f35ae..fcdd0fc893 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2477,7 +2477,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; } - F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = NULL; + F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = "0"; F1AP_SETUP_REQ (msg_p).ranac[k] = 0; F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier[0].MIB; F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier[0].SIB1; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 4564c99794..c3f1e5e34c 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -212,7 +212,7 @@ void CU_handle_F1_SETUP_REQUEST(instance_t instance, // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - if (num_cells_available < 1) { + if (num_cells_available > 0) { itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); } else { CU_send_F1_SETUP_FAILURE(instance); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index dfcd6048a3..94dec3659b 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -265,7 +265,7 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { served_cell_information.nR_Mode_Info = nR_Mode_Info; /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = "0"; //&f1ap_du_data->measurement_timing_information[i]; // sept. 2018 + char *measurementTimingConfiguration = f1ap_du_data->measurement_timing_information[i]; // sept. 2018 OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, measurementTimingConfiguration, @@ -390,11 +390,11 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = 321L; // int 0..1007 + served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - "10", + &f1ap_du_data->tac[i], 3); /* - Configured_EPS_TAC */ @@ -556,11 +556,11 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = 321L; // int 0..1007 + served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - "10", + &f1ap_du_data->tac[i], 3); /* - Configured_EPS_TAC */ @@ -706,7 +706,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, F1AP_NRCGI_t oldNRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &oldNRCGI.nRCellIdentity); served_cells_to_delete_item.oldNRCGI = oldNRCGI; /* ADD */ @@ -742,7 +742,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); active_cells_item.nRCGI = nRCGI; /* ADD */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 281e5f58a6..57dfa4703b 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -259,18 +259,8 @@ void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { /* - nRCGI */ F1AP_NRCGI_t nRCGI; // issue here MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); -// - // INT32_TO_BIT_STRING(123, &nRCGI.nRCellIdentity); - // nRCGI.nRCellIdentity.buf = malloc((36+7)/8); - // nRCGI.nRCellIdentity.size = (36+7)/8; - // nRCGI.nRCellIdentity.bits_unused = 4; - - // nRCGI.nRCellIdentity.buf[0] = 123; - - //nRCGI.nRCellIdentity = 15; - - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); sCell_FailedtoSetup_item.sCell_ID = nRCGI; @@ -625,7 +615,7 @@ void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); scell_failedtoSetupMod_item.sCell_ID = nRCGI; -- GitLab From 62a5d9031d77313044e59e2c08cabd4dbe67a77b Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 14 Sep 2018 16:45:15 +0200 Subject: [PATCH 062/308] Update complete the NR_Mode_Info structure for F1 SETUP REQUEST --- openair2/COMMON/f1ap_messages_types.h | 13 +- openair2/ENB_APP/enb_config.c | 14 +- openair2/F1AP/f1ap_du_interface_management.c | 180 ++++++++++++++----- 3 files changed, 153 insertions(+), 54 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 4cb1b4bbab..824cf657a5 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -127,10 +127,15 @@ typedef struct f1ap_setup_req_s { uint8_t sul_scs; uint8_t sul_nrb; - uint8_t num_frequency_bands; - uint16_t nr_band[32]; - uint8_t num_sul_frequency_bands; - uint16_t nr_sul_band[32]; + uint8_t ul_num_frequency_bands; + uint16_t ul_nr_band[32]; + uint8_t ul_num_sul_frequency_bands; + uint16_t ul_nr_sul_band[32]; + + uint8_t dl_num_frequency_bands; + uint16_t dl_nr_band[32]; + uint8_t dl_num_sul_frequency_bands; + uint16_t dl_nr_sul_band[32]; } fdd; struct { diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index fcdd0fc893..d16a81d873 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2473,8 +2473,18 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { // use nrb field to hold LTE N_RB_DL (0...5) F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = rrc->carrier[0].mib.message.dl_Bandwidth; F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = rrc->carrier[0].mib.message.dl_Bandwidth; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.num_frequency_bands = 1; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + + // RK: we need to check there value for FDD's frequency_bands DL/UL + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_num_frequency_bands = 1; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_num_sul_frequency_bands = 0; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_sul_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_num_sul_frequency_bands = 0; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_sul_band[0] = rrc->carrier[0].sib1->freqBandIndicator; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; } F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = "0"; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 94dec3659b..454032a8ff 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -199,68 +199,152 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { //f1ap_du_data->fdd_flag = 1; if (f1ap_du_data->fdd_flag) { // FDD nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; - /* > FDD >> FDD Info */ F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); - /* >>> UL NRFreqInfo */ - fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_arfcn; - - F1AP_FreqBandNrItem_t ul_freqBandNrItem; - memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 777L; - - F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; - memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); - - /* >>> DL NRFreqInfo */ - fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_arfcn; - - F1AP_FreqBandNrItem_t dl_freqBandNrItem; - memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 777L; - - F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; - memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - dl_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); - - /* >>> UL Transmission Bandwidth */ + /* FDD.1 UL NRFreqInfo */ + /* FDD.1.1 UL NRFreqInfo ARFCN */ + fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer + + /* FDD.1.2 F1AP_SUL_Information */ + if(0) { // Optional + F1AP_SUL_Information_t *fdd_sul_info = (F1AP_SUL_Information_t *)calloc(1, sizeof(F1AP_SUL_Information_t)); + fdd_sul_info->sUL_NRARFCN = 0; + fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; + fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; + fDD_Info->uL_NRFreqInfo.sul_Information = fdd_sul_info; + } + + /* FDD.1.3 freqBandListNr */ + int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands; + printf("fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); + int fdd_ul_j; + for (fdd_ul_j=0; + fdd_ul_j<fdd_ul_num_available_freq_Bands; + fdd_ul_j++) { + + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + /* FDD.1.3.1 freqBandIndicatorNr*/ + nr_freqBandNrItem.freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // + + /* FDD.1.3.2 supportedSULBandList*/ + int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; + printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + int fdd_ul_k; + for (fdd_ul_k=0; + fdd_ul_k<num_available_supported_SULBands; + fdd_ul_k++) { + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + /* FDD.1.3.2.1 freqBandIndicatorNr */ + nr_supportedSULFreqBandItem.freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_sul_band[fdd_ul_k]; // + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + } // for FDD : UL supported_SULBands + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + } // for FDD : UL freq_Bands + + /* FDD.2 DL NRFreqInfo */ + /* FDD.2.1 DL NRFreqInfo ARFCN */ + fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer + + /* FDD.2.2 F1AP_SUL_Information */ + if(0) { // Optional + F1AP_SUL_Information_t *fdd_sul_info = (F1AP_SUL_Information_t *)calloc(1, sizeof(F1AP_SUL_Information_t)); + fdd_sul_info->sUL_NRARFCN = 0; + fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; + fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; + fDD_Info->dL_NRFreqInfo.sul_Information = fdd_sul_info; + } + + /* FDD.2.3 freqBandListNr */ + int fdd_dl_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_frequency_bands; + printf("fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); + int fdd_dl_j; + for (fdd_dl_j=0; + fdd_dl_j<fdd_dl_num_available_freq_Bands; + fdd_dl_j++) { + + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + /* FDD.2.3.1 freqBandIndicatorNr*/ + nr_freqBandNrItem.freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // + + /* FDD.2.3.2 supportedSULBandList*/ + int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; + printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + int fdd_dl_k; + for (fdd_dl_k=0; + fdd_dl_k<num_available_supported_SULBands; + fdd_dl_k++) { + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + /* FDD.2.3.2.1 freqBandIndicatorNr */ + nr_supportedSULFreqBandItem.freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_sul_band[fdd_dl_k]; // + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + } // for FDD : DL supported_SULBands + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + } // for FDD : DL freq_Bands + + /* FDD.3 UL Transmission Bandwidth */ fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs; fDD_Info->uL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.ul_nrb; - /* >>> DL Transmission Bandwidth */ + /* FDD.4 DL Transmission Bandwidth */ fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs; fDD_Info->dL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.dl_nrb; nR_Mode_Info.choice.fDD = fDD_Info; } else { // TDD nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; - - /* > TDD >> TDD Info */ F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); - /* >>> ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].tdd.nr_arfcn; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - // RK: missing params - nr_freqBandNrItem.freqBandIndicatorNr = 555L; - F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; - memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - - tDD_Info->transmission_Bandwidth.nRSCS= f1ap_du_data->nr_mode_info[i].tdd.scs; - tDD_Info->transmission_Bandwidth.nRNRB= f1ap_du_data->nr_mode_info[i].tdd.nrb; + /* TDD.1 nRFreqInfo */ + /* TDD.1.1 nRFreqInfo ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].tdd.nr_arfcn; // Integer + + /* TDD.1.2 F1AP_SUL_Information */ + if(0) { // Optional + F1AP_SUL_Information_t *tdd_sul_info = (F1AP_SUL_Information_t *)calloc(1, sizeof(F1AP_SUL_Information_t)); + tdd_sul_info->sUL_NRARFCN = 0; + tdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; + tdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; + tDD_Info->nRFreqInfo.sul_Information = tdd_sul_info; + } + + /* TDD.1.3 freqBandListNr */ + int tdd_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].tdd.num_frequency_bands; + printf("tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); + int j; + for (j=0; + j<tdd_num_available_freq_Bands; + j++) { + + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + /* TDD.1.3.1 freqBandIndicatorNr*/ + nr_freqBandNrItem.freqBandIndicatorNr = *f1ap_du_data->nr_mode_info[i].tdd.nr_band; // + + /* TDD.1.3.2 supportedSULBandList*/ + int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].tdd.num_sul_frequency_bands; + printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + int k; + for (k=0; + k<num_available_supported_SULBands; + k++) { + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + /* TDD.1.3.2.1 freqBandIndicatorNr */ + nr_supportedSULFreqBandItem.freqBandIndicatorNr = *f1ap_du_data->nr_mode_info[i].tdd.nr_sul_band; // + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + } // for TDD : supported_SULBands + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + } // for TDD : freq_Bands + + /* TDD.2 transmission_Bandwidth */ + tDD_Info->transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].tdd.scs; + tDD_Info->transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].tdd.nrb; nR_Mode_Info.choice.tDD = tDD_Info; - } + } // if nR_Mode_Info served_cell_information.nR_Mode_Info = nR_Mode_Info; -- GitLab From 911e738f0c4221706d6f6649cf3d5884d609f9f4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 14 Sep 2018 16:20:53 +0200 Subject: [PATCH 063/308] Improve interface of functions CU/DU interface management --- openair2/F1AP/f1ap_cu_interface_management.c | 72 +++++++++++++------- openair2/F1AP/f1ap_cu_interface_management.h | 65 +++++++++++------- openair2/F1AP/f1ap_du_interface_management.c | 69 ++++++++++++------- openair2/F1AP/f1ap_du_interface_management.h | 61 +++++++++++------ openair2/F1AP/f1ap_handlers.c | 3 +- 5 files changed, 177 insertions(+), 93 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index c3f1e5e34c..dbb1bc334e 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -33,23 +33,30 @@ #include "f1ap_common.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" -#include "f1ap_du_interface_management.h" +#include "f1ap_itti_messaging.h" +#include "f1ap_cu_interface_management.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; -void CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { +int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { +int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_RESET(instance_t instance, F1AP_Reset_t *Reset) { +int CU_handle_RESET(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { +int CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -57,11 +64,14 @@ void CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *Res /* Error Indication */ -void CU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication) { +int CU_handle_ERROR_INDICATION(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication) { +int CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -69,7 +79,7 @@ void CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *Error /* F1 Setup */ -void CU_handle_F1_SETUP_REQUEST(instance_t instance, +int CU_handle_F1_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) @@ -216,10 +226,12 @@ void CU_handle_F1_SETUP_REQUEST(instance_t instance, itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); } else { CU_send_F1_SETUP_FAILURE(instance); + return -1; } + return 0; } -void CU_send_F1_SETUP_RESPONSE(instance_t instance, +int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) { module_id_t enb_mod_idP; @@ -341,6 +353,7 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); + return -1; } // printf("\n"); @@ -352,9 +365,10 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, //printf("F1 setup response present = %d\n", out->value.present); //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); + return 0; } -void CU_send_F1_SETUP_FAILURE(instance_t instance) { +int CU_send_F1_SETUP_FAILURE(instance_t instance) { printf("CU_send_F1_SETUP_FAILURE\n"); module_id_t enb_mod_idP; @@ -431,9 +445,12 @@ void CU_send_F1_SETUP_FAILURE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); + return -1; } cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); + + return 0; } @@ -442,17 +459,19 @@ void CU_send_F1_SETUP_FAILURE(instance_t instance) { gNB-DU Configuration Update */ -void CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, - F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { +int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, +int CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, +int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -464,7 +483,7 @@ void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, */ //void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { -void CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP) { +int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP) { F1AP_F1AP_PDU_t pdu; F1AP_GNBCUConfigurationUpdate_t *out; F1AP_GNBCUConfigurationUpdateIEs_t *ie; @@ -830,28 +849,35 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return; + return -1; } cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); + return 0; } -void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { +int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { +int CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, - F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest) { +int CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(0, "Not implemented yet\n"); } -void CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, +int CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse) { AssertFatal(0, "Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h index 9902d1a58f..acad13836d 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.h +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -36,59 +36,76 @@ /* * Reset */ -void CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); -void CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); -void CU_handle_RESET(instance_t instance, F1AP_Reset_t *Reset); -void CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); +int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); +int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int CU_handle_RESET(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); /* * Error Indication */ -void CU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); -void CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); +int CU_handle_ERROR_INDICATION(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); /* * F1 Setup */ -void CU_handle_F1_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_F1_SETUP_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); -void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp); +int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp); -void CU_send_F1_SETUP_FAILURE(instance_t instance); +int CU_send_F1_SETUP_FAILURE(instance_t instance); /* * gNB-DU Configuration Update */ -void CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, - F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate); +int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); -void CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, +int CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure); -void CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, +int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge); /* * gNB-CU Configuration Update */ -void CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP); +int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP); -void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure); +int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); -void CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge); +int CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-DU Resource Coordination */ -void CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, - F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest); +int CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); -void CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, +int CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse); #endif /* F1AP_CU_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 454032a8ff..a5086c9aac 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -33,24 +33,31 @@ #include "f1ap_common.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" +#include "f1ap_itti_messaging.h" #include "f1ap_du_interface_management.h" extern f1ap_setup_req_t *f1ap_du_data; -void DU_handle_RESET(instance_t instance, F1AP_Reset_t *Reset) { +int DU_handle_RESET(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { +int DU_send_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { +int DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge) { +int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -59,11 +66,14 @@ void DU_handle_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *R Error Indication */ -void DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { +int DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication) { +int DU_handle_ERROR_INDICATION(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -73,7 +83,7 @@ void DU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *Err */ // SETUP REQUEST -void DU_send_F1_SETUP_REQUEST(instance_t instance) { +int DU_send_F1_SETUP_REQUEST(instance_t instance) { module_id_t enb_mod_idP; module_id_t du_mod_idP; @@ -381,16 +391,18 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); + return -1; } du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); + + return 0; } int DU_handle_F1_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, uint32_t stream, - F1AP_F1AP_PDU_t *pdu) -{ + F1AP_F1AP_PDU_t *pdu) { printf("DU_handle_F1_SETUP_RESPONSE\n"); return 0; } @@ -399,8 +411,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, int DU_handle_F1_SETUP_FAILURE(instance_t instance, uint32_t assoc_id, uint32_t stream, - F1AP_F1AP_PDU_t *pdu) -{ + F1AP_F1AP_PDU_t *pdu) { LOG_E(DU_F1AP, "DU_handle_F1_SETUP_FAILURE\n"); return 0; } @@ -411,7 +422,7 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, */ //void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { -void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, +int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, instance_t du_mod_idP, f1ap_setup_req_t *f1ap_du_data) { F1AP_F1AP_PDU_t pdu; @@ -840,6 +851,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); + return -1; } printf("\n"); @@ -849,44 +861,55 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* decode */ if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { printf("Failed to decode F1 setup request\n"); + return -1; } + + return 0; } -void DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, - F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure) { +int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - F1AP_GNBDUConfigurationUpdateAcknowledge_t GNBDUConfigurationUpdateAcknowledge) { +int DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, - F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { +int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, +int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, +int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, +int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest) { AssertFatal(0, "Not implemented yet\n"); } -void DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse) { +int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(0, "Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index 1c23ad987f..941b86a6d4 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -36,22 +36,31 @@ /* * Reset */ -void DU_handle_RESET(instance_t instance, F1AP_Reset_t *Reset); -void DU_send_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); -void DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); -void DU_handle_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); +int DU_handle_RESET(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int DU_send_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); +int DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); +int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * Error Indication */ -void DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p); -void DU_handle_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); +int DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p); +int DU_handle_ERROR_INDICATION(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * F1 Setup */ -void DU_send_F1_SETUP_REQUEST(instance_t instance); +int DU_send_F1_SETUP_REQUEST(instance_t instance); int DU_handle_F1_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, @@ -59,43 +68,51 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, F1AP_F1AP_PDU_t *pdu); int DU_handle_F1_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-DU Configuration Update */ -void DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, +int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, instance_t du_mod_idP, f1ap_setup_req_t *f1ap_du_data); -void DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, - F1AP_GNBDUConfigurationUpdateFailure_t GNBDUConfigurationUpdateFailure); +int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); -void DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - F1AP_GNBDUConfigurationUpdateAcknowledge_t GNBDUConfigurationUpdateAcknowledge); +int DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-CU Configuration Update */ -void DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, - F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate); +int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); -void DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, +int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure); -void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, +int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge); /* * gNB-DU Resource Coordination */ -void DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, +int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest); -void DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse); +int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_DU_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 068fdf5849..c2d647e9b8 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -32,6 +32,7 @@ #include "f1ap_common.h" #include "f1ap_handlers.h" +#include "f1ap_decoder.h" #include "f1ap_cu_interface_management.h" #include "f1ap_du_interface_management.h" #include "f1ap_cu_rrc_message_transfer.h" @@ -119,4 +120,4 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return ret; -} \ No newline at end of file +} -- GitLab From f4633ba26059e90e98426715176cdee219e65968 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 14 Sep 2018 17:15:55 +0200 Subject: [PATCH 064/308] Correctly add headers for RRC message transfer, remove warnings --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 24 +++++++++++++------- openair2/F1AP/f1ap_cu_rrc_message_transfer.h | 17 ++++++++++---- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 15 +++++++++--- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 17 +++++++++++++- 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index fb59a57901..52a6a63320 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -31,6 +31,9 @@ */ #include "f1ap_common.h" +#include "f1ap_encoder.h" +#include "f1ap_decoder.h" +#include "f1ap_itti_messaging.h" #include "f1ap_cu_rrc_message_transfer.h" // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which @@ -42,7 +45,8 @@ Initial UL RRC Message Transfer */ -int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id, +int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { @@ -54,13 +58,10 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id, F1AP_InitialULRRCMessageTransfer_t *container; F1AP_InitialULRRCMessageTransferIEs_t *ie; - SRB_INFO* Srb_info; - protocol_ctxt_t ctxt; rnti_t rnti; uint8_t *ccch_sdu; sdu_size_t ccch_sdu_len; int CC_id =0; - int instance=0; uint64_t du_ue_f1ap_id; DevAssert(pdu != NULL); @@ -82,7 +83,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id, /* NRCGI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_NRCGI, true); - instance = 0; ///ie->value.choice. ?? //@Todo /* RNTI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, @@ -140,6 +140,8 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id, */ // if size > 0 // CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size) + + return 0; } @@ -148,7 +150,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id, */ //void CU_send_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { -void CU_send_DL_RRC_MESSAGE_TRANSFER(void) { +int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) { F1AP_F1AP_PDU_t pdu; F1AP_DLRRCMessageTransfer_t *out; F1AP_DLRRCMessageTransferIEs_t *ie; @@ -244,6 +246,7 @@ void CU_send_DL_RRC_MESSAGE_TRANSFER(void) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); + return -1; } printf("\n"); @@ -251,14 +254,19 @@ void CU_send_DL_RRC_MESSAGE_TRANSFER(void) { /* decode */ if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { printf("Failed to decode F1 setup request\n"); + return -1; } - //AssertFatal(1==0,"Not implemented yet\n"); + + return 0; } /* UL RRC Message Transfer */ -void CU_handle_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { +int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h index 77fd25da29..952297b0dd 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h @@ -33,7 +33,16 @@ #ifndef F1AP_CU_RRC_MESSAGE_TRANSFER_H_ #define F1AP_CU_RRC_MESSAGE_TRANSFER_H_ -int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); -#endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */ \ No newline at end of file +int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance); + +int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +#endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index ffa698e646..fef7fac097 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -33,6 +33,7 @@ #include "f1ap_common.h" #include "f1ap_encoder.h" #include "f1ap_decoder.h" +#include "f1ap_itti_messaging.h" #include "f1ap_du_rrc_message_transfer.h" // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which @@ -43,12 +44,15 @@ extern f1ap_setup_req_t *f1ap_du_data; /* DL RRC Message Transfer */ -void DU_handle_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { +int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } //void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -void DU_send_UL_RRC_MESSAGE_TRANSFER(void) { +int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; F1AP_ULRRCMessageTransferIEs_t *ie; @@ -107,6 +111,7 @@ void DU_send_UL_RRC_MESSAGE_TRANSFER(void) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); + return -1; } printf("\n"); @@ -117,10 +122,12 @@ void DU_send_UL_RRC_MESSAGE_TRANSFER(void) { // printf("Failed to decode F1 setup request\n"); // } //AssertFatal(1==0,"Not implemented yet\n"); + + return 0; } /* UL RRC Message Transfer */ -void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( +int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( module_id_t module_idP, int CC_idP, int UE_id, @@ -204,11 +211,13 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); + return -1; } printf("\n"); du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); + return 0; /* decode */ // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { // printf("Failed to decode F1 setup request\n"); diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 24a48fdcdd..a841d7a7ba 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -34,4 +34,19 @@ #ifndef F1AP_DU_RRC_MESSAGE_TRANSFER_H_ #define F1AP_DU_RRC_MESSAGE_TRANSFER_H_ -#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ \ No newline at end of file +int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +int DU_send_UL_RRC_MESSAGE_TRANSFER(void); + +int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( + module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP, + uint8_t *sduP, + sdu_size_t sdu_lenP); + +#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ -- GitLab From eedfa4933d7705a3d1d3d5cb7aec0f0cda3dcd9b Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 14 Sep 2018 18:23:31 +0200 Subject: [PATCH 065/308] Correct header files for CU/DU UE context management --- openair2/F1AP/f1ap_cu_ue_context_management.c | 75 +++++++++++------- openair2/F1AP/f1ap_cu_ue_context_management.h | 76 ++++++++++++++++++- openair2/F1AP/f1ap_du_ue_context_management.c | 60 ++++++++------- openair2/F1AP/f1ap_du_ue_context_management.h | 57 +++++++++++++- 4 files changed, 209 insertions(+), 59 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 5be5e25ec0..3c11d09b1e 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -/*! \file f1ap_du_interface_management.h - * \brief f1ap interface management for DU +/*! \file f1ap_cu_ue_context_management.c + * \brief F1AP UE Context Management, CU side * \author EURECOM/NTUST * \date 2018 * \version 0.1 @@ -30,14 +30,14 @@ * \warning */ -/* - UE Context Setup -*/ - #include "f1ap_common.h" +#include "f1ap_encoder.h" +#include "f1ap_decoder.h" +#include "f1ap_itti_messaging.h" +#include "f1ap_cu_ue_context_management.h" //void CU_send_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { -void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { +int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextSetupRequest_t *out; F1AP_UEContextSetupRequestIEs_t *ie; @@ -357,7 +357,7 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return; + return -1; } printf("\n"); @@ -365,44 +365,51 @@ void CU_send_UE_CONTEXT_SETUP_REQUEST(void) { /* decode */ if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { printf("Failed to decode F1 setup request\n"); + return -1; } //AssertFatal(1==0,"Not implemented yet\n"); + return 0; } -void CU_handle_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { +int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { +int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -/* - UE Context Release (gNB-CU initiated) -*/ - -void CU_handle_UE_CONTEXT_RELEASE_REQUEST(F1AP_UEContextReleaseRequest_t *UEContextReleaseRequest) { +int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_UE_CONTEXT_RELEASE_COMMAND(F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { +int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, + F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UEContextReleaseComplete) { +int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -/* - UE Context Modification Required (gNB-DU initiated) -*/ - //void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { -void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { +int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextModificationRequest_t *out; F1AP_UEContextModificationRequestIEs_t *ie; @@ -863,7 +870,7 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return; + return -1; } printf("\n"); @@ -871,22 +878,34 @@ void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(void) { /* decode */ if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { printf("Failed to decode F1 setup request\n"); + return -1; } + return 0; } -void CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { +int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(F1AP_UEContextModificationFailure_t EContextModificationFailure) { +int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(F1AP_UEContextModificationRequired_t *UEContextModificationRequired) { +int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { +int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, + F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { AssertFatal(1==0,"Not implemented yet\n"); -} \ No newline at end of file +} diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h index b6bbedba2f..f103a17073 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.h +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -/*! \file f1ap_du_interface_management.h - * \brief f1ap interface management for DU +/*! \file f1ap_cu_ue_context_management.h + * \brief header file of CU UE Context management * \author EURECOM/NTUST * \date 2018 * \version 0.1 @@ -28,4 +28,74 @@ * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr * \note * \warning - */ \ No newline at end of file + */ + +#ifndef F1AP_CU_UE_CONTEXT_MANAGEMENT_H_ +#define F1AP_CU_UE_CONTEXT_MANAGEMENT_H_ + +/* + * UE Context Setup + */ +int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance); + +int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + + +/* + * UE Context Release Request (gNB-DU initiated) + */ +int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +/* + * UE Context Release (gNB-CU initiated) + */ +int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, + F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand); +int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +/* + * UE Context Modification (gNB-CU initiated) + */ +int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance); +int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +/* + * UE Context Modification Required (gNB-DU initiated) + */ +int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, + F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t); + +/* + * UE Inactivity Notification + */ + +/* + * Notify + */ + +#endif /* F1AP_CU_UE_CONTEXT_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 57dfa4703b..c81c47723c 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -/*! \file f1ap_du_interface_management.h - * \brief f1ap interface management for DU +/*! \file f1ap_du_ue_context_management.c + * \brief F1AP UE Context Management, DU side * \author EURECOM/NTUST * \date 2018 * \version 0.1 @@ -31,20 +31,22 @@ */ #include "f1ap_common.h" +#include "f1ap_encoder.h" +#include "f1ap_decoder.h" +#include "f1ap_itti_messaging.h" #include "f1ap_du_ue_context_management.h" extern f1ap_setup_req_t *f1ap_du_data; -/* - UE Context Setup -*/ - -void DU_handle_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { +int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } //void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { -void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextSetupResponse_t *out; F1AP_UEContextSetupResponseIEs_t *ie; @@ -297,7 +299,7 @@ void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return; + return -1; } printf("\n"); @@ -307,41 +309,41 @@ void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) { // printf("Failed to decode F1 setup request\n"); // } //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); + return 0; } -void DU_send_UE_CONTEXT_SETUP_FAILURE(F1AP_UEContextSetupFailure_t UEContextSetupFailure) { +int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance) { AssertFatal(1==0,"Not implemented yet\n"); } -/* - UE Context Release Request (gNB-DU initiated). -*/ -void DU_send_UE_CONTEXT_RELEASE_REQUEST(F1AP_UEContextReleaseRequest_t *UEContextReleaseRequest) { +int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_UE_CONTEXT_RELEASE_COMMAND(F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { +int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_UE_CONTEXT_RELEASE_COMPLETE(F1AP_UEContextReleaseComplete_t *UEContextReleaseComplete) { +int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance) { AssertFatal(1==0,"Not implemented yet\n"); } -/* - UE Context Modification (gNB-CU initiated) -*/ - -void DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { +int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } //void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { -void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { +int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextModificationResponse_t *out; F1AP_UEContextModificationResponseIEs_t *ie; @@ -687,7 +689,7 @@ void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); - return; + return -1; } printf("\n"); @@ -697,17 +699,21 @@ void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) { // printf("Failed to decode F1 setup request\n"); // } //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); + return 0; } -void DU_send_UE_CONTEXT_MODIFICATION_FAILURE(F1AP_UEContextModificationFailure_t UEContextModificationFailure) { +int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(F1AP_UEContextModificationRequired_t *UEContextModificationRequired) { +int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance) { AssertFatal(1==0,"Not implemented yet\n"); } -void DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { +int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); -} \ No newline at end of file +} diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index 4771c1a66d..15e987209b 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -33,4 +33,59 @@ #ifndef F1AP_DU_UE_CONTEXT_MANAGEMENT_H_ #define F1AP_DU_UE_CONTEXT_MANAGEMENT_H_ -#endif /* F1AP_DU_UE_CONTEXT_MANAGEMENT_H_ */ \ No newline at end of file +/* + * UE Context Setup + */ +int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance); +int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance); + + +/* + * UE Context Release Request (gNB-DU initiated) + */ +int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance); + + +/* + * UE Context Release (gNB-CU initiated) + */ +int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance); + + +/* + * UE Context Modification (gNB-CU initiated) + */ +int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); +int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance); +int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance); + + +/* + * UE Context Modification Required (gNB-DU initiated) + */ +int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance); +int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); + +/* + * UE Inactivity Notification + */ + +/* + * Notify + */ + +#endif /* F1AP_DU_UE_CONTEXT_MANAGEMENT_H_ */ -- GitLab From 91d4cd3cfda468a58974ee415573a5cbea3f3d9c Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 14 Sep 2018 18:58:46 +0200 Subject: [PATCH 066/308] debugging of F1AP-Setup-Resp procedure in DU. DU configuration is ok now. --- openair2/ENB_APP/enb_config.c | 179 ++++++++++--------- openair2/F1AP/f1ap_cu_interface_management.c | 4 +- openair2/F1AP/f1ap_decoder.c | 1 + openair2/F1AP/f1ap_du_interface_management.c | 100 ++++++++++- 4 files changed, 192 insertions(+), 92 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index b6e16f35ae..e4355e8e29 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -800,10 +800,10 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { rrc->sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr); // MCC and MNC - rrc->mcc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); - rrc->mnc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); - rrc->mnc_digit_length= strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); - rrc->tac= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); + rrc->mcc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); + rrc->mnc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); + rrc->mnc_digit_length= strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + rrc->tac= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); } @@ -2891,6 +2891,7 @@ void extract_and_decode_SI(int inst,int si_ind,uint8_t *si_container,int si_cont AssertFatal(si_ind==0,"Can only handle a single SI block for now\n"); + LOG_I(ENB_APP, "rrc inst %d: Trying to decode SI block %d @ %p, length %d\n",inst,si_ind,si_container,si_container_length); // point to first SI block bcch_message = &carrier->systemInformation; asn_dec_rval_t dec_rval = uper_decode_complete( NULL, @@ -2903,101 +2904,101 @@ void extract_and_decode_SI(int inst,int si_ind,uint8_t *si_container,int si_cont AssertFatal(1==0, "[ENB_APP][RRC inst %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", inst, dec_rval.consumed ); - - if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) { - switch (bcch_message->message.choice.c1.present) { - case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: - AssertFatal(1==0,"Should have received SIB1 from CU\n"); - break; - case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - { - SystemInformation_t *si = &bcch_message->message.choice.c1.choice.systemInformation; + } + if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) { + switch (bcch_message->message.choice.c1.present) { + case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: + AssertFatal(1==0,"Should have received SIB1 from CU\n"); + break; + case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + { + SystemInformation_t *si = &bcch_message->message.choice.c1.choice.systemInformation; + + for (int i=0; i<si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { + struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; + typeandinfo = si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; - for (int i=0; i<si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { - struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; - typeandinfo = si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; + switch(typeandinfo->present) { + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: + carrier->sib2 = &typeandinfo->choice.sib2; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: + carrier->sib3 = &typeandinfo->choice.sib3; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB3 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: + //carrier->sib4 = &typeandinfo->choice.sib4; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB4 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: + //carrier->sib5 = &typeandinfo->choice.sib5; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB5 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: + //carrier->sib6 = &typeandinfo->choice.sib6; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB6 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: + //carrier->sib7 = &typeandinfo->choice.sib7; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB7 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: + //carrier->sib8 = &typeandinfo->choice.sib8; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB8 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: + //carrier->sib9 = &typeandinfo->choice.sib9; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB9 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: + //carrier->sib10 = &typeandinfo->choice.sib10; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB10 in CU F1AP_SETUP_RESP message\n", inst); + break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: + //carrier->sib11 = &typeandinfo->choice.sib11; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB11 in CU F1AP_SETUP_RESP message\n", inst); + break; - switch(typeandinfo->present) { - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: - carrier->sib2 = &typeandinfo->choice.sib2; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: - carrier->sib3 = &typeandinfo->choice.sib3; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB3 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: - //carrier->sib4 = &typeandinfo->choice.sib4; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB4 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: - //carrier->sib5 = &typeandinfo->choice.sib5; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB5 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: - //carrier->sib6 = &typeandinfo->choice.sib6; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB6 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: - //carrier->sib7 = &typeandinfo->choice.sib7; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB7 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: - //carrier->sib8 = &typeandinfo->choice.sib8; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB8 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: - //carrier->sib9 = &typeandinfo->choice.sib9; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB9 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: - //carrier->sib10 = &typeandinfo->choice.sib10; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB10 in CU F1AP_SETUP_RESP message\n", inst); - break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: - //carrier->sib11 = &typeandinfo->choice.sib11; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB11 in CU F1AP_SETUP_RESP message\n", inst); - break; - #if (RRC_VERSION >= MAKE_VERSION(9, 2, 0)) - - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: - //carrier->sib12 = &typeandinfo->choice.sib12; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB12 in CU F1AP_SETUP_RESP message\n", inst); - break; - - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: - carrier->sib13 = &typeandinfo->choice.sib13_v920; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB13 in CU F1AP_SETUP_RESP message\n", inst); - break; + + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: + //carrier->sib12 = &typeandinfo->choice.sib12; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB12 in CU F1AP_SETUP_RESP message\n", inst); + break; + + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: + carrier->sib13 = &typeandinfo->choice.sib13_v920; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB13 in CU F1AP_SETUP_RESP message\n", inst); + break; #endif #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - //SIB18 - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250: - carrier->sib18 = &typeandinfo->choice.sib18_v1250; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB18 in CU F1AP_SETUP_RESP message\n", inst); - break; - //SIB19 - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250: - carrier->sib19 = &typeandinfo->choice.sib19_v1250; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB19 in CU F1AP_SETUP_RESP message\n", inst); - break; - //SIB21 - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430: - carrier->sib21 = &typeandinfo->choice.sib21_v1430; - LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB21 in CU F1AP_SETUP_RESP message\n", inst); - break; + //SIB18 + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250: + carrier->sib18 = &typeandinfo->choice.sib18_v1250; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB18 in CU F1AP_SETUP_RESP message\n", inst); + break; + //SIB19 + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250: + carrier->sib19 = &typeandinfo->choice.sib19_v1250; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB19 in CU F1AP_SETUP_RESP message\n", inst); + break; + //SIB21 + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430: + carrier->sib21 = &typeandinfo->choice.sib21_v1430; + LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB21 in CU F1AP_SETUP_RESP message\n", inst); + break; #endif - default: - AssertFatal(1==0,"Shouldn't have received this SI %d\n",typeandinfo->present); - break; - } + default: + AssertFatal(1==0,"Shouldn't have received this SI %d\n",typeandinfo->present); + break; } - break; } + break; } } - } + } + else AssertFatal(1==0,"No SI messages\n"); diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index e28a1ac811..ca1f590573 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -297,7 +297,7 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setu /* - nRPCI */ if (1) { cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007 + *cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->nrpci[i]; // int 0..1007 } /* optional */ @@ -764,4 +764,4 @@ void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdate void CU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); -} \ No newline at end of file +} diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 53d68c09ca..6a6a761866 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -77,6 +77,7 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) switch(pdu->choice.successfulOutcome->procedureCode) { case F1AP_ProcedureCode_id_F1Setup: LOG_I(F1AP, "get F1AP_ProcedureCode_id_F1Setup\n"); + break; default: diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 2efd22fb23..c83095447f 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -32,6 +32,7 @@ #include "f1ap_common.h" #include "f1ap_du_interface_management.h" +#include "assertions.h" extern f1ap_setup_req_t *f1ap_du_data; @@ -309,8 +310,105 @@ int DU_handle_F1_SETUP_RESPONSE(uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { + printf("DU_handle_F1_SETUP_RESPONSE\n"); + AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome, + "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); + AssertFatal(pdu->choice.successfulOutcome->procedureCode == F1AP_ProcedureCode_id_F1Setup, + "pdu->choice.successfulOutcome->procedureCode != F1AP_ProcedureCode_id_F1Setup\n"); + AssertFatal(pdu->choice.successfulOutcome->criticality == F1AP_Criticality_reject, + "pdu->choice.successfulOutcome->criticality != F1AP_Criticality_reject\n"); + AssertFatal(pdu->choice.successfulOutcome->value.present == F1AP_SuccessfulOutcome__value_PR_F1SetupResponse, + "pdu->choice.successfulOutcome->value.present != F1AP_SuccessfulOutcome__value_PR_F1SetupResponse\n"); + + F1AP_F1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.F1SetupResponse; + + + F1AP_F1SetupResponseIEs_t *ie; + int TransactionId = -1; + int num_cells_to_activate = 0; + F1AP_Cells_to_be_Activated_List_Item_t *cell; + + MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_RESP); + + printf("F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", + in->protocolIEs.list.count); + for (int i=0;i < in->protocolIEs.list.count; i++) { + ie = in->protocolIEs.list.array[i]; + switch (ie->id) { + case F1AP_ProtocolIE_ID_id_TransactionID: + AssertFatal(ie->criticality == F1AP_Criticality_reject, + "ie->criticality != F1AP_Criticality_reject\n"); + AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID, + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); + TransactionId=ie->value.choice.TransactionID; + printf("F1AP: F1Setup-Resp: TransactionId %d\n", + TransactionId); + break; + case F1AP_ProtocolIE_ID_id_gNB_CU_Name: + AssertFatal(ie->criticality == F1AP_Criticality_ignore, + "ie->criticality != F1AP_Criticality_ignore\n"); + AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name, + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); + F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); + memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size); + F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0'; + printf("F1AP: F1Setup-Resp: gNB_CU_name %s\n", + F1AP_SETUP_RESP (msg_p).gNB_CU_name); + break; + case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: + AssertFatal(ie->criticality == F1AP_Criticality_reject, + "ie->criticality != F1AP_Criticality_reject\n"); + AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List, + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n"); + num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; + printf("F1AP: Activating %d cells\n",num_cells_to_activate); + for (int i=0;i<num_cells_to_activate;i++) { + + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = ie->value.choice.Cells_to_be_Activated_List.list.array[i]; + + AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item, + "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); + AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject, + "cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject"); + AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item, + "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); + + cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; + + TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], F1AP_SETUP_RESP (msg_p).mnc_digit_length[i]); + AssertFatal(cell->nRPCI != NULL, "nRPCI is null\n"); + + F1AP_SETUP_RESP (msg_p).nrpci[i] = *cell->nRPCI; + + F1AP_ProtocolExtensionContainer_160P9_t *ext = cell->iE_Extensions; + AssertFatal(ext!=NULL,"Extension for SI is null\n"); + F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; + AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); + printf("F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRPCI %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nrpci[i],F1AP_SETUP_RESP (msg_p).num_SI[i]); + for (int si =0;si < ext->list.count;si++) { + size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; + F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; + printf("F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size); + F1AP_SETUP_RESP (msg_p).SI_container[i][si] = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.buf; + } + } + break; + } + } + AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); + AssertFatal(num_cells_to_activate>0,"No cells activated\n"); + F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate; + + for (int i=0;i<num_cells_to_activate;i++) + AssertFatal(F1AP_SETUP_RESP (msg_p).num_SI[i] > 0, "System Information %d is missing",i); + + + printf("Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + return 0; } @@ -789,4 +887,4 @@ void DU_send_gNB_CU_CONFIGURATION_UPDATE_FALIURE(F1AP_GNBCUConfigurationUpdateFa void DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); -} \ No newline at end of file +} -- GitLab From d670138b69be9f00eeb6aa740decc39b8bd794ec Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sat, 15 Sep 2018 12:57:17 +0200 Subject: [PATCH 067/308] fixes for SIB2/3 handling in DU --- openair2/ENB_APP/enb_config.c | 24 ++-- openair2/F1AP/f1ap_cu_interface_management.c | 3 + openair2/F1AP/f1ap_du_interface_management.c | 6 +- openair2/LAYER2/MAC/config.c | 118 +++++++++--------- openair2/RRC/LTE/rrc_eNB.c | 8 +- .../CONF/du.lte.band7.10MHz.if4p5.conf | 6 +- .../GENERIC-LTE-EPC/CONF/rru.oaisim.conf | 4 +- 7 files changed, 94 insertions(+), 75 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 43a1c49a60..be9d8766cb 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2923,8 +2923,10 @@ void extract_and_decode_SI(int inst,int si_ind,uint8_t *si_container,int si_cont case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: { SystemInformation_t *si = &bcch_message->message.choice.c1.choice.systemInformation; - + + for (int i=0; i<si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { + LOG_I(ENB_APP,"Extracting SI %d/%d\n",i,si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count); struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; typeandinfo = si->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; @@ -3019,6 +3021,8 @@ void configure_du_mac(int inst) { eNB_RRC_INST *rrc = RC.rrc[inst]; rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0]; + LOG_I(ENB_APP,"Configuring MAC/L1 %d, carrier->sib2 %p\n",inst,&carrier->sib2->radioResourceConfigCommon); + rrc_mac_config_req_eNB(inst, 0, carrier->physCellId, carrier->p_eNB, @@ -3030,9 +3034,8 @@ void configure_du_mac(int inst) { #endif 0, // rnti (BCCH_BCH_Message_t *) - NULL, - (RadioResourceConfigCommonSIB_t *) & - carrier->sib2->radioResourceConfigCommon, + &carrier->mib, + (RadioResourceConfigCommonSIB_t *) &carrier->sib2->radioResourceConfigCommon, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) (RadioResourceConfigCommonSIB_t *) NULL, @@ -3079,10 +3082,15 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { if (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && resp->nrpci[j] == carrier->physCellId) { // copy system information and decode it - for (si_ind=0;si_ind<resp->num_SI[j];si_ind++) extract_and_decode_SI(i, - si_ind, - resp->SI_container[j][si_ind], - resp->SI_container_length[j][si_ind]); + for (si_ind=0;si_ind<resp->num_SI[j];si_ind++) { + printf("SI %d: ",si_ind); + for (int n=0;n<resp->SI_container_length[j][si_ind];n++) printf("%2x ",resp->SI_container[j][si_ind][n]); + printf("\n"); + extract_and_decode_SI(i, + si_ind, + resp->SI_container[j][si_ind], + resp->SI_container_length[j][si_ind]); + } // perform MAC/L1 common configuration configure_du_mac(i); } diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 67d1dbfa79..650bbb1729 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -328,6 +328,9 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); + printf("SI %d: "); + for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) printf("%2x ",f1ap_setup_resp->SI_container[i][0][n]); + printf("\n"); OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index e6aef6166c..be36af0a1b 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -486,7 +486,11 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; printf("F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size); - F1AP_SETUP_RESP (msg_p).SI_container[i][si] = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.buf; + F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); + + memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si], + (void*)ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.buf, + F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); } } break; diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 8fd85e7811..ea88eae858 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -780,68 +780,66 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP, RC.mac[Mod_idP]->common_channels[CC_idP].sib1_v13ext = sib1_v13ext; } #endif - if (radioResourceConfigCommon != NULL) { - LOG_I(MAC, "[CONFIG]SIB2/3 Contents (partial)\n"); - LOG_I(MAC, "[CONFIG]pusch_config_common.n_SB = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.pusch_ConfigBasic.n_SB); - LOG_I(MAC, "[CONFIG]pusch_config_common.hoppingMode = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode); - LOG_I(MAC, - "[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset); - LOG_I(MAC, "[CONFIG]pusch_config_common.enable64QAM = %d\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM); - LOG_I(MAC, - "[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. - groupHoppingEnabled); - LOG_I(MAC, - "[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. - groupAssignmentPUSCH); - LOG_I(MAC, - "[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. - sequenceHoppingEnabled); - LOG_I(MAC, "[CONFIG]pusch_config_common.cyclicShift = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift); - - AssertFatal(radioResourceConfigCommon-> - rach_ConfigCommon.maxHARQ_Msg3Tx > 0, - "radioResourceconfigCommon %d == 0\n", - (int) radioResourceConfigCommon-> - rach_ConfigCommon.maxHARQ_Msg3Tx); - - RC.mac[Mod_idP]->common_channels[CC_idP]. - radioResourceConfigCommon = radioResourceConfigCommon; - if (ul_CarrierFreq > 0) - RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq = - ul_CarrierFreq; - if (ul_Bandwidth) - RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = - *ul_Bandwidth; - else - RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = - RC.mac[Mod_idP]->common_channels[CC_idP].mib->message. - dl_Bandwidth; - - config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon, + AssertFatal(radioResourceConfigCommon != NULL, "radioResourceConfigCommon is null\n"); + LOG_I(MAC, "[CONFIG]SIB2/3 Contents (partial)\n"); + LOG_I(MAC, "[CONFIG]pusch_config_common.n_SB = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.pusch_ConfigBasic.n_SB); + LOG_I(MAC, "[CONFIG]pusch_config_common.hoppingMode = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode); + LOG_I(MAC, + "[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset); + LOG_I(MAC, "[CONFIG]pusch_config_common.enable64QAM = %d\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM); + LOG_I(MAC, + "[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. + groupHoppingEnabled); + LOG_I(MAC, + "[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. + groupAssignmentPUSCH); + LOG_I(MAC, + "[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. + sequenceHoppingEnabled); + LOG_I(MAC, "[CONFIG]pusch_config_common.cyclicShift = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift); + + AssertFatal(radioResourceConfigCommon-> + rach_ConfigCommon.maxHARQ_Msg3Tx > 0, + "radioResourceconfigCommon %d == 0\n", + (int) radioResourceConfigCommon-> + rach_ConfigCommon.maxHARQ_Msg3Tx); + + RC.mac[Mod_idP]->common_channels[CC_idP]. + radioResourceConfigCommon = radioResourceConfigCommon; + if (ul_CarrierFreq > 0) + RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq = + ul_CarrierFreq; + if (ul_Bandwidth) + RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = + *ul_Bandwidth; + else + RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = + RC.mac[Mod_idP]->common_channels[CC_idP].mib->message. + dl_Bandwidth; + + config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - radioResourceConfigCommon_BR, + radioResourceConfigCommon_BR, #endif - NULL, ul_Bandwidth, additionalSpectrumEmission, - mbsfn_SubframeConfigList); - - - } + NULL, ul_Bandwidth, additionalSpectrumEmission, + mbsfn_SubframeConfigList); + } // mib != NULL // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 1427ec5091..f8775acb75 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -390,6 +390,7 @@ init_SI( #endif } + /* if (rrc->node_type == ngran_eNB_DU) { LOG_D(RRC, "About to call rrc_mac_config_req_eNB for ngran_eNB_DU\n"); @@ -437,7 +438,9 @@ init_SI( #endif ); } - else if (rrc->node_type == ngran_eNB) { + else + */ + if (rrc->node_type == ngran_eNB) { LOG_D(RRC, "About to call rrc_mac_config_req_eNB for ngran_eNB\n"); rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, @@ -7357,6 +7360,9 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { if (rrc->carrier[0].SIB23) { F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23; F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23; + printf("SI %d: ",0); + for (int n=0;n<F1AP_SETUP_RESP (msg_p).SI_container_length[j][num_SI];n++) printf("%2x ",F1AP_SETUP_RESP (msg_p).SI_container[0][num_SI][n]); + printf("\n"); num_SI++; } F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf index bdf89ac364..360f55d73a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf @@ -77,9 +77,9 @@ L1s = ( RUs = ( { - local_if_name = "eth1"; - remote_address = "10.10.10.19"; - local_address = "10.10.10.18"; + local_if_name = "lo"; + remote_address = "127.0.0.2"; + local_address = "127.0.0.1"; local_portc = 50000; remote_portc = 50000; local_portd = 50001; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf index 41b322fb55..405e2490ee 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf @@ -22,9 +22,9 @@ log_config = { global_log_verbosity ="medium"; hw_log_level ="info"; hw_log_verbosity ="medium"; - phy_log_level ="debug"; + phy_log_level ="info`"; phy_log_verbosity ="medium"; - mac_log_level ="debug"; + mac_log_level ="info"; mac_log_verbosity ="high"; rlc_log_level ="info"; rlc_log_verbosity ="medium"; -- GitLab From fc6afc811624a0fad3dd9f637f7cfaf37b6735fd Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sat, 15 Sep 2018 13:59:11 +0200 Subject: [PATCH 068/308] simulation up to CCCH reception in DU is functional --- cmake_targets/CMakeLists.txt | 2 +- openair2/ENB_APP/enb_config.c | 3 +++ openair2/RRC/LTE/L2_interface.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 1ac20c3363..f5c5425737 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2178,7 +2178,7 @@ add_executable(lte-uesoftmodem-nos1 target_link_libraries (lte-uesoftmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${RAL_LIB} ${ITTI_LIB} + RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB F1AP_LIB F1AP GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl ) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index be9d8766cb..f9ae28259a 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2933,6 +2933,9 @@ void extract_and_decode_SI(int inst,int si_ind,uint8_t *si_container,int si_cont switch(typeandinfo->present) { case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: carrier->sib2 = &typeandinfo->choice.sib2; + carrier->SIB23 = (uint8_t*)malloc(64); + memcpy((void*)carrier->SIB23,(void*)si_container,si_container_length); + carrier->sizeof_SIB23 = si_container_length; LOG_I( ENB_APP, "[RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 02335aa99a..9ce6a5d52f 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -105,6 +105,9 @@ mac_rrc_data_req( return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); } // All RFN mod 8 transmit SIB2-3 in SF 5 else if ((frameP%8) == 1) { + LOG_I(RRC,"Copying SIB23 @ %p to mac %d bytes\n", + RC.rrc[Mod_idP]->carrier[CC_id].SIB23, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); memcpy(&buffer_pP[0], RC.rrc[Mod_idP]->carrier[CC_id].SIB23, RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); -- GitLab From 6f11dc7741802d6d54b00979d7655f664dde7e4e Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sat, 15 Sep 2018 16:10:58 +0200 Subject: [PATCH 069/308] removed assertion in MAC layer and adjusted generation of MSG4 to handle when CCCH message is not present. UL CCCH is now received in CU, but asserts. Need to add code in DU to handle scheduling of DL-CCCH in later subframe. In current state, DL-CCCH will only come out if it is ready for MSG$ transmission. --- openair2/F1AP/f1ap_itti_messaging.c | 1 + openair2/LAYER2/MAC/eNB_scheduler_RA.c | 78 ++++++++++++++------------ openair3/SCTP/sctp_eNB_task.c | 1 + 3 files changed, 44 insertions(+), 36 deletions(-) diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index c7ec5065f3..1f0f84017e 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -55,6 +55,7 @@ void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint sctp_data_req->buffer_length = buffer_length; sctp_data_req->stream = stream; + printf("Sending ITTI message to SCTP Task\n"); itti_send_msg_to_task(TASK_SCTP, instance, message_p); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index b637a92a96..3dbce03d04 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -1009,50 +1009,54 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, #endif { // This is normal LTE case - LOG_D(MAC, "generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP); + LOG_I(MAC, "generate_Msg4 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP); if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) { // Get RRCConnectionSetup for Piggyback /*rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block &cc[CC_idP].CCCH_pdu.payload[0], ENB_FLAG_YES, module_idP, 0); // not used in this case*/ - rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block - &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case - - LOG_D(MAC, + // check if there's data on the CCCH to send with Msg4 + rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block + &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case + + LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n", module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length); - AssertFatal(rrc_sdu_length > 0, - "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length); - - - - LOG_D(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n", - module_idP, CC_idP, frameP, subframeP, ra->rnti); - - /// Choose first 4 RBs for Msg4, should really check that these are free! - first_rb = 0; - - vrb_map[first_rb] = 1; - vrb_map[first_rb + 1] = 1; - vrb_map[first_rb + 2] = 1; - vrb_map[first_rb + 3] = 1; - - - // Compute MCS/TBS for 3 PRB (coded on 4 vrb) - msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header - - if ((rrc_sdu_length + msg4_header) <= 22) { - ra->msg4_mcs = 4; - ra->msg4_TBsize = 22; - } else if ((rrc_sdu_length + msg4_header) <= 28) { - ra->msg4_mcs = 5; - ra->msg4_TBsize = 28; - } else if ((rrc_sdu_length + msg4_header) <= 32) { - ra->msg4_mcs = 6; - ra->msg4_TBsize = 32; + // AssertFatal(rrc_sdu_length > 0, + // "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length); + + + + if (rrc_sdu_length > 0) LOG_I(MAC, + "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n", + module_idP, CC_idP, frameP, subframeP, ra->rnti); + else LOG_I(MAC, + "eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 without RRC Piggyback (RNTI %x)\n", + module_idP, CC_idP, frameP, subframeP, ra->rnti); + + /// Choose first 4 RBs for Msg4, should really check that these are free! + first_rb = 0; + + vrb_map[first_rb] = 1; + vrb_map[first_rb + 1] = 1; + vrb_map[first_rb + 2] = 1; + vrb_map[first_rb + 3] = 1; + + + // Compute MCS/TBS for 3 PRB (coded on 4 vrb) + msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header + + if ((rrc_sdu_length + msg4_header) <= 22) { + ra->msg4_mcs = 4; + ra->msg4_TBsize = 22; + } else if ((rrc_sdu_length + msg4_header) <= 28) { + ra->msg4_mcs = 5; + ra->msg4_TBsize = 28; + } else if ((rrc_sdu_length + msg4_header) <= 32) { + ra->msg4_mcs = 6; + ra->msg4_TBsize = 32; } else if ((rrc_sdu_length + msg4_header) <= 41) { ra->msg4_mcs = 7; ra->msg4_TBsize = 41; @@ -1128,7 +1132,9 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, msg4_padding, msg4_post_padding); DevAssert(UE_id != UE_INDEX_INVALID); // FIXME not sure how to gracefully return // CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0] - offset = generate_dlsch_header((unsigned char *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], 1, //num_sdus + int num_sdus = rrc_sdu_length > 0 ? 1 : 0; + offset = generate_dlsch_header((unsigned char *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], + num_sdus, //num_sdus (unsigned short *) &rrc_sdu_length, // &lcid, // sdu_lcid 255, // no drx diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 168eb58b37..d05a67edb2 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -838,6 +838,7 @@ void *sctp_eNB_task(void *arg) break; case SCTP_DATA_REQ: { + printf("SCTP: Sending message via SCTP\n"); sctp_send_data(ITTI_MESSAGE_GET_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_data_req); -- GitLab From eedc4226f06bb1d1427faa49cdeed8ccb13467ca Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sat, 15 Sep 2018 22:42:10 +0200 Subject: [PATCH 070/308] modifications for SRB0 to allow multiple UE contexts in case of delayed CCCH reception in CU/DU split (moved SRB0 from carrier to UE context) --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 34 ++--- openair2/LAYER2/MAC/eNB_scheduler_bch.c | 8 +- openair2/LAYER2/MAC/eNB_scheduler_dlsch.c | 10 +- openair2/LAYER2/MAC/eNB_scheduler_mch.c | 2 +- .../L2_INTERFACE/openair_rrc_L2_interface.h | 1 + openair2/RRC/LTE/L2_interface.c | 33 +++-- openair2/RRC/LTE/rrc_defs.h | 1 - openair2/RRC/LTE/rrc_eNB.c | 121 ++++++++++-------- openair2/RRC/LTE/rrc_proto.h | 17 ++- 9 files changed, 122 insertions(+), 105 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 3dbce03d04..3309ba7b9f 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -831,21 +831,22 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, // Get RRCConnectionSetup for Piggyback /*rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block &cc[CC_idP].CCCH_pdu.payload[0], ENB_FLAG_YES, module_idP, 0); // not used in this case*/ - - rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block - &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case - - LOG_D(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n", - module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length); - - AssertFatal(rrc_sdu_length > 0, - "[MAC][eNB Scheduler] CCCH not allocated\n"); - - LOG_D(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 BR with RRC Piggyback (ce_level %d RNTI %x)\n", - module_idP, CC_idP, frameP, subframeP, - ra->rach_resource_type - 1, ra->rnti); + + rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, + UE_RNTI(module_idP,UE_id),1, // 1 transport block + &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case + + LOG_D(MAC, + "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n", + module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length); + + AssertFatal(rrc_sdu_length > 0, + "[MAC][eNB Scheduler] CCCH not allocated\n"); + + LOG_D(MAC, + "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 BR with RRC Piggyback (ce_level %d RNTI %x)\n", + module_idP, CC_idP, frameP, subframeP, + ra->rach_resource_type - 1, ra->rnti); AssertFatal(1 == 0, "Msg4 generation not finished for BL/CE UE\n"); @@ -1017,7 +1018,8 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, &cc[CC_idP].CCCH_pdu.payload[0], ENB_FLAG_YES, module_idP, 0); // not used in this case*/ // check if there's data on the CCCH to send with Msg4 - rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block + rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, + UE_RNTI(module_idP,UE_id),1, // 1 transport block &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case LOG_D(MAC, diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index b2b59691f8..b88a58ec7c 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -193,7 +193,7 @@ schedule_SIB1_BR(module_id_t module_idP, n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB]; - bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case + bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 0xFFFF, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19, "schedulingInfoSIB1_BR_r13 %d > 18\n", @@ -382,7 +382,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, if ((sf_mod_period < si_WindowLength_BR_r13) && ((frameP & (((1 << si_RepetitionPattern_r13) - 1))) == 0)) { // this SIB is to be scheduled - bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0); // not used in this case + bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 0xFFFF, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0); // not used in this case AssertFatal(bcch_sdu_length > 0, "RRC returned 0 bytes for SI-BR %d\n", i); @@ -524,7 +524,7 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) dl_req = &dl_config_request->dl_config_request_body; cc = &eNB->common_channels[CC_id]; - mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case + mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 0xFFFF, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length); @@ -611,7 +611,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) dl_req = &eNB->DL_req[CC_id].dl_config_request_body; - bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 1, &cc->BCCH_pdu.payload[0], 0); // not used in this case + bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 0xFFFF,1, &cc->BCCH_pdu.payload[0], 0); // not used in this case if (bcch_sdu_length > 0) { LOG_D(MAC, "[eNB %d] Frame %d : BCCH->DLSCH CC_id %d, Received %d bytes \n", module_idP, frameP, CC_id, bcch_sdu_length); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index da52a8fedc..938e6b304b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -731,10 +731,14 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP, aggregation = 2; } } + int ccecond = CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, + aggregation, rnti); + if (!ccecond) { + // check for CCCH + } /* if (continue_flag != 1 */ if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated - CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, - aggregation, rnti)) { + ccecond) { LOG_D(MAC, "[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", module_idP, frameP, UE_id, CC_id); @@ -1836,7 +1840,7 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP) pcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, - PCCH,1, + PCCH,0xFFFE,1, &cc->PCCH_pdu.payload[0], i); // used for ue index if (pcch_sdu_length == 0) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index 16953e958a..da2b19dee6 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -542,7 +542,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, "[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n", module_idP, CC_id, frameP, subframeP, i, j); - mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 1, &cc->MCCH_pdu.payload[0], + mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 0xFFFC, 1, &cc->MCCH_pdu.payload[0], i); // this is the mbsfn sync area index if (mcch_sdu_length > 0) { diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h index f01721e182..6b7502d50d 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h @@ -39,6 +39,7 @@ mac_rrc_data_req( const int CC_idP, const frame_t frameP, const rb_id_t srb_idP, + const rnti_t rntiP, const uint8_t nb_tbP, uint8_t* const buffer_pP, const uint8_t mbsfn_sync_areaP diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 9ce6a5d52f..ed7e0c4d01 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -53,6 +53,7 @@ mac_rrc_data_req( const int CC_id, const frame_t frameP, const rb_id_t Srb_id, + const rnti_t rnti, const uint8_t Nb_tb, uint8_t* const buffer_pP, const uint8_t mbsfn_sync_area @@ -105,9 +106,6 @@ mac_rrc_data_req( return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); } // All RFN mod 8 transmit SIB2-3 in SF 5 else if ((frameP%8) == 1) { - LOG_I(RRC,"Copying SIB23 @ %p to mac %d bytes\n", - RC.rrc[Mod_idP]->carrier[CC_id].SIB23, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); memcpy(&buffer_pP[0], RC.rrc[Mod_idP]->carrier[CC_id].SIB23, RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); @@ -144,14 +142,19 @@ mac_rrc_data_req( } if( (Srb_id & RAB_OFFSET ) == CCCH) { - LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); - if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) { + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); + + if (ue_context_p == NULL) return(0); + eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d, rnti %x)\n",Mod_idP,frameP, Srb_id,rnti); + + if(ue_p->Srb0.Active==0) { LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP); - return -1; + return(0); } - Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0; + Srb_info=&ue_p->Srb0; // check if data is there for MAC if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer @@ -300,18 +303,14 @@ mac_rrc_data_ind( */ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0); - if((srb_idP & RAB_OFFSET) == CCCH) { - Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0; - LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id); + if((srb_idP & RAB_OFFSET) == CCCH) { + LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB 0\n",module_idP); // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); - if (sdu_lenP > 0) { - memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP); - Srb_info->Rx_buffer.payload_size = sdu_lenP; - rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id); - } - } - if((srb_idP & RAB_OFFSET) == DCCH) { + if (sdu_lenP > 0) rrc_eNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id); + + } + if((srb_idP & RAB_OFFSET) == DCCH) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id],rntiP); if(ue_context_p){ diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 8464e11913..ad7d2f31f6 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -671,7 +671,6 @@ typedef struct { SystemInformationBlockType21_r14_t *sib21; // End - TTN SRB_INFO SI; - SRB_INFO Srb0; uint8_t *paging[MAX_MOBILES_PER_ENB]; uint32_t sizeof_paging[MAX_MOBILES_PER_ENB]; } rrc_eNB_carrier_data_t; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index f8775acb75..1f5cd605ba 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -131,8 +131,8 @@ openair_rrc_on( for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1; - rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; + // rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); + // RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; } } @@ -1224,29 +1224,30 @@ rrc_eNB_generate_RRCConnectionReject( T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = + eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + ue_p->Srb0.Tx_buffer.payload_size = do_RRCConnectionReject(ctxt_pP->module_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); + (uint8_t*) ue_p->Srb0.Tx_buffer.Payload); LOG_DUMPMSG(RRC,DEBUG_RRC, - (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + (char *)(ue_p->Srb0.Tx_buffer.Payload), + ue_p->Srb0.Tx_buffer.payload_size, "[MSG] RRCConnectionReject\n"); MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + ue_p->Srb0.Tx_buffer.Header, + ue_p->Srb0.Tx_buffer.payload_size, MSC_AS_TIME_FMT" RRCConnectionReject UE %x size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + ue_p->Srb0.Tx_buffer.payload_size); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReject (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + ue_p->Srb0.Tx_buffer.payload_size); } //----------------------------------------------------------------------------- @@ -1266,19 +1267,22 @@ rrc_eNB_generate_RRCConnectionReestablishment( T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - SRB_configList = &ue_context_pP->ue_context.SRB_configList; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = + eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + + SRB_configList = &ue_p->SRB_configList; + + ue_p->Srb0.Tx_buffer.payload_size = do_RRCConnectionReestablishment(ctxt_pP, ue_context_pP, CC_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t*) ue_p->Srb0.Tx_buffer.Payload, (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), SRB_configList, &ue_context_pP->ue_context.physicalConfigDedicated); LOG_DUMPMSG(RRC,DEBUG_RRC, - (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + (char *)(ue_p->Srb0.Tx_buffer.Payload), + ue_p->Srb0.Tx_buffer.payload_size, "[MSG] RRCConnectionReestablishment\n" ); // configure SRB1 for UE @@ -1342,17 +1346,17 @@ rrc_eNB_generate_RRCConnectionReestablishment( MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_RRC_UE, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + ue_p->Srb0.Tx_buffer.Header, + ue_p->Srb0.Tx_buffer.payload_size, MSC_AS_TIME_FMT" RRCConnectionReestablishment UE %x size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + ue_p->Srb0.Tx_buffer.payload_size); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishment (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + ue_p->Srb0.Tx_buffer.payload_size); int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); if(UE_id != -1){ @@ -2022,30 +2026,32 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = + eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + + ue_p->Srb0.Tx_buffer.payload_size = do_RRCConnectionReestablishmentReject(ctxt_pP->module_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); + (uint8_t*) ue_p->Srb0.Tx_buffer.Payload); LOG_DUMPMSG(RRC,DEBUG_RRC, - (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + (char *)(ue_p->Srb0.Tx_buffer.Payload), + ue_p->Srb0.Tx_buffer.payload_size, "[MSG] RRCConnectionReestablishmentReject\n"); MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + ue_p->Srb0.Tx_buffer.Header, + ue_p->Srb0.Tx_buffer.payload_size, MSC_AS_TIME_FMT" RRCConnectionReestablishmentReject UE %x size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + ue_p->Srb0.Tx_buffer.payload_size); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + ue_p->Srb0.Tx_buffer.payload_size); } //----------------------------------------------------------------------------- @@ -5732,20 +5738,22 @@ rrc_eNB_generate_RRCConnectionSetup( T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - SRB_configList = &ue_context_pP->ue_context.SRB_configList; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = + eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + + SRB_configList = &ue_p->SRB_configList; + ue_p->Srb0.Tx_buffer.payload_size = do_RRCConnectionSetup(ctxt_pP, ue_context_pP, CC_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t*) ue_p->Srb0.Tx_buffer.Payload, (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), SRB_configList, &ue_context_pP->ue_context.physicalConfigDedicated); LOG_DUMPMSG(RRC,DEBUG_RRC, - (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + (char *)(ue_p->Srb0.Tx_buffer.Payload), + ue_p->Srb0.Tx_buffer.payload_size, "[MSG] RRC Connection Setup\n"); // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE @@ -5812,18 +5820,18 @@ rrc_eNB_generate_RRCConnectionSetup( MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + ue_p->Srb0.Tx_buffer.Header, // LG WARNING + ue_p->Srb0.Tx_buffer.payload_size, MSC_AS_TIME_FMT" RRCConnectionSetup UE %x size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + ue_p->Srb0.Tx_buffer.payload_size); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + ue_p->Srb0.Tx_buffer.payload_size); //ue_context_pP->ue_context.ue_release_timer_thres=100; // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE @@ -5887,10 +5895,6 @@ openair_rrc_eNB_init( pthread_mutex_init(&RC.rrc[ctxt.module_id]->cell_info_mutex,NULL); RC.rrc[ctxt.module_id]->cell_info_configured = 0; - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - RC.rrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0; - } - uid_linear_allocator_init(&RC.rrc[ctxt.module_id]->uid_allocator); RB_INIT(&RC.rrc[ctxt.module_id]->rrc_ue_head); // for (j = 0; j < (MAX_MOBILES_PER_ENB + 1); j++) { @@ -6016,7 +6020,8 @@ openair_rrc_eNB_init( int rrc_eNB_decode_ccch( protocol_ctxt_t* const ctxt_pP, - const SRB_INFO* const Srb_info, + uint8_t *buffer, + int buffer_length, const int CC_id ) //----------------------------------------------------------------------------- @@ -6038,17 +6043,17 @@ rrc_eNB_decode_ccch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ((uint8_t*) Srb_info->Rx_buffer.Payload)[0], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[1], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[2], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[3], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[4], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[5], (uint8_t *) Srb_info->Rx_buffer.Payload); + ((uint8_t*) buffer)[0], + ((uint8_t *) buffer)[1], + ((uint8_t *) buffer)[2], + ((uint8_t *) buffer)[3], + ((uint8_t *) buffer)[4], + ((uint8_t *) buffer)[5], (uint8_t *) buffer); dec_rval = uper_decode( NULL, &asn_DEF_UL_CCCH_Message, (void**)&ul_ccch_msg, - (uint8_t*) Srb_info->Rx_buffer.Payload, + (uint8_t*) buffer, 100, 0, 0); @@ -6109,8 +6114,8 @@ rrc_eNB_decode_ccch( T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Srb_info->Rx_buffer.Payload), - Srb_info->Rx_buffer.payload_size, + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(buffer), + buffer_length, "[MSG] RRC Connection Reestablishment Request\n"); LOG_D(RRC, @@ -6329,8 +6334,8 @@ rrc_eNB_decode_ccch( T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Srb_info->Rx_buffer.Payload), - Srb_info->Rx_buffer.payload_size, + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer, + buffer_length, "[MSG] RRC Connection Request\n"); LOG_D(RRC, @@ -6347,7 +6352,7 @@ rrc_eNB_decode_ccch( MSC_LOG_RX_DISCARDED_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, - Srb_info->Rx_buffer.Payload, + buffer, dec_rval.consumed, MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)", MSC_AS_TIME_ARGS(ctxt_pP), @@ -6418,7 +6423,7 @@ rrc_eNB_decode_ccch( MSC_LOG_RX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, - Srb_info->Rx_buffer.Payload, + buffer, dec_rval.consumed, MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", MSC_AS_TIME_ARGS(ctxt_pP), @@ -7445,8 +7450,12 @@ rrc_enb_task( PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), msg_name_p); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], + RRC_MAC_CCCH_DATA_IND(msg_p).rnti); + CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; - srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; + eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + srb_info_p = &ue_p->Srb0; LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); @@ -7459,7 +7468,7 @@ rrc_enb_task( RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; - rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id); + rrc_eNB_decode_ccch(&ctxt, srb_info_p->Rx_buffer.Payload,srb_info_p->Rx_buffer.payload_size, CC_id); break; /* Messages from PDCP */ diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index 68c8655714..408270edbc 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -219,13 +219,15 @@ uint8_t rrc_eNB_get_next_transaction_identifier(module_id_t module_idP); /**\brief Entry routine to decode a UL-CCCH-Message. Invokes PER decoder and parses message. \param ctxt_pP Running context - \param Srb_info Pointer to SRB0 information structure (buffer, etc.)*/ -int -rrc_eNB_decode_ccch( - protocol_ctxt_t* const ctxt_pP, - const SRB_INFO* const Srb_info, - const int CC_id -); + \param buffer Pointer to SDU + \param buffer_length length of SDU in bytes + \param CC_id component carrier index*/ + +int rrc_eNB_decode_ccch(protocol_ctxt_t* const ctxt_pP, + uint8_t *buffer, + int buffer_length, + const int CC_id + ); /**\brief Entry routine to decode a UL-DCCH-Message. Invokes PER decoder and parses message. \param ctxt_pP Context @@ -411,6 +413,7 @@ mac_rrc_data_req( const int CC_id, const frame_t frameP, const rb_id_t Srb_id, + const rnti_t rnti, const uint8_t Nb_tb, uint8_t* const buffer_pP, const uint8_t mbsfn_sync_area -- GitLab From ca9748eca7ea5dba36d761ca81ddc36179c1f6d0 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sun, 16 Sep 2018 11:03:53 +0200 Subject: [PATCH 071/308] corrections to RNTI coding/decoding in openair3/conversions.h --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 22 +++++++++----------- openair2/F1AP/f1ap_cu_task.c | 8 +++---- openair2/F1AP/f1ap_decoder.c | 14 ++++++++----- openair2/F1AP/f1ap_handlers.c | 1 + openair3/SCTP/sctp_eNB_task.c | 1 - openair3/UTILS/conversions.h | 4 ++-- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 52a6a63320..78090104bb 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -87,31 +87,29 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RNTI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_C_RNTI, true); - BIT_STRING_TO_CELL_IDENTITY(&ie->value.choice.C_RNTI, rnti); + BUFFER_TO_INT16(ie->value.choice.C_RNTI.buf, rnti); /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - ccch_sdu = calloc(ie->value.choice.RRCContainer.size + 1, sizeof(char)); - memcpy(ccch_sdu, ie->value.choice.RRCContainer.buf, - ie->value.choice.RRCContainer.size); - /* Convert the mme name to a printable string */ - ccch_sdu[ie->value.choice.RRCContainer.size] = '\0'; - printf ("RRCContainer %s \n", ccch_sdu); - - ccch_sdu_len = ie->value.choice.RRCContainer.size; - - // create an ITTI message + // create an ITTI message and copy SDU message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, ccch_sdu, ccch_sdu_len); + ccch_sdu_len = ie->value.choice.RRCContainer.size; + memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, + ccch_sdu_len); + printf ("RRCContainer(CCCH) :"); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + + RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; RRC_MAC_CCCH_DATA_IND (message_p).enb_index = instance; // CU instance RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; + printf("Sending ITTI message to instance %d, rnti %x\n",instance,rnti); itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index c7deb55e16..d6ab3adbdc 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -119,19 +119,19 @@ void *F1AP_CU_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case SCTP_NEW_ASSOCIATION_IND: - LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND\n"); + LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_NEW_ASSOCIATION_RESP: - LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); + LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: - LOG_I(CU_F1AP, "SCTP_DATA_IND\n"); + LOG_I(CU_F1AP, "SCTP_DATA_IND for Instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; @@ -170,4 +170,4 @@ void *F1AP_CU_task(void *arg) { } // while return NULL; -} \ No newline at end of file +} diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 6a6a761866..80279d6258 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -41,11 +41,15 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) DevAssert(pdu != NULL); switch(pdu->choice.initiatingMessage->procedureCode) { - - case F1AP_ProcedureCode_id_F1Setup: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); - break; + + case F1AP_ProcedureCode_id_F1Setup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + printf("f1ap_eNB_decode_initiating_message!\n"); + break; + case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + printf("f1ap_eNB_decode_initiating_message!\n"); + break; // case F1AP_ProcedureCode_id_InitialContextSetup: // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); // message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index c2d647e9b8..3957a7e2c9 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -116,6 +116,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Calling the right handler */ + printf("Calling handler with instance %d\n",instance); ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index d05a67edb2..168eb58b37 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -838,7 +838,6 @@ void *sctp_eNB_task(void *arg) break; case SCTP_DATA_REQ: { - printf("SCTP: Sending message via SCTP\n"); sctp_send_data(ITTI_MESSAGE_GET_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_data_req); diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index d6bbbbd03d..04e9712d91 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -258,8 +258,8 @@ do { \ #define C_RNTI_TO_BIT_STRING(mACRO, bITsTRING) \ do { \ (bITsTRING)->buf = calloc(2, sizeof(uint8_t)); \ - (bITsTRING)->buf[0] = (mACRO) >> 4; \ - (bITsTRING)->buf[1] = ((mACRO) & 0x0f) << 4; \ + (bITsTRING)->buf[0] = (mACRO) >> 8; \ + (bITsTRING)->buf[1] = ((mACRO) & 0x0ff); \ (bITsTRING)->size = 2; \ (bITsTRING)->bits_unused = 0; \ } while(0) -- GitLab From 0e7887de76c82ecc100571e1112d0f77136856af Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Sun, 16 Sep 2018 21:51:15 +0800 Subject: [PATCH 072/308] Handle DL\UL RRC MESSAGE TRANSFER at f1ap_handlers --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 79 +++++++++++-- openair2/F1AP/f1ap_decoder.c | 27 +++-- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 110 +++++++++++++++++-- openair2/F1AP/f1ap_handlers.c | 5 +- 4 files changed, 191 insertions(+), 30 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 78090104bb..f7d8ac929d 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -246,16 +246,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) { printf("Failed to encode F1 setup request\n"); return -1; } - - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - return -1; - } - - return 0; + } /* @@ -266,5 +257,71 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + + printf("CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); + + MessageDef *message_p; + F1AP_ULRRCMessageTransfer_t *container; + F1AP_ULRRCMessageTransferIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + + uint64_t cu_ue_f1ap_id; + uint64_t du_ue_f1ap_id; + uint64_t srb_id; + int executeDuplication; + sdu_size_t ccch_sdu_len; + uint64_t subscriberProfileIDforRFP; + uint64_t rAT_FrequencySelectionPriority; + + DevAssert(pdu != NULL); + + if (stream != 0) { + LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", + assoc_id, stream); + return -1; + } + + container = &pdu->choice.initiatingMessage->value.choice.ULRRCMessageTransfer; + + + /* GNB_CU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + printf("cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + + + /* GNB_DU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + + + /* mandatory */ + /* SRBID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SRBID, true); + srb_id = ie->value.choice.SRBID; + printf("srb_id %lu \n", srb_id); + + + // issue in here + /* mandatory */ + /* RRC Container */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_RRCContainer, true); + // BK: need check + // create an ITTI message and copy SDU + message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + ccch_sdu_len = ie->value.choice.RRCContainer.size; + memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, + ccch_sdu_len); + printf ("RRCContainer(CCCH) :"); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + + return 0; } diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 80279d6258..08816bd82b 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -42,14 +42,25 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) switch(pdu->choice.initiatingMessage->procedureCode) { - case F1AP_ProcedureCode_id_F1Setup: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); - break; - case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); - break; + case F1AP_ProcedureCode_id_F1Setup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + printf("f1ap_eNB_decode_initiating_message!\n"); + break; + + case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + printf("f1ap_eNB_decode_initiating_message!\n"); + break; + + case F1AP_ProcedureCode_id_DLRRCMessageTransfer: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + printf("f1ap_eNB_decode_initiating_message!\n"); + break; + + case F1AP_ProcedureCode_id_ULRRCMessageTransfer: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + printf("f1ap_eNB_decode_initiating_message!\n"); + break; // case F1AP_ProcedureCode_id_InitialContextSetup: // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); // message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index fef7fac097..a2febfaa62 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -48,7 +48,107 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + + printf("DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); + + MessageDef *message_p; + F1AP_DLRRCMessageTransfer_t *container; + F1AP_DLRRCMessageTransferIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + + uint64_t cu_ue_f1ap_id; + uint64_t du_ue_f1ap_id; + uint64_t srb_id; + int executeDuplication; + sdu_size_t ccch_sdu_len; + uint64_t subscriberProfileIDforRFP; + uint64_t rAT_FrequencySelectionPriority; + + DevAssert(pdu != NULL); + + if (stream != 0) { + LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", + assoc_id, stream); + return -1; + } + + container = &pdu->choice.initiatingMessage->value.choice.DLRRCMessageTransfer; + + + /* GNB_CU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + printf("cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + + + /* GNB_DU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + + + /* optional */ + /* oldgNB_DU_UE_F1AP_ID */ + if (0) { + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID, true); + } + + /* mandatory */ + /* SRBID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SRBID, true); + srb_id = ie->value.choice.SRBID; + printf("srb_id %lu \n", srb_id); + + + /* optional */ + /* ExecuteDuplication */ + if (0) { + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); + executeDuplication = ie->value.choice.ExecuteDuplication; + printf("ExecuteDuplication %d \n", executeDuplication); + } + + // issue in here + /* mandatory */ + /* RRC Container */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_RRCContainer, true); + // BK: need check + // create an ITTI message and copy SDU + message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + ccch_sdu_len = ie->value.choice.RRCContainer.size; + memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, + ccch_sdu_len); + printf ("RRCContainer(CCCH) :"); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + + + /* optional */ + /* RAT_FrequencyPriorityInformation */ + if (0) { + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true); + + switch(ie->value.choice.RAT_FrequencyPriorityInformation.present) { + case F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP: + subscriberProfileIDforRFP = ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP; + break; + case F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority: + rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority; + break; + } + } + + return 0; + } //void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { @@ -207,20 +307,12 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { printf("Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); return 0; - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //AssertFatal(1==0,"Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 3957a7e2c9..168f6deaa9 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -36,6 +36,7 @@ #include "f1ap_cu_interface_management.h" #include "f1ap_du_interface_management.h" #include "f1ap_cu_rrc_message_transfer.h" +#include "f1ap_du_rrc_message_transfer.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; @@ -55,8 +56,8 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* UEMobilityCommand */ { 0, 0, 0 }, /* UEContextReleaseRequest */ { CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* InitialULRRCMessageTransfer */ - { 0, 0, 0 }, /* DLRRCMessageTransfer */ - { 0, 0, 0 }, /* ULRRCMessageTransfer */ + { DU_handle_DL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* DLRRCMessageTransfer */ + { CU_handle_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* ULRRCMessageTransfer */ { 0, 0, 0 }, /* privateMessage */ { 0, 0, 0 }, /* UEInactivityNotification */ { 0, 0, 0 }, /* GNBDUResourceCoordination */ -- GitLab From 942d92cf7c82831a0036857fb56e039c8316ec81 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Sun, 16 Sep 2018 07:54:22 +0200 Subject: [PATCH 073/308] send msg 4 in F1 DL RRC message transfer --- openair2/COMMON/f1ap_messages_def.h | 2 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 73 ++++++++--- openair2/F1AP/f1ap_cu_rrc_message_transfer.h | 4 +- openair2/F1AP/f1ap_cu_task.c | 8 ++ openair2/F1AP/f1ap_du_interface_management.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 14 +- .../L2_INTERFACE/openair_rrc_L2_interface.h | 3 +- openair2/RRC/LTE/L2_interface.c | 8 +- openair2/RRC/LTE/rrc_eNB.c | 123 +++++++++--------- openair2/RRC/LTE/rrc_proto.h | 3 +- 10 files changed, 142 insertions(+), 98 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 65b41872bd..f08a9534d4 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -37,7 +37,7 @@ MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_r /* RRC -> F1AP messages */ -MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_downlink_rrc_message ) +MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message ) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req ) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index f7d8ac929d..c9005b06a7 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -41,6 +41,10 @@ // a compile error #undef C_RNTI +// Bing Kai: create CU and DU context, and put all the information there. +uint64_t du_ue_f1ap_id = 0; +uint32_t f1ap_assoc_id = 0; +uint32_t f1ap_stream = 0; /* Initial UL RRC Message Transfer */ @@ -62,15 +66,18 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint8_t *ccch_sdu; sdu_size_t ccch_sdu_len; int CC_id =0; - uint64_t du_ue_f1ap_id; + DevAssert(pdu != NULL); if (stream != 0) { - LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", + LOG_E(CU_F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", assoc_id, stream); return -1; } + // TODO: use context + f1ap_stream = stream; + f1ap_assoc_id = assoc_id; container = &pdu->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer; @@ -80,10 +87,13 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); - /* NRCGI */ + /* NRCGI + * TODO: process NRCGI + */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_NRCGI, true); + /* RNTI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_C_RNTI, true); @@ -148,16 +158,28 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, */ //void CU_send_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { -int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) { - F1AP_F1AP_PDU_t pdu; +int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, + f1ap_dl_rrc_message_t *f1ap_dl_rrc) + { + + F1AP_F1AP_PDU_t pdu; F1AP_DLRRCMessageTransfer_t *out; F1AP_DLRRCMessageTransferIEs_t *ie; uint8_t *buffer; uint32_t len; + if (f1ap_stream == 0) { + LOG_E(CU_F1AP, "[CU %d] Received DL RRC message transfer on stream == %d\n", + f1ap_assoc_id, f1ap_stream); + return -1; + } + + out = &pdu.choice.initiatingMessage->value.choice.DLRRCMessageTransfer; + + /* Create */ - /* 0. Message Type */ + /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); @@ -168,11 +190,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) { /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_dl_rrc->gNB_CU_ue_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -181,19 +204,19 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) { ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ie->value.choice.GNB_DU_UE_F1AP_ID = du_ue_f1ap_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ /* c3. oldgNB_DU_UE_F1AP_ID */ - if (0) { + /* if (f1ap_dl_rrc->old_gNB_DU_ue_id != 0xFFFFFFFF) { ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - //ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING; - //ie->value.choice. = 1; + ie->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING; + ie->value.choice.oldgNB_DU_UE_F1AP_ID = f1ap_dl_rrc->old_gNB_DU_ue_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } + }*/ /* mandatory */ /* c4. SRBID */ @@ -201,12 +224,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) { ie->id = F1AP_ProtocolIE_ID_id_SRBID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = 2L; + ie->value.choice.SRBID = f1ap_dl_rrc->srb_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ /* c5. ExecuteDuplication */ - if (0) { + if (f1ap_dl_rrc->execute_duplication) { ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_ExecuteDuplication; ie->criticality = F1AP_Criticality_ignore; @@ -222,11 +245,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) { ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "A", strlen("A")); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ /* c7. RAT_FrequencyPriorityInformation */ + /* TODO */ if (0) { ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; @@ -246,7 +270,20 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) { printf("Failed to encode F1 setup request\n"); return -1; } - + +#ifdef F1AP_TEST + printf("\n"); + /* decode */ + if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { + printf("Failed to decode F1 setup request\n"); + return -1; + } +#endif + + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id, buffer, len, 0); + + + return 0; } /* diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h index 952297b0dd..68ebbfe41e 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h @@ -38,11 +38,13 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance); +int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, + f1ap_dl_rrc_message_t *f1ap_dl_rrc); int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); + #endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index d6ab3adbdc..5da7dcba44 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -33,6 +33,7 @@ #include "f1ap_common.h" #include "f1ap_handlers.h" #include "f1ap_cu_interface_management.h" +#include "f1ap_cu_rrc_message_transfer.h" #include "f1ap_cu_task.h" extern RAN_CONTEXT_t RC; @@ -144,6 +145,13 @@ void *F1AP_CU_task(void *arg) { &F1AP_SETUP_RESP(received_msg)); break; + case F1AP_DL_RRC_MESSAGE: // from rrc + LOG_W(CU_F1AP, "F1AP_DL_RRC_MESSAGE\n"); + // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // &F1AP_SETUP_RESP(received_msg)); + CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_SETUP_RESP(received_msg)); + break; // case F1AP_SETUP_RESPONSE: // This is from RRC // CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index be36af0a1b..f2391a8149 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -425,7 +425,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, int num_cells_to_activate = 0; F1AP_Cells_to_be_Activated_List_Item_t *cell; - MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_RESP); + MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, F1AP_SETUP_RESP); printf("F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index f55f22b8d4..79939b061d 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -366,8 +366,6 @@ rx_sdu(const module_id_t enb_mod_idP, for (ii = 0; ii < NB_RA_PROC_MAX; ii++) { ra = &mac->common_channels[CC_idP].ra[ii]; if ((ra->rnti == current_rnti) && (ra->state != IDLE)) { - //int RC.cudu.du_flag = 1; - //int du_flag = 1; mac_rrc_data_ind( enb_mod_idP, CC_idP, @@ -376,8 +374,7 @@ rx_sdu(const module_id_t enb_mod_idP, DCCH, (uint8_t *) payload_ptr, rx_lengths[i], - 0, - RC.rrc[enb_mod_idP]->node_type + 0 ); // prepare transmission of Msg4(RRCConnectionReconfiguration) ra->state = MSGCRNTI; @@ -618,19 +615,16 @@ rx_sdu(const module_id_t enb_mod_idP, // kill RA procedure } - //int RC.cudu.du_flag = 1; - //int du_flag = 1; mac_rrc_data_ind( - enb_mod_idP, + enb_mod_idP, CC_idP, frameP, subframeP, UE_id, current_rnti, CCCH, (uint8_t *) payload_ptr, rx_lengths[i], - 0, - RC.rrc[enb_mod_idP]->node_type - ); + 0 + ); if (num_ce > 0) { // handle msg3 which is not RRCConnectionRequest diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h index 6b7502d50d..22fa2755d4 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h @@ -56,8 +56,7 @@ mac_rrc_data_ind( const rb_id_t srb_idP, const uint8_t* sduP, const sdu_size_t sdu_lenP, - const uint8_t mbsfn_sync_areaP, - const int du_flag + const uint8_t mbsfn_sync_areaP ); int8_t diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index ed7e0c4d01..6b66349116 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -270,13 +270,13 @@ mac_rrc_data_ind( const rb_id_t srb_idP, const uint8_t* sduP, const sdu_size_t sdu_lenP, - const uint8_t mbsfn_sync_areaP, - const int node_type + const uint8_t mbsfn_sync_areaP ) //-------------------------------------------------------------------------- { - LOG_E(RRC, "node_type == %d \n" , node_type); - if (node_type == ngran_eNB_DU) { + + + if ( RC.rrc[module_idP]->node_type == ngran_eNB_DU) { LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %d length %d for UE id %d RNTI %x \n", module_idP, srb_idP, sdu_lenP, UE_id, rntiP); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 1f5cd605ba..83789041be 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5734,7 +5734,8 @@ rrc_eNB_generate_RRCConnectionSetup( SRB_ToAddModList_t **SRB_configList; SRB_ToAddMod_t *SRB1_config; int cnt; - + MessageDef *message_p; + T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); @@ -5757,8 +5758,34 @@ rrc_eNB_generate_RRCConnectionSetup( "[MSG] RRC Connection Setup\n"); // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - - if (*SRB_configList != NULL) { + switch (RC.rrc[ctxt_pP->module_id]->node_type){ + case ngran_eNB_CU : + case ngran_ng_eNB_CU : + case ngran_gNB_CU : + // nothing to do for CU + break; + case ngran_eNB_DU : + case ngran_gNB_DU : + // create an ITTI message + message_p = itti_alloc_new_message (TASK_CU_F1, F1AP_DL_RRC_MESSAGE); + memset (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, 0, F1AP_DL_RRC_MESSAGE); + memcpy (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, + (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + ue_p->Srb0.Tx_buffer.payload_size); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; + F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH; + F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; + F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_RRC_ENB, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); + + case ngran_eNB: + case ngran_ng_eNB : + case ngran_gNB : + + if (*SRB_configList != NULL) { for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) { if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) { SRB1_config = (*SRB_configList)->list.array[cnt]; @@ -5812,11 +5839,14 @@ rrc_eNB_generate_RRCConnectionSetup( (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif ); - break; } } } - + break; + default : + LOG_W(RRC, "Unknown node type %d\n", RC.rrc[ctxt_pP->module_id]->node_type); + } + MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -6058,36 +6088,6 @@ rrc_eNB_decode_ccch( 0, 0); - /* -#if defined(ENABLE_ITTI) -# if defined(DISABLE_ITTI_XER_PRINT) - { - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_CCCH_MESSAGE); - memcpy(&message_p->ittiMsg, (void *)ul_ccch_msg, sizeof(RrcUlCcchMessage)); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); - } -# else - { - char message_string[10000]; - size_t message_string_size; - - if ((message_string_size = - xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_CCCH, message_string_size + sizeof(IttiMsgText)); - msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif - */ for (i = 0; i < 8; i++) { LOG_T(RRC, "%x.", ((uint8_t *) & ul_ccch_msg)[i]); @@ -6317,18 +6317,19 @@ rrc_eNB_decode_ccch( #endif ,NULL); + rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL, - 0,0 + , (PMCH_InfoList_r9_t *) NULL, + 0,0 # endif - ); + ); #endif //NO_RRM - } - break; + } + break; case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), @@ -6362,12 +6363,12 @@ rrc_eNB_decode_ccch( rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; { if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { - if(rrcConnectionRequest->ue_Identity.choice.randomValue.size != 5) - { - LOG_I(RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu", - (long unsigned int)rrcConnectionRequest->ue_Identity.choice.randomValue.size); - return -1; - } + if(rrcConnectionRequest->ue_Identity.choice.randomValue.size != 5) + { + LOG_I(RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu", + (long unsigned int)rrcConnectionRequest->ue_Identity.choice.randomValue.size); + return -1; + } memcpy(((uint8_t*) & random_value) + 3, rrcConnectionRequest->ue_Identity.choice.randomValue.buf, rrcConnectionRequest->ue_Identity.choice.randomValue.size); @@ -6437,8 +6438,8 @@ rrc_eNB_decode_ccch( PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_eNB_generate_RRCConnectionReject(ctxt_pP, - rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), - CC_id); + rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), + CC_id); // navid: break; } @@ -6546,17 +6547,21 @@ rrc_eNB_decode_ccch( #endif ,NULL); - rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL - , 0, 0 + , (PMCH_InfoList_r9_t *) NULL + , 0, 0 #endif - ); + ); #endif //NO_RRM - + } break; default: diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index 408270edbc..7afe8ab8b0 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -430,8 +430,7 @@ mac_rrc_data_ind( const rb_id_t srb_idP, const uint8_t* sduP, const sdu_size_t sdu_lenP, - const uint8_t mbsfn_sync_areaP, - const int node_type + const uint8_t mbsfn_sync_areaP ); int8_t -- GitLab From 7fcaf4f9840eb51af5183ae76a9c64f86065ee47 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Sun, 16 Sep 2018 15:27:38 +0200 Subject: [PATCH 074/308] Update the SIB buffer as per earlier commits --- openair2/RRC/LTE/rrc_eNB.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 83789041be..e8240bec23 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5767,13 +5767,14 @@ rrc_eNB_generate_RRCConnectionSetup( case ngran_eNB_DU : case ngran_gNB_DU : // create an ITTI message + /* TODO: F1 IDs ar missing in RRC */ message_p = itti_alloc_new_message (TASK_CU_F1, F1AP_DL_RRC_MESSAGE); memset (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, 0, F1AP_DL_RRC_MESSAGE); memcpy (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t*) ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; - F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH; -- GitLab From 693a82a58de8364c91a44c71d0c70d88bff9a0f0 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Sun, 16 Sep 2018 16:28:55 +0200 Subject: [PATCH 075/308] Add the instance id in the sctp_itti_send_new_message_ind --- openair3/SCTP/sctp_eNB_itti_messaging.c | 5 +++-- openair3/SCTP/sctp_eNB_itti_messaging.h | 3 ++- openair3/SCTP/sctp_eNB_task.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.c b/openair3/SCTP/sctp_eNB_itti_messaging.c index 3517c0597b..e25e022a0d 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.c +++ b/openair3/SCTP/sctp_eNB_itti_messaging.c @@ -24,7 +24,8 @@ #include "sctp_common.h" #include "sctp_eNB_itti_messaging.h" -int sctp_itti_send_new_message_ind(task_id_t task_id, uint32_t assoc_id, uint8_t *buffer, +int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, + uint32_t assoc_id, uint8_t *buffer, uint32_t buffer_length, uint16_t stream) { MessageDef *message_p; @@ -43,7 +44,7 @@ int sctp_itti_send_new_message_ind(task_id_t task_id, uint32_t assoc_id, uint8_t sctp_data_ind_p->buffer_length = buffer_length; sctp_data_ind_p->assoc_id = assoc_id; - return itti_send_msg_to_task(task_id, INSTANCE_DEFAULT, message_p); + return itti_send_msg_to_task(task_id, instance, message_p); } int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.h b/openair3/SCTP/sctp_eNB_itti_messaging.h index 665c5f0e66..ab476aa5ed 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.h +++ b/openair3/SCTP/sctp_eNB_itti_messaging.h @@ -22,7 +22,8 @@ #ifndef SCTP_ITTI_MESSAGING_H_ #define SCTP_ITTI_MESSAGING_H_ -int sctp_itti_send_new_message_ind(task_id_t task_id, uint32_t assoc_id, uint8_t *buffer, +int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, + uint32_t assoc_id, uint8_t *buffer, uint32_t buffer_length, uint16_t stream); int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 168eb58b37..630cdb1beb 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -749,6 +749,7 @@ sctp_eNB_read_from_socket( sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid)); sctp_itti_send_new_message_ind(sctp_cnx->task_id, + sctp_cnx->instance, sinfo.sinfo_assoc_id, buffer, n, sinfo.sinfo_stream); } -- GitLab From f7f7daf71569199713ea65078f1790b0744f4417 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Sun, 16 Sep 2018 22:02:33 +0800 Subject: [PATCH 076/308] Restore some template files for CMake --- .gitignore | 2 +- .../lte_noS1_build_oai/CMakeLists.template | 9 +++ .../oaisim_build_oai/CMakeLists.template | 60 ++++++++++++++++++ .../oaisim_mme_build_oai/CMakeLists.template | 62 ++++++++++++++++++ .../oaisim_noS1_build_oai/CMakeLists.template | 63 +++++++++++++++++++ 5 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 cmake_targets/lte_noS1_build_oai/CMakeLists.template create mode 100644 cmake_targets/oaisim_build_oai/CMakeLists.template create mode 100644 cmake_targets/oaisim_mme_build_oai/CMakeLists.template create mode 100644 cmake_targets/oaisim_noS1_build_oai/CMakeLists.template diff --git a/.gitignore b/.gitignore index 0051125185..35696f4cbf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ # log and exec file log/ -*build_oai/ +lte_build_oai/ targets/bin/ diff --git a/cmake_targets/lte_noS1_build_oai/CMakeLists.template b/cmake_targets/lte_noS1_build_oai/CMakeLists.template new file mode 100644 index 0000000000..c8fc68da52 --- /dev/null +++ b/cmake_targets/lte_noS1_build_oai/CMakeLists.template @@ -0,0 +1,9 @@ +set(ENABLE_ITTI True) +set(ENABLE_USE_MME False) +set(PDCP_USE_NETLINK True) +set(LINK_ENB_PDCP_TO_IP_DRIVER True) +set(LINK_ENB_PDCP_TO_GTPV1U False) +set(PDCP_USE_NETLINK_QUEUES False) +set(LINUX True) +set(SECU False) +set(NAS_UE False) diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template new file mode 100644 index 0000000000..22faac75b5 --- /dev/null +++ b/cmake_targets/oaisim_build_oai/CMakeLists.template @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 2.8) + +set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) +set ( DEBUG_OMG False ) +set ( DISABLE_XER_PRINT False ) +set ( DRIVER2013 True ) +set ( ENABLE_ITTI True ) +set ( ENABLE_NAS_UE_LOGGING True ) +set ( ENABLE_NEW_MULTICAST True ) +set ( ENABLE_RAL False ) +set ( ENABLE_SECURITY True ) +set ( ENABLE_STANDALONE_EPC False) +set ( ENABLE_USE_CPU_EXECUTION_TIME True ) +set ( ENABLE_USE_MME True ) +set ( ENABLE_USE_RAW_SOCKET_FOR_SGI True) +set ( ENABLE_VCD_FIFO False ) +set ( ENB_MODE True ) +set ( EXMIMO_IOT True ) +set ( JUMBO_FRAME True ) +set ( LARGE_SCALE False ) +set ( LINK_ENB_PDCP_TO_GTPV1U True) +set ( LINUX_LIST False ) +set ( LINUX True ) +set ( LOCALIZATION False ) +set ( LOG_NO_THREAD True ) +set ( DEADLINE_SCHEDULER False ) +set ( MAC_CONTEXT 1 ) +set ( MAX_NUM_CCs 1 ) +set ( MESSAGE_CHART_GENERATOR False) +set ( MSG_PRINT False ) +set ( MU_RECEIVER False ) +set ( NAS_ADDRESS_FIX False ) +set ( NAS_BUILT_IN_UE True) +set ( NAS_MME False ) +set ( NAS_UE True ) +set ( NB_ANTENNAS_RX "2" ) +set ( NB_ANTENNAS_TX "2" ) +set ( NO_RRM True ) +set ( OAISIM True ) +set ( OAI_NW_DRIVER_TYPE_ETHERNET False ) +set ( OAI_NW_DRIVER_USE_NETLINK True ) +set ( OPENAIR2 True ) +set ( OPENAIR_LTE True ) +set ( PACKAGE_NAME "oaisim" ) +set ( PDCP_USE_NETLINK True ) +set ( PDCP_MSG_PRINT False ) +set ( PHY_CONTEXT False ) +set ( PHY_EMUL False ) +set ( PHYSIM True ) +set ( RF_BOARD "False" ) +set ( RLC_STOP_ON_LOST_PDU False ) +set ( RRC_ASN1_VERSION "Rel10" ) +set ( RRC_DEFAULT_RAB_IS_AM True) +set ( RRC_MSG_PRINT False ) +set ( SECU False ) +set ( SMBV False ) +set ( TEST_OMG False ) +set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) +set ( USE_MME "R10" ) +set ( XER_PRINT False ) diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template new file mode 100644 index 0000000000..b18b23ee9a --- /dev/null +++ b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 2.8) + +set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) +set ( DEBUG_OMG False ) +set ( DISABLE_XER_PRINT False ) +set ( DRIVER2013 False ) +set ( ENABLE_ITTI True ) +set ( ENABLE_NAS_UE_LOGGING False ) +set ( ENABLE_NEW_MULTICAST False ) +set ( ENABLE_RAL False ) +set ( ENABLE_SECURITY False ) +set ( ENABLE_STANDALONE_EPC False ) +set ( ENABLE_USE_CPU_EXECUTION_TIME False ) +set ( ENABLE_USE_MME False ) +set ( ENABLE_USE_RAW_SOCKET_FOR_SGI True) +set ( ENABLE_VCD_FIFO False ) +set ( ENB_MODE False ) +set ( EPC_BUILD True ) +set ( EXMIMO_IOT False ) +set ( JUMBO_FRAME False ) +set ( LARGE_SCALE False ) +set ( LINK_ENB_PDCP_TO_GTPV1U True) +set ( LINUX_LIST False ) +set ( LINUX False ) +set ( LOCALIZATION False ) +set ( LOG_NO_THREAD False ) +set ( DEADLINE_SCHEDULER False ) +set ( MAC_CONTEXT 1 ) +set ( MAX_NUM_CCs 1 ) +set ( MSG_PRINT False ) +set ( MU_RECEIVER False ) +set ( NAS_ADDRESS_FIX False ) +set ( NAS_BUILT_IN_EPC True ) +set ( NAS_MME True ) +set ( NAS_NETLINK False ) +set ( NAS_UE False ) +set ( NB_ANTENNAS_RX "2" ) +set ( NB_ANTENNAS_TX "2" ) +set ( NO_RRM False ) +set ( OAISIM False ) +set ( OAI_NW_DRIVER_TYPE_ETHERNET False ) +set ( OAI_NW_DRIVER_USE_NETLINK False ) +set ( OPENAIR2 False ) +set ( OPENAIR_LTE False ) +set ( PACKAGE_NAME "EPC" ) +set ( PDCP_MSG_PRINT False ) +set ( PHY_CONTEXT False ) +set ( PHY_EMUL False ) +set ( PHYSIM False ) +set ( RF_BOARD "False" ) +set ( RRC_ASN1_VERSION "Rel10" ) +set ( RLC_STOP_ON_LOST_PDU False ) +set ( RRC_MSG_PRINT False ) +set ( SECU False ) +set ( SMBV False ) +set ( TEST_OMG False ) +set ( UPDATE_RELEASE_9 True) +set ( UPDATE_RELEASE_10 True) +set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) +set ( USE_MME "R10" ) +set ( XER_PRINT False ) +set ( XFORMS False ) diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template new file mode 100644 index 0000000000..bc416cff55 --- /dev/null +++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 2.8) + +set ( DEBUG_OMG False ) +set ( DISABLE_XER_PRINT False ) +set ( DRIVER2013 True ) +set ( ENABLE_ITTI True ) +set ( ENABLE_NAS_UE_LOGGING False ) +set ( ENABLE_NEW_MULTICAST True ) +set ( ENABLE_RAL False ) +set ( ENABLE_SECURITY False ) +set ( ENABLE_STANDALONE_EPC False) +set ( ENABLE_USE_CPU_EXECUTION_TIME True ) +set ( ENABLE_USE_MME False ) +set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False) +set ( ENABLE_VCD_FIFO False ) +set ( ENB_MODE True ) +set ( EXMIMO_IOT True ) +set ( JUMBO_FRAME True ) +set ( LARGE_SCALE False ) +set ( LINK_ENB_PDCP_TO_GTPV1U False) +set ( LINUX_LIST False ) +set ( LINUX True ) +set ( LOCALIZATION False ) +set ( LOG_NO_THREAD 1 ) +set ( DEADLINE_SCHEDULER False ) +set ( MAC_CONTEXT 1 ) +set ( MAX_NUM_CCs 1 ) +set ( MESSAGE_CHART_GENERATOR False ) +set ( MESSAGE_CHART_GENERATOR_RLC_MAC False ) +set ( MESSAGE_CHART_GENERATOR_PHY False ) +set ( MSG_PRINT False ) +set ( MU_RECEIVER False ) +set ( NAS_ADDRESS_FIX False ) +set ( NAS_BUILT_IN_UE False) +set ( NAS_MME False ) +set ( NAS_UE False ) +set ( NB_ANTENNAS_RX "2" ) +set ( NB_ANTENNAS_TX "2" ) +set ( NO_RRM True ) +set ( OAISIM True ) +set ( OAI_NW_DRIVER_TYPE_ETHERNET False ) +set ( OAI_NW_DRIVER_USE_NETLINK True ) +set ( OPENAIR2 True ) +set ( OPENAIR_LTE True ) +set ( PACKAGE_NAME "oaisim" ) +set ( PDCP_USE_NETLINK True ) +set ( PDCP_MSG_PRINT False ) +set ( PHY_CONTEXT False ) +set ( PHY_EMUL False ) +set ( PHYSIM True ) +set ( RF_BOARD "False" ) +set ( RRC_ASN1_VERSION "Rel10" ) +set ( RLC_STOP_ON_LOST_PDU False ) +set ( RRC_MSG_PRINT False ) +set ( SECU False ) +set ( SMBV False ) +set ( TEST_OMG False ) +set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) +set ( USE_MME "R10" ) +set ( XER_PRINT False ) +set ( DEBUG_PHY False ) +set ( DEBUG_PHY_PROC False) +set ( DEBUG_DLSCH False) -- GitLab From 825c33df1b4368114e6bf99fbfb2028ac332bf8d Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sun, 16 Sep 2018 23:07:14 +0200 Subject: [PATCH 077/308] handling of nr_cellid and creation of context upon CCCH transmission. Connection goes until generation of RRCConnectionSetup in CU which crashes (it calls rrc_mac_config_req. For DU this should be replaced with filling DL_RRC_MESSAGE_TRANSFER --- openair2/COMMON/f1ap_messages_types.h | 9 ++++- openair2/ENB_APP/enb_app.c | 2 +- openair2/ENB_APP/enb_config.c | 38 ++++++++++++------- openair2/ENB_APP/enb_paramdef.h | 4 +- openair2/F1AP/f1ap_cu_interface_management.c | 15 ++++++-- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 22 ++++++++++- openair2/F1AP/f1ap_du_interface_management.c | 25 +++++++++++- openair2/F1AP/f1ap_du_task.c | 5 ++- openair2/RRC/LTE/rrc_defs.h | 3 +- openair2/RRC/LTE/rrc_eNB.c | 27 ++++++++++--- openair3/UTILS/conversions.h | 7 ++++ .../PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf | 2 + .../CONF/du.lte.band7.10MHz.if4p5.conf | 2 + 13 files changed, 128 insertions(+), 33 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 824cf657a5..1c1fe6ed42 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -101,10 +101,10 @@ typedef struct f1ap_setup_req_s { uint16_t mnc[F1AP_MAX_NB_CELLS];//[6]; uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS];//[6]; + // NR Global Cell Id + uint64_t nr_cellid[F1AP_MAX_NB_CELLS]; // NR Physical Cell Ids uint16_t nr_pci[F1AP_MAX_NB_CELLS]; - // NR Cell Ids - uint8_t nr_cellid[F1AP_MAX_NB_CELLS]; // Number of slide support items (max 16, could be increased to as much as 1024) uint16_t num_ssi[F1AP_MAX_NB_CELLS];//[6]; uint8_t sst[F1AP_MAX_NB_CELLS];//[16][6]; @@ -189,6 +189,8 @@ typedef struct f1ap_setup_resp_s { uint16_t mnc[F1AP_MAX_NB_CELLS]; /// mnc digit length of DU cells uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS]; + // NR Global Cell Id + uint64_t nr_cellid[F1AP_MAX_NB_CELLS]; /// NRPCI uint16_t nrpci[F1AP_MAX_NB_CELLS]; /// num SI messages per DU cell @@ -228,6 +230,9 @@ typedef struct f1ap_initial_ul_rrc_message_s { uint16_t mnc; /// mnc digit length of DU cells uint8_t mnc_digit_length; + /// nr cell id + uint64_t nr_cellid; + /// crnti uint16_t crnti; uint8_t *rrc_container; int rrc_container_length; diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 2f86d38fa6..02e91ad486 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -235,7 +235,7 @@ void *eNB_app_task(void *args_p) case F1AP_SETUP_RESP: AssertFatal(RC.rrc[0]->node_type == ngran_eNB_DU, "Should not have received F1AP_REGISTER_ENB_CNF in CU/eNB\n"); - LOG_I(ENB_APP, "[eNB %d] Received %s: associated ngran_eNB_CU %s with %d cells to activate\n", instance, ITTI_MSG_NAME (msg_p), + LOG_I(ENB_APP, "Received %s: associated ngran_eNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p), F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate); handle_f1ap_setup_resp(&F1AP_SETUP_RESP(msg_p)); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index f9ae28259a..872a5ff358 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -799,12 +799,6 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { rrc->sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr); rrc->sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr); - // MCC and MNC - rrc->mcc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); - rrc->mnc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); - rrc->mnc_digit_length= strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); - rrc->tac= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); - } else { // no F1 @@ -812,6 +806,13 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { rrc->node_type = ngran_eNB; } + // MCC and MNC + rrc->mcc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); + rrc->mnc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); + rrc->mnc_digit_length = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + rrc->tac = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); + rrc->nr_cellid = (uint64_t)*(ENBParamList.paramarray[i][ENB_NRCELLID_IDX].u64ptr); + // search if in active list LOG_I(RRC,"RRC instances %d\n",num_enbs); @@ -2404,7 +2405,10 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { (F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 3), "BAD MNC DIGIT LENGTH %d", F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); - + + F1AP_SETUP_REQ (msg_p).nr_cellid[k] = (uint64_t)*(ENBParamList.paramarray[i][ENB_NRCELLID_IDX].u64ptr); + LOG_I(ENB_APP,"F1AP: nr_cellid[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).nr_cellid[k]); + LOG_I(ENB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.mac[k]->eth_params_n.remote_addr); LOG_I(ENB_APP,"FIAP: CU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.remote_addr)); @@ -2440,9 +2444,13 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { pthread_mutex_unlock(&rrc->cell_info_mutex); } while (cell_info_configured ==0); - + + rrc->mcc = F1AP_SETUP_REQ (msg_p).mcc[k]; + rrc->mnc = F1AP_SETUP_REQ (msg_p).mnc[k]; + rrc->tac = F1AP_SETUP_REQ (msg_p).tac[k]; + rrc->nr_cellid = F1AP_SETUP_REQ (msg_p).nr_cellid[k]; + F1AP_SETUP_REQ (msg_p).nr_pci[k] = rrc->carrier[0].physCellId; - F1AP_SETUP_REQ (msg_p).nr_cellid[k] = 0; F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0; @@ -3077,13 +3085,17 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { int i,j,si_ind; - + printf("cells_to_activated %d, RRC instances %d\n", + resp->num_cells_to_activate,RC.nb_inst); for (j=0;j<resp->num_cells_to_activate;j++) { for (i=0;i<RC.nb_inst;i++) { rrc_eNB_carrier_data_t *carrier = &RC.rrc[i]->carrier[0]; - // identify local index of cell j by plmn identity - if (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && - resp->nrpci[j] == carrier->physCellId) { + // identify local index of cell j by nr_cellid, plmn identity and physical cell ID + printf("Checking cell %d, rrc inst %d : rrc->nr_cellid %x, resp->nr_cellid %x\n", + j,i,RC.rrc[i]->nr_cellid,resp->nr_cellid[j]); + if (RC.rrc[i]->nr_cellid == resp->nr_cellid[j] && + (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && + resp->nrpci[j] == carrier->physCellId)) { // copy system information and decode it for (si_ind=0;si_ind<resp->num_SI[j];si_ind++) { printf("SI %d: ",si_ind); diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 1da25ec7b9..c7dfee7bda 100755 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -195,7 +195,7 @@ typedef enum { #define ENB_CONFIG_STRING_REMOTE_S_PORTC "remote_s_portc" #define ENB_CONFIG_STRING_LOCAL_S_PORTD "local_s_portd" #define ENB_CONFIG_STRING_REMOTE_S_PORTD "remote_s_portd" - +#define ENB_CONFIG_STRING_NR_CELLID "nr_cellid" /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* cell configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -215,6 +215,7 @@ typedef enum { {ENB_CONFIG_STRING_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ {ENB_CONFIG_STRING_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ +{ENB_CONFIG_STRING_NR_CELLID, NULL, 0, u64ptr:NULL, defint64val:0, TYPE_UINT64, 0}, \ } #define ENB_ENB_ID_IDX 0 #define ENB_CELL_TYPE_IDX 1 @@ -230,6 +231,7 @@ typedef enum { #define ENB_REMOTE_S_PORTC_IDX 11 #define ENB_LOCAL_S_PORTD_IDX 12 #define ENB_REMOTE_S_PORTD_IDX 13 +#define ENB_NRCELLID_IDX 14 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 650bbb1729..0d55e8be1e 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -146,13 +146,20 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, F1AP_SETUP_REQ(message_p).mnc[i], F1AP_SETUP_REQ(message_p).mnc_digit_length[i]); - // @issue in here cellID - F1AP_SETUP_REQ(message_p).nr_cellid[i] = 1; + + // NR cellID + BIT_STRING_TO_NR_CELL_IDENTITY(&served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity, + F1AP_SETUP_REQ(message_p).nr_cellid[i]); printf("[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], F1AP_SETUP_REQ(message_p).nr_cellid[i]); - + printf("nr_cellId : %x %x %x %x %x\n", + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2], + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3], + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]); /* - nRPCI */ F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI; printf ("F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); @@ -306,7 +313,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->nr_cellid[i], &nRCGI.nRCellIdentity); cells_to_be_activated_list_item.nRCGI = nRCGI; /* optional */ diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 78090104bb..fb2b47c8df 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -35,6 +35,9 @@ #include "f1ap_decoder.h" #include "f1ap_itti_messaging.h" #include "f1ap_cu_rrc_message_transfer.h" +#include "common/ran_context.h" +#include "openair3/UTILS/conversions.h" + // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which // replaces in ie->value.choice.C_RNTI, causing @@ -45,6 +48,8 @@ Initial UL RRC Message Transfer */ +extern RAN_CONTEXT_t RC; + int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, @@ -84,6 +89,9 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_NRCGI, true); + uint64_t nr_cellid; + BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity,nr_cellid); + /* RNTI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_C_RNTI, true); @@ -102,14 +110,24 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, printf ("RRCContainer(CCCH) :"); for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + // Find instance from nr_cellid + int rrc_inst = -1; + for (int i=0;i<RC.nb_inst;i++) { + // first get RRC instance (note, no the ITTI instance) + eNB_RRC_INST *rrc = RC.rrc[i]; + if (rrc->nr_cellid == nr_cellid) { + rrc_inst = i; + break; + } + } + AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %ll\n",nr_cellid); RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; - RRC_MAC_CCCH_DATA_IND (message_p).enb_index = instance; // CU instance + RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; - printf("Sending ITTI message to instance %d, rnti %x\n",instance,rnti); itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index be36af0a1b..47e1932f19 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -170,9 +170,17 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - nRCGI */ F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + printf("plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); + printf("nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",f1ap_du_data->nr_cellid[i], + nRCGI.nRCellIdentity.buf[0], + nRCGI.nRCellIdentity.buf[1], + nRCGI.nRCellIdentity.buf[2], + nRCGI.nRCellIdentity.buf[3], + nRCGI.nRCellIdentity.buf[4]); + served_cell_information.nRCGI = nRCGI; /* - nRPCI */ @@ -474,14 +482,21 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], F1AP_SETUP_RESP (msg_p).mnc_digit_length[i]); AssertFatal(cell->nRPCI != NULL, "nRPCI is null\n"); - + printf("nr_cellId : %x %x %x %x %x\n", + cell->nRCGI.nRCellIdentity.buf[0], + cell->nRCGI.nRCellIdentity.buf[1], + cell->nRCGI.nRCellIdentity.buf[2], + cell->nRCGI.nRCellIdentity.buf[3], + cell->nRCGI.nRCellIdentity.buf[4]); + BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, + F1AP_SETUP_RESP (msg_p).nr_cellid[i]); F1AP_SETUP_RESP (msg_p).nrpci[i] = *cell->nRPCI; F1AP_ProtocolExtensionContainer_160P9_t *ext = cell->iE_Extensions; AssertFatal(ext!=NULL,"Extension for SI is null\n"); F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - printf("F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRPCI %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nrpci[i],F1AP_SETUP_RESP (msg_p).num_SI[i]); + printf("F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %x num_si %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nr_cellid[i],F1AP_SETUP_RESP (msg_p).num_SI[i]); for (int si =0;si < ext->list.count;si++) { size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; @@ -585,6 +600,12 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + printf("nr_cellId : %x %x %x %x %x\n", + nRCGI.nRCellIdentity.buf[0], + nRCGI.nRCellIdentity.buf[1], + nRCGI.nRCellIdentity.buf[2], + nRCGI.nRCellIdentity.buf[3], + nRCGI.nRCellIdentity.buf[4]); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 1bc49270f0..5edcf01437 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -68,7 +68,8 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1 f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); *f1ap_du_data = *f1ap_setup_req; //printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]); - printf("sib f1ap context %s\n", f1ap_du_data->sib1[0]); + + printf("nr_cellid : %llx (%lld)",f1ap_setup_req->nr_cellid[0],f1ap_setup_req->nr_cellid[0]); //du_f1ap_register_to_sctp itti_send_msg_to_task(TASK_SCTP, instance, message_p); @@ -175,4 +176,4 @@ void *F1AP_DU_task(void *arg) { } // while return NULL; -} \ No newline at end of file +} diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index ad7d2f31f6..7408f64f35 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -714,7 +714,8 @@ typedef struct eNB_RRC_INST_s { int mnc_digit_length; /// tac int tac; - + /// NR cell id + uint64_t nr_cellid; // other RAN parameters int srb1_timer_poll_retransmit; int srb1_poll_pdu; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 1f5cd605ba..0e6a8bc222 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7308,8 +7308,11 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { int found_cell=0; for (int j=0;j<RC.nb_inst;j++) { eNB_RRC_INST *rrc = RC.rrc[j]; - if (rrc->mcc == f1_setup_req->mcc[i] && rrc->mnc == f1_setup_req->mnc[i]) { - // RK: cu_cell_ind is the index for cu_cell_ind, could you confirm? + if (rrc->mcc == f1_setup_req->mcc[i] && + rrc->mnc == f1_setup_req->mnc[i] && + rrc->nr_cellid == f1_setup_req->nr_cellid[i]) { + // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case) + rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]); rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i]; LOG_W(RRC, "instance %d mib length %d\n", i, f1_setup_req->mib_length[i]); @@ -7360,6 +7363,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->mcc; F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->mnc; F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->mnc_digit_length; + F1AP_SETUP_RESP (msg_p).nr_cellid[cu_cell_ind] = rrc->nr_cellid; F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i]; int num_SI= 0; if (rrc->carrier[0].SIB23) { @@ -7409,6 +7413,7 @@ rrc_enb_task( MessageDef *msg_p; const char *msg_name_p; instance_t instance; + int rrc_inst; int result; SRB_INFO *srb_info_p; int CC_id; @@ -7426,6 +7431,7 @@ rrc_enb_task( msg_name_p = ITTI_MSG_NAME(msg_p); instance = ITTI_MSG_INSTANCE(msg_p); + LOG_I(RRC,"Received message %s\n",msg_name_p); switch (ITTI_MSG_ID(msg_p)) { @@ -7440,8 +7446,11 @@ rrc_enb_task( /* Messages from MAC */ case RRC_MAC_CCCH_DATA_IND: + + rrc_inst = RRC_MAC_CCCH_DATA_IND(msg_p).enb_index; + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - instance, + rrc_inst, ENB_FLAG_YES, RRC_MAC_CCCH_DATA_IND(msg_p).rnti, msg_p->ittiMsgHeader.lte_time.frame, @@ -7450,15 +7459,23 @@ rrc_enb_task( PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), msg_name_p); - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[rrc_inst], RRC_MAC_CCCH_DATA_IND(msg_p).rnti); + if (ue_context_p == NULL) { + + // create a ue_context with rnti as random value, will be updated when Attach Request is received + ue_context_p = rrc_eNB_get_next_free_ue_context(&ctxt, + RRC_MAC_CCCH_DATA_IND(msg_p).rnti + ); + } + CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; srb_info_p = &ue_p->Srb0; LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + rrc_inst,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) { LOG_I(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); break; diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index 04e9712d91..71ca1616fd 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -162,6 +162,13 @@ do { \ ((aSN)->buf[2] << 4) | (aSN)->buf[3]; \ } while(0) +#define BIT_STRING_TO_NR_CELL_IDENTITY(aSN, vALUE) \ +do { \ + DevCheck((aSN)->bits_unused == 4, (aSN)->bits_unused, 4, 0); \ + vALUE = ((aSN)->buf[0] << 28) | ((aSN)->buf[1] << 20) | \ + ((aSN)->buf[2] << 12) | ((aSN)->buf[3]<<4) | ((aSN)->buf[4]>>4); \ +} while(0) + #define MCC_HUNDREDS(vALUE) \ ((vALUE) / 100) /* When MNC is only composed of 2 digits, set the hundreds unit to 0xf */ diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf index ba0bd886a6..8d42fcb761 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf @@ -19,6 +19,8 @@ eNBs = mobile_network_code = "93"; + nr_cellid = 12345678L + tr_s_preference = "f1" local_s_if_name = "lo"; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf index 360f55d73a..36a4bfde9e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf @@ -17,6 +17,8 @@ eNBs = mobile_network_code = "93"; + nr_cellid = 12345678L + ////////// Physical parameters: component_carriers = ( -- GitLab From a45d496c8cb20a4d28628cbfae54ce906678d0cb Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Mon, 17 Sep 2018 16:02:13 +0200 Subject: [PATCH 078/308] Update F1 DL RRC message transfer from DU to CU --- .gitignore | 1 + openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 9 --------- openair2/RRC/LTE/rrc_eNB.c | 18 ++++++++++-------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 35696f4cbf..d7126a6224 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ log/ lte_build_oai/ targets/bin/ +cmake_targets/nas_sim_tools/build/ diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 6ad346b486..d9d061c6d2 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -187,15 +187,6 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint8_t *buffer; uint32_t len; - if (f1ap_stream == 0) { - LOG_E(CU_F1AP, "[CU %d] Received DL RRC message transfer on stream == %d\n", - f1ap_assoc_id, f1ap_stream); - return -1; - } - - out = &pdu.choice.initiatingMessage->value.choice.DLRRCMessageTransfer; - - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 709bf4fd78..0202f42d2a 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5762,13 +5762,9 @@ rrc_eNB_generate_RRCConnectionSetup( case ngran_eNB_CU : case ngran_ng_eNB_CU : case ngran_gNB_CU : - // nothing to do for CU - break; - case ngran_eNB_DU : - case ngran_gNB_DU : // create an ITTI message - /* TODO: F1 IDs ar missing in RRC */ - message_p = itti_alloc_new_message (TASK_CU_F1, F1AP_DL_RRC_MESSAGE); + /* TODO: F1 IDs ar missing in RRC */ + message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_DL_RRC_MESSAGE); memset (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, 0, F1AP_DL_RRC_MESSAGE); memcpy (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, (uint8_t*) ue_p->Srb0.Tx_buffer.Payload, @@ -5780,8 +5776,14 @@ rrc_eNB_generate_RRCConnectionSetup( F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH; F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; - itti_send_msg_to_task (TASK_RRC_ENB, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); - + itti_send_msg_to_task (TASK_CU_F1, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); + LOG_E(RRC, "F1AP_DL_RRC_MESSAGE\n"); + break; + case ngran_eNB_DU : + case ngran_gNB_DU : + // nothing to do for DU + LOG_E(RRC, "nothing to do for DU\n"); + break; case ngran_eNB: case ngran_ng_eNB : case ngran_gNB : -- GitLab From 9482568f749d8c94fb3376209d9ead29810ba5cf Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Mon, 17 Sep 2018 18:13:36 +0200 Subject: [PATCH 079/308] F1AP_DL_RRC_MESSAGE destination change. --- openair2/RRC/LTE/rrc_eNB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 709bf4fd78..96ac4bd6ab 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5780,7 +5780,7 @@ rrc_eNB_generate_RRCConnectionSetup( F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH; F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; - itti_send_msg_to_task (TASK_RRC_ENB, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); + itti_send_msg_to_task (TASK_CU_F1, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); case ngran_eNB: case ngran_ng_eNB : -- GitLab From b1313aaf0419c831f711650bb432c9f87ed03dfa Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Mon, 17 Sep 2018 18:33:08 +0200 Subject: [PATCH 080/308] DL_RRC_MESSAGE_TRANSFER goes to DU, and is received, but doesn't reconfigure L2/L1 yet. --- openair2/RRC/LTE/rrc_eNB.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 29cb3adff4..9e118fecbb 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5765,10 +5765,8 @@ rrc_eNB_generate_RRCConnectionSetup( // create an ITTI message /* TODO: F1 IDs ar missing in RRC */ message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_DL_RRC_MESSAGE); - memset (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, 0, F1AP_DL_RRC_MESSAGE); - memcpy (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, - (uint8_t*) ue_p->Srb0.Tx_buffer.Payload, - ue_p->Srb0.Tx_buffer.payload_size); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload; + F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; @@ -5777,17 +5775,13 @@ rrc_eNB_generate_RRCConnectionSetup( F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; itti_send_msg_to_task (TASK_CU_F1, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); -<<<<<<< HEAD - -======= LOG_E(RRC, "F1AP_DL_RRC_MESSAGE\n"); break; case ngran_eNB_DU : case ngran_gNB_DU : // nothing to do for DU - LOG_E(RRC, "nothing to do for DU\n"); + AssertFatal(1==0,"nothing to do for DU\n"); break; ->>>>>>> a45d496c8cb20a4d28628cbfae54ce906678d0cb case ngran_eNB: case ngran_ng_eNB : case ngran_gNB : -- GitLab From 4ff44813623d30191260dee9ed93774573fbbc48 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Mon, 17 Sep 2018 22:56:01 +0200 Subject: [PATCH 081/308] switch/case for handling DL_RRC_MESSAGE in DU --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 77 +++++++++++++++++--- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index a2febfaa62..b66921526e 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -34,11 +34,17 @@ #include "f1ap_encoder.h" #include "f1ap_decoder.h" #include "f1ap_itti_messaging.h" + #include "f1ap_du_rrc_message_transfer.h" + +#include "DL-CCCH-Message.h" +#include "DL-DCCH-Message.h" + // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which // replaces in ie->value.choice.C_RNTI, causing // a compile error + #undef C_RNTI extern f1ap_setup_req_t *f1ap_du_data; @@ -62,7 +68,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint64_t du_ue_f1ap_id; uint64_t srb_id; int executeDuplication; - sdu_size_t ccch_sdu_len; + sdu_size_t rrc_dl_sdu_len; uint64_t subscriberProfileIDforRFP; uint64_t rAT_FrequencySelectionPriority; @@ -122,14 +128,14 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_RRCContainer, true); // BK: need check // create an ITTI message and copy SDU - message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); - memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - ccch_sdu_len = ie->value.choice.RRCContainer.size; - memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, - ccch_sdu_len); - printf ("RRCContainer(CCCH) :"); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - + // message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; + // memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, + // ccch_sdu_len); + printf ("RRCContainer :"); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",ie->value.choice.RRCContainer.buf[i]); + printf("\n"); /* optional */ /* RAT_FrequencyPriorityInformation */ @@ -147,6 +153,59 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } } + // decode RRC Container and act on the message type + AssertFatal(srb_id<3,"illegal srb_id\n"); + + if (srb_id == 0) { + DL_CCCH_Message_t* dl_ccch_msg=NULL; + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_DL_CCCH_Message, + (void**)&dl_ccch_msg, + ie->value.choice.RRCContainer.buf, + ie->value.choice.RRCContainer.size,0,0); + switch (dl_ccch_msg->message.choice.c1.present) { + + case DL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, "Received PR_NOTHING on DL-CCCH-Message\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n"); + // Get configuration + + break; + + default: + AssertFatal(1==0, + "Unknown message\n"); + break; + } + + } + else if (srb_id == 1){ + + } + + else if (srb_id == 2){ + + } return 0; } -- GitLab From 988d98a4e3ace4475a44d4da3f3131fd7e1f0bbe Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 18 Sep 2018 15:11:05 +0200 Subject: [PATCH 082/308] send UL RRC MESSAGE TRANSFER --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 28 +++++++------ openair2/F1AP/f1ap_du_rrc_message_transfer.h | 18 ++++---- openair2/LAYER2/RLC/rlc.c | 43 ++++++++++++++++---- 4 files changed, 63 insertions(+), 28 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index d9d061c6d2..fdec30ff68 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -213,7 +213,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = du_ue_f1ap_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index a2febfaa62..b539ae5cd1 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -152,7 +152,13 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } //void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { +int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, + int CC_idP, + uint8_t *sduP, + sdu_size_t sdu_lenP) { + + printf("DU_send_UL_RRC_MESSAGE_TRANSFER \n"); + F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; F1AP_ULRRCMessageTransferIEs_t *ie; @@ -185,7 +191,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ie->value.choice.GNB_DU_UE_F1AP_ID = F1AP_get_UE_identifier(module_idP, CC_idP, 0); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -204,8 +210,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ @@ -227,14 +232,13 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { } /* UL RRC Message Transfer */ -int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( - module_id_t module_idP, - int CC_idP, - int UE_id, - rnti_t rntiP, - uint8_t *sduP, - sdu_size_t sdu_lenP -) { +int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP, + uint8_t *sduP, + sdu_size_t sdu_lenP) { + F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransferIEs_t *ie; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index a841d7a7ba..87a94f651e 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -39,14 +39,16 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UL_RRC_MESSAGE_TRANSFER(void); +int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, + int CC_idP, + uint8_t *sduP, + sdu_size_t sdu_lenP); -int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( - module_id_t module_idP, - int CC_idP, - int UE_id, - rnti_t rntiP, - uint8_t *sduP, - sdu_size_t sdu_lenP); +int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP, + uint8_t *sduP, + sdu_size_t sdu_lenP); #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index b886d92783..10a3e77aa0 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -37,6 +37,8 @@ #include "assertions.h" +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; extern boolean_t pdcp_data_ind( const protocol_ctxt_t* const ctxt_pP, @@ -689,13 +691,40 @@ void rlc_data_ind ( else #endif /*UETARGET*/ { - pdcp_data_ind ( - ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_idP, - sdu_sizeP, - sdu_pP); + + switch (RC.rrc[ctxt_pP->module_id]->node_type){ + case ngran_eNB_CU : + case ngran_ng_eNB_CU : + case ngran_gNB_CU : + pdcp_data_ind ( + ctxt_pP, + 1, // srb_flagP, + 0, // MBMS_flagP, + rb_idP, + sdu_sizeP, + sdu_pP); + break; + case ngran_eNB_DU : + case ngran_gNB_DU : + DU_send_UL_RRC_MESSAGE_TRANSFER( + ctxt_pP->module_id, + rb_idP, + sdu_pP, + sdu_sizeP + ); + break; + + default: + pdcp_data_ind ( + ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, + sdu_sizeP, + sdu_pP); + break; + } + } } //----------------------------------------------------------------------------- -- GitLab From c8742f26fb720c097ad513f0ba6e462a9c52b201 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 18 Sep 2018 16:12:01 +0200 Subject: [PATCH 083/308] Normalized message output --- openair2/F1AP/f1ap_cu_interface_management.c | 45 +++++++--------- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 35 +++++------- openair2/F1AP/f1ap_cu_task.c | 10 ++-- openair2/F1AP/f1ap_cu_ue_context_management.c | 20 +------ openair2/F1AP/f1ap_decoder.c | 36 +++++++------ openair2/F1AP/f1ap_du_interface_management.c | 54 ++++++++----------- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 33 +++++------- openair2/F1AP/f1ap_du_task.c | 8 +-- openair2/F1AP/f1ap_du_ue_context_management.c | 17 +----- openair2/F1AP/f1ap_encoder.c | 11 +++- openair2/F1AP/f1ap_handlers.c | 2 +- openair2/F1AP/f1ap_itti_messaging.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 2 +- 13 files changed, 113 insertions(+), 162 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 0d55e8be1e..7198effdad 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -84,7 +84,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("CU_handle_F1_SETUP_REQUEST\n"); + LOG_D(CU_F1AP, "CU_handle_F1_SETUP_REQUEST\n"); MessageDef *message_p; F1AP_F1SetupRequest_t *container; @@ -112,7 +112,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_ID, true); asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &F1AP_SETUP_REQ(message_p).gNB_DU_id); - printf("F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); /* gNB_DU_name */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, @@ -122,13 +122,13 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ie->value.choice.GNB_DU_Name.size); /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; - printf ("F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); /* GNB_DU_Served_Cells_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); F1AP_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; - printf ("F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available); int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available; @@ -139,7 +139,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* tac */ OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); - printf ("F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); /* - nRCGI */ TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], @@ -150,11 +150,11 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // NR cellID BIT_STRING_TO_NR_CELL_IDENTITY(&served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity, F1AP_SETUP_REQ(message_p).nr_cellid[i]); - printf("[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, + LOG_D(CU_F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], F1AP_SETUP_REQ(message_p).nr_cellid[i]); - printf("nr_cellId : %x %x %x %x %x\n", + LOG_D(CU_F1AP, "nr_cellId : %x %x %x %x %x\n", served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2], @@ -162,7 +162,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]); /* - nRPCI */ F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI; - printf ("F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); // System Information /* mib */ @@ -172,7 +172,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size; - printf ("F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); /* sib1 */ F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); @@ -181,7 +181,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size; - printf ("F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); } @@ -294,7 +294,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate; - printf("num_cells_to_activate = %d \n", num_cells_to_activate); + LOG_D(CU_F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate); for (i=0; i<num_cells_to_activate; i++) { @@ -335,13 +335,13 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - printf("SI %d: "); - for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) printf("%2x ",f1ap_setup_resp->SI_container[i][0][n]); - printf("\n"); + LOG_D(CU_F1AP, "SI %d: "); + for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) LOG_D(CU_F1AP, "%2x ",f1ap_setup_resp->SI_container[i][0][n]); + LOG_D(CU_F1AP, "\n"); OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); - printf("f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); + LOG_D(CU_F1AP, "f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; @@ -362,24 +362,17 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - // printf("\n"); cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //printf("F1 setup response present = %d\n", out->value.present); - //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); return 0; } int CU_send_F1_SETUP_FAILURE(instance_t instance) { - printf("CU_send_F1_SETUP_FAILURE\n"); + LOG_D(CU_F1AP, "CU_send_F1_SETUP_FAILURE\n"); module_id_t enb_mod_idP; module_id_t cu_mod_idP; @@ -454,7 +447,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -858,7 +851,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index fdec30ff68..fad0ffc06e 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -59,7 +59,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); + LOG_D(CU_F1AP, "CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); // decode the F1 message // get the rrc message from the contauiner // call func rrc_eNB_decode_ccch: <-- needs some update here @@ -90,7 +90,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(CU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); /* NRCGI * TODO: process NRCGI @@ -117,9 +117,9 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); - printf ("RRCContainer(CCCH) :"); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - + LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_D(CU_F1AP, "\n"); // Find instance from nr_cellid int rrc_inst = -1; for (int i=0;i<RC.nb_inst;i++) { @@ -276,22 +276,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } -#ifdef F1AP_TEST - printf("\n"); - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - return -1; - } -#endif - cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id, buffer, len, 0); - return 0; } @@ -304,7 +294,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); + LOG_D(CU_F1AP, "CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); MessageDef *message_p; F1AP_ULRRCMessageTransfer_t *container; @@ -336,14 +326,14 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; - printf("cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(CU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); /* mandatory */ @@ -351,7 +341,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; - printf("srb_id %lu \n", srb_id); + LOG_D(CU_F1AP, "srb_id %lu \n", srb_id); // issue in here @@ -366,8 +356,9 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); - printf ("RRCContainer(CCCH) :"); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_D(CU_F1AP, "\n"); return 0; } diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 5da7dcba44..eeed466ceb 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -120,25 +120,25 @@ void *F1AP_CU_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case SCTP_NEW_ASSOCIATION_IND: - LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(CU_F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_NEW_ASSOCIATION_RESP: - LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(CU_F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_RESP for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: - LOG_I(CU_F1AP, "SCTP_DATA_IND for Instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(CU_F1AP, "CU Task Received SCTP_DATA_IND for Instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_SETUP_RESP: // from rrc - LOG_W(CU_F1AP, "F1AP_SETUP_RESP\n"); + LOG_I(CU_F1AP, "CU Task Received F1AP_SETUP_RESP\n"); // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), // &F1AP_SETUP_RESP(received_msg)); CU_send_F1_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), @@ -146,7 +146,7 @@ void *F1AP_CU_task(void *arg) { break; case F1AP_DL_RRC_MESSAGE: // from rrc - LOG_W(CU_F1AP, "F1AP_DL_RRC_MESSAGE\n"); + LOG_I(CU_F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), // &F1AP_SETUP_RESP(received_msg)); CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 3c11d09b1e..49398f91a1 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -356,18 +356,10 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - return -1; - } - //AssertFatal(1==0,"Not implemented yet\n"); return 0; } @@ -869,15 +861,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return -1; - } - - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 08816bd82b..1de0495ce5 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -33,33 +33,35 @@ #include "f1ap_common.h" #include "f1ap_decoder.h" +int asn1_decoder_xer_print = 1; + static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) { - MessageDef *message_p; - MessagesIds message_id; - asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + //MessageDef *message_p; + //MessagesIds message_id; + //asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; DevAssert(pdu != NULL); switch(pdu->choice.initiatingMessage->procedureCode) { case F1AP_ProcedureCode_id_F1Setup: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; case F1AP_ProcedureCode_id_DLRRCMessageTransfer: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; case F1AP_ProcedureCode_id_ULRRCMessageTransfer: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; // case F1AP_ProcedureCode_id_InitialContextSetup: // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); @@ -75,7 +77,7 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) default: // F1AP_ERROR("Unknown procedure ID (%d) for initiating message\n", // (int)pdu->choice.initiatingMessage->procedureCode); - printf("Unknown procedure ID (%d) for initiating message\n", + LOG_E(F1AP, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode); AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode); @@ -137,8 +139,12 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length, 0, 0); - - xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + + if (asn1_decoder_xer_print) { + LOG_E(F1AP, "----------------- ASN1 DECODER PRINT START----------------- \n"); + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_E(F1AP, "----------------- ASN1 DECODER PRINT END ----------------- \n"); + } //LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code); if (dec_ret.code != RC_OK) { @@ -157,7 +163,7 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t return f1ap_decode_unsuccessful_outcome(pdu); default: - LOG_D(F1AP, "Unknown presence (%d) or not implemented\n", (int)pdu->present); + LOG_E(F1AP, "Unknown presence (%d) or not implemented\n", (int)pdu->present); break; } diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 6bf5c211fc..58bdabe265 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -145,7 +145,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; int num_cells_available = f1ap_du_data->num_cells_available; - printf("num_cells_available = %d \n", num_cells_available); + LOG_D(DU_F1AP, "num_cells_available = %d \n", num_cells_available); for (i=0; i<num_cells_available; i++) { @@ -170,11 +170,11 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - nRCGI */ F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - printf("plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); + LOG_D(DU_F1AP, "plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); - printf("nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",f1ap_du_data->nr_cellid[i], + LOG_D(DU_F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",f1ap_du_data->nr_cellid[i], nRCGI.nRCellIdentity.buf[0], nRCGI.nRCellIdentity.buf[1], nRCGI.nRCellIdentity.buf[2], @@ -202,7 +202,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - broadcast PLMNs */ // RK: add the num_available_broadcast_PLMNs to the message int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs; - printf("num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); + LOG_D(DU_F1AP, "num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); for (j=0; j<num_available_broadcast_PLMNs; // num_available_broadcast_PLMNs j++) { @@ -235,7 +235,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.1.3 freqBandListNr */ int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands; - printf("fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); + LOG_D(DU_F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); int fdd_ul_j; for (fdd_ul_j=0; fdd_ul_j<fdd_ul_num_available_freq_Bands; @@ -248,7 +248,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.1.3.2 supportedSULBandList*/ int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; - printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); int fdd_ul_k; for (fdd_ul_k=0; fdd_ul_k<num_available_supported_SULBands; @@ -277,7 +277,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.2.3 freqBandListNr */ int fdd_dl_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_frequency_bands; - printf("fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); + LOG_D(DU_F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); int fdd_dl_j; for (fdd_dl_j=0; fdd_dl_j<fdd_dl_num_available_freq_Bands; @@ -290,7 +290,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.2.3.2 supportedSULBandList*/ int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; - printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); int fdd_dl_k; for (fdd_dl_k=0; fdd_dl_k<num_available_supported_SULBands; @@ -331,7 +331,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* TDD.1.3 freqBandListNr */ int tdd_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].tdd.num_frequency_bands; - printf("tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); + LOG_D(DU_F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); int j; for (j=0; j<tdd_num_available_freq_Bands; @@ -344,7 +344,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* TDD.1.3.2 supportedSULBandList*/ int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].tdd.num_sul_frequency_bands; - printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); int k; for (k=0; k<num_available_supported_SULBands; @@ -399,7 +399,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -414,7 +414,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, F1AP_F1AP_PDU_t *pdu) { - printf("DU_handle_F1_SETUP_RESPONSE\n"); + LOG_D(DU_F1AP, "DU_handle_F1_SETUP_RESPONSE\n"); AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome, "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); @@ -435,7 +435,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, F1AP_SETUP_RESP); - printf("F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); for (int i=0;i < in->protocolIEs.list.count; i++) { ie = in->protocolIEs.list.array[i]; @@ -446,7 +446,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID, "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); TransactionId=ie->value.choice.TransactionID; - printf("F1AP: F1Setup-Resp: TransactionId %d\n", + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n", TransactionId); break; case F1AP_ProtocolIE_ID_id_gNB_CU_Name: @@ -457,7 +457,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size); F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0'; - printf("F1AP: F1Setup-Resp: gNB_CU_name %s\n", + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", F1AP_SETUP_RESP (msg_p).gNB_CU_name); break; case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: @@ -466,7 +466,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List, "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n"); num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; - printf("F1AP: Activating %d cells\n",num_cells_to_activate); + LOG_D(DU_F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); for (int i=0;i<num_cells_to_activate;i++) { F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = ie->value.choice.Cells_to_be_Activated_List.list.array[i]; @@ -482,7 +482,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], F1AP_SETUP_RESP (msg_p).mnc_digit_length[i]); AssertFatal(cell->nRPCI != NULL, "nRPCI is null\n"); - printf("nr_cellId : %x %x %x %x %x\n", + LOG_D(DU_F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], cell->nRCGI.nRCellIdentity.buf[2], @@ -496,11 +496,11 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ext!=NULL,"Extension for SI is null\n"); F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - printf("F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %x num_si %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nr_cellid[i],F1AP_SETUP_RESP (msg_p).num_SI[i]); + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %x num_si %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nr_cellid[i],F1AP_SETUP_RESP (msg_p).num_SI[i]); for (int si =0;si < ext->list.count;si++) { size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; - printf("F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size); + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size); F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si], @@ -519,7 +519,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(F1AP_SETUP_RESP (msg_p).num_SI[i] > 0, "System Information %d is missing",i); - printf("Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", + LOG_D(DU_F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); @@ -600,7 +600,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - printf("nr_cellId : %x %x %x %x %x\n", + LOG_D(DU_F1AP, "nr_cellId : %x %x %x %x %x\n", nRCGI.nRCellIdentity.buf[0], nRCGI.nRCellIdentity.buf[1], nRCGI.nRCellIdentity.buf[2], @@ -975,17 +975,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return -1; - } - - printf("\n"); - - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index b539ae5cd1..4a6f28e3dc 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -49,7 +49,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); + LOG_D(DU_F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); MessageDef *message_p; F1AP_DLRRCMessageTransfer_t *container; @@ -81,14 +81,14 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; - printf("cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + LOG_D(DU_F1AP, "cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); /* optional */ @@ -103,7 +103,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; - printf("srb_id %lu \n", srb_id); + LOG_D(DU_F1AP, "srb_id %lu \n", srb_id); /* optional */ @@ -112,7 +112,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); executeDuplication = ie->value.choice.ExecuteDuplication; - printf("ExecuteDuplication %d \n", executeDuplication); + LOG_D(DU_F1AP, "ExecuteDuplication %d \n", executeDuplication); } // issue in here @@ -127,9 +127,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); - printf ("RRCContainer(CCCH) :"); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - + LOG_D(DU_F1AP, "RRCContainer(CCCH) :"); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(DU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_D(DU_F1AP, "\n"); /* optional */ /* RAT_FrequencyPriorityInformation */ @@ -157,7 +157,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, uint8_t *sduP, sdu_size_t sdu_lenP) { - printf("DU_send_UL_RRC_MESSAGE_TRANSFER \n"); + LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; @@ -215,19 +215,10 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //AssertFatal(1==0,"Not implemented yet\n"); - return 0; } @@ -238,7 +229,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, rnti_t rntiP, uint8_t *sduP, sdu_size_t sdu_lenP) { - + F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransferIEs_t *ie; @@ -313,7 +304,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 5edcf01437..3f99810a22 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -69,7 +69,7 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1 *f1ap_du_data = *f1ap_setup_req; //printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]); - printf("nr_cellid : %llx (%lld)",f1ap_setup_req->nr_cellid[0],f1ap_setup_req->nr_cellid[0]); + //printf("nr_cellid : %llx (%lld)",f1ap_setup_req->nr_cellid[0],f1ap_setup_req->nr_cellid[0]); //du_f1ap_register_to_sctp itti_send_msg_to_task(TASK_SCTP, instance, message_p); @@ -139,7 +139,7 @@ void *F1AP_DU_task(void *arg) { // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req - LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n"); + LOG_I(DU_F1AP, "DU Task Received F1AP_SETUP_REQ\n"); du_task_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg)); break; @@ -147,14 +147,14 @@ void *F1AP_DU_task(void *arg) { case SCTP_NEW_ASSOCIATION_RESP: // 1. store the respon // 2. send the f1setup_req - LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); + LOG_I(DU_F1AP, "DU Task Received SCTP_NEW_ASSOCIATION_RESP\n"); du_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here - LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); + LOG_I(DU_F1AP, "DU Task Received SCTP_DATA_IND\n"); du_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index c81c47723c..d4d1020206 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -298,17 +298,10 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); return 0; } @@ -688,16 +681,10 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); return 0; diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index 355e52ad95..248c61fcf5 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -33,6 +33,8 @@ #include "f1ap_common.h" #include "f1ap_encoder.h" +int asn1_encoder_xer_print = 1; + /* static inline int f1ap_encode_initiating(f1ap_message *message, uint8_t **buffer, @@ -76,14 +78,21 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) DevAssert(buffer != NULL); DevAssert(length != NULL); - xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + if (asn1_encoder_xer_print) { + LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT START ----------------- \n"); + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT END----------------- \n"); + } + encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); if (encoded < 0) { LOG_E(F1AP, "Failed to encode F1AP message\n"); return -1; } + *length = encoded; + /* Is the following needed? I moved the code here from CU_F1AP.c/DU_F1AP.c */ // ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu); return encoded; diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 168f6deaa9..ef0b6d1f5c 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -117,7 +117,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Calling the right handler */ - printf("Calling handler with instance %d\n",instance); + LOG_I(DU_F1AP, "Calling handler with instance %d\n",instance); ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index 1f0f84017e..fa8951536a 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -55,7 +55,7 @@ void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint sctp_data_req->buffer_length = buffer_length; sctp_data_req->stream = stream; - printf("Sending ITTI message to SCTP Task\n"); + LOG_I(F1AP, "Sending ITTI message to SCTP Task\n"); itti_send_msg_to_task(TASK_SCTP, instance, message_p); } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 9e118fecbb..8056177123 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5775,7 +5775,7 @@ rrc_eNB_generate_RRCConnectionSetup( F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; itti_send_msg_to_task (TASK_CU_F1, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); - LOG_E(RRC, "F1AP_DL_RRC_MESSAGE\n"); + LOG_D(RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); break; case ngran_eNB_DU : case ngran_gNB_DU : -- GitLab From d9661177fa9ef01394bff749c39e832c2b18488c Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Wed, 19 Sep 2018 02:01:08 +0200 Subject: [PATCH 084/308] Better management of cu/du ue ids Fix for some variables --- openair2/COMMON/f1ap_messages_types.h | 1 + openair2/F1AP/f1ap_common.c | 155 ++++++++++++++++++- openair2/F1AP/f1ap_common.h | 61 +++++++- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 51 +++--- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 47 ++++-- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 6 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 2 +- openair2/LAYER2/RLC/rlc.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 3 +- 9 files changed, 277 insertions(+), 51 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 1c1fe6ed42..9725431906 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -211,6 +211,7 @@ typedef struct f1ap_dl_rrc_message_s { uint32_t gNB_CU_ue_id; uint32_t gNB_DU_ue_id; uint32_t old_gNB_DU_ue_id; + uint16_t rnti; uint8_t srb_id; uint8_t execute_duplication; uint8_t *rrc_container; diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index a5ad507901..f00b159e12 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -209,9 +209,160 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ return transaction_identifier[enb_mod_idP+cu_mod_idP]; } -uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { - static uint8_t UE_identifier[NUMBER_OF_eNB_MAX]; +module_id_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { + static module_id_t UE_identifier[NUMBER_OF_eNB_MAX]; UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER; //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]); return UE_identifier[enb_mod_idP+CC_idP+UE_id]; +} + +int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + f1_ue_inst->f1ap_uid[i] = i; + f1_ue_inst->mac_uid[i] = UE_id; + LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_ue_inst->rnti[i], f1_ue_inst->du_ue_f1ap_id[i]); + return i; + } + } + for (i=0; i < MAX_MOBILES_PER_ENB ; i++){ + if (f1_ue_inst->rnti[i] == 0 ){ + f1_ue_inst->rnti[i]=rntiP; + f1_ue_inst->f1ap_uid[i]=i; + f1_ue_inst->mac_uid[i]=UE_id; + f1_ue_inst->du_ue_f1ap_id[i] = F1AP_get_UE_identifier(module_idP, CC_idP, i); + f1_ue_inst->cu_ue_f1ap_id[i] = F1AP_get_UE_identifier(module_idP, CC_idP, i); + f1_ue_inst->num_ues++; + LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %d\n", f1_ue_inst->rnti[i], f1_ue_inst->du_ue_f1ap_id[i]); + return i; + } + } + return -1; +} + + +int f1ap_remove_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + f1_ue_inst->rnti[i] = 0; + break; + } + } + return 0 ; +} + +int f1ap_get_du_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + return f1_ue_inst->du_ue_f1ap_id[i]; + } + } + return -1; +} + +int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + return f1_ue_inst->cu_ue_f1ap_id[i]; + } + } + return -1; +} + +int f1ap_get_rnti_by_du_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->du_ue_f1ap_id[i] == du_ue_f1ap_id) { + return f1_ue_inst->rnti[i]; + } + } + return -1; +} + +int f1ap_get_rnti_by_cu_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->cu_ue_f1ap_id[i] == cu_ue_f1ap_id) { + return f1_ue_inst->rnti[i]; + } + } + return -1; +} + +int f1ap_get_du_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->du_ue_f1ap_id[i] == du_ue_f1ap_id) { + return i; + } + } + return -1; +} + + +int f1ap_get_cu_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->cu_ue_f1ap_id[i] == cu_ue_f1ap_id) { + return i; + } + } + return -1; +} + +int f1ap_get_uid_by_rnti(f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + return i; + } + } + return -1; +} + +int f1ap_du_add_cu_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id, + module_id_t cu_ue_f1ap_id){ + module_id_t f1ap_uid = f1ap_get_du_uid(f1_ue_inst,du_ue_f1ap_id); + if (f1ap_uid < 0 ) + return -1 ; + f1_ue_inst->cu_ue_f1ap_id[f1ap_uid]=cu_ue_f1ap_id; + LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x \n", cu_ue_f1ap_id, f1_ue_inst->rnti[f1ap_uid]); + return 0 ; +} + +int f1ap_cu_add_du_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id, + module_id_t du_ue_f1ap_id){ + module_id_t f1ap_uid = f1ap_get_cu_uid(f1_ue_inst,cu_ue_f1ap_id); + if (f1ap_uid < 0 ) + return -1 ; + f1_ue_inst->du_ue_f1ap_id[f1ap_uid]=du_ue_f1ap_id; + LOG_I(F1AP, "Adding du_ue_f1ap_id %d for UE with RNTI %x \n", du_ue_f1ap_id, f1_ue_inst->rnti[f1ap_uid]); + return 0 ; } \ No newline at end of file diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 384f261de2..8cd53fbef6 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -425,8 +425,67 @@ typedef int (*f1ap_message_decoded_callback)( F1AP_F1AP_PDU_t *message_p ); +// instance and module_id are assumed to be the same +typedef struct f1ap_cudu_ue_inst_s { + // used for eNB stats generation + rnti_t rnti[MAX_MOBILES_PER_ENB]; + module_id_t f1ap_uid[MAX_MOBILES_PER_ENB]; + module_id_t mac_uid[MAX_MOBILES_PER_ENB]; + module_id_t du_ue_f1ap_id[MAX_MOBILES_PER_ENB]; + module_id_t cu_ue_f1ap_id[MAX_MOBILES_PER_ENB]; + + + uint16_t num_ues; + +} f1ap_cudu_ue_inst_t; + + uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP); -uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id); +module_id_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id); + + + +int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP); + +int f1ap_remove_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP); + +int f1ap_get_du_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP); + +int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP); + + + +int f1ap_get_rnti_by_du_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id ); + + +int f1ap_get_rnti_by_cu_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id ); + + +int f1ap_get_du_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id ); + +int f1ap_get_cu_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id ); + +int f1ap_get_uid_by_rnti(f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP ); + +int f1ap_du_add_cu_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id, + module_id_t cu_ue_f1ap_id); + +int f1ap_cu_add_du_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id, + module_id_t du_ue_f1ap_id); #endif /* F1AP_COMMON_H_ */ diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index fad0ffc06e..802cd167a2 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -44,10 +44,15 @@ // a compile error #undef C_RNTI + // Bing Kai: create CU and DU context, and put all the information there. uint64_t du_ue_f1ap_id = 0; uint32_t f1ap_assoc_id = 0; uint32_t f1ap_stream = 0; + + +f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; + /* Initial UL RRC Message Transfer */ @@ -132,6 +137,14 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %ll\n",nr_cellid); + int f1ap_uid = f1ap_add_ue(&f1ap_cu_ue[rrc_inst], rrc_inst, CC_id, 0, rnti); + if (f1ap_uid < 0 ) { + LOG_E(CU_F1AP, "Failed to add UE \n"); + return -1; + } + f1ap_cu_ue[rrc_inst].du_ue_f1ap_id[f1ap_uid] = du_ue_f1ap_id; + + RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; @@ -141,32 +154,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); - // OR creat the ctxt and srb_info struct required by rrc_eNB_decode_ccch -/* - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - instance, // to fix - ENB_FLAG_YES, - rnti, - 0, // frame - 0); // slot - - CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; - srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; - - if (ccch_sdu_len >= RRC_BUFFER_SIZE_MAX) { - LOG_E(RRC, "CCCH message has size %d > %d\n",ccch_sdu_len,RRC_BUFFER_SIZE_MAX); - break; - } - memcpy(srb_info_p->Rx_buffer.Payload, - ccch_sdu, - ccch_sdu_len); - srb_info->Rx_buffer.payload_size = ccch_sdu_len; - - rrc_eNB_decode_ccch(&ctxt, srb_info, CC_id); - */ - // if size > 0 - // CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size) - return 0; } @@ -204,8 +191,11 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_dl_rrc->gNB_CU_ue_id; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + LOG_I(CU_F1AP, "Setting GNB_CU_UE_F1AP_ID %d associated with UE RNTI %x (instance %d)\n", + ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); + /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ @@ -213,8 +203,9 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); //f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + LOG_I(CU_F1AP, "GNB_DU_UE_F1AP_ID %d associated with UE RNTI %x \n", ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti); /* optional */ /* c3. oldgNB_DU_UE_F1AP_ID */ @@ -326,14 +317,14 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; - LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu associated with RNTI %x \n", cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id)); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(CU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(CU_F1AP, "du_ue_f1ap_id %lu associated with RNTI %x \n", du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],du_ue_f1ap_id)); /* mandatory */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 4a6f28e3dc..9149607e96 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -35,6 +35,7 @@ #include "f1ap_decoder.h" #include "f1ap_itti_messaging.h" #include "f1ap_du_rrc_message_transfer.h" + // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which // replaces in ie->value.choice.C_RNTI, causing @@ -43,6 +44,11 @@ extern f1ap_setup_req_t *f1ap_du_data; + +f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; + + + /* DL RRC Message Transfer */ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, @@ -88,9 +94,13 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); - + LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); // this should be the one transmitted via initial ul rrc message transfer + if (f1ap_du_add_cu_ue_id(&f1ap_du_ue[instance],du_ue_f1ap_id,cu_ue_f1ap_id) < 0 ) { + LOG_E(DU_F1AP, "Failed to find the F1AP UID \n"); + //return -1; + } + /* optional */ /* oldgNB_DU_UE_F1AP_ID */ if (0) { @@ -105,7 +115,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, srb_id = ie->value.choice.SRBID; LOG_D(DU_F1AP, "srb_id %lu \n", srb_id); - /* optional */ /* ExecuteDuplication */ if (0) { @@ -122,7 +131,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_RRCContainer, true); // BK: need check // create an ITTI message and copy SDU - message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_DU_F1, RRC_MAC_CCCH_DATA_IND); memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, @@ -152,10 +161,10 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } //void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, - int CC_idP, - uint8_t *sduP, - sdu_size_t sdu_lenP) { +int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, + rb_id_t srb_idP, + uint8_t *sduP, + sdu_size_t sdu_lenP) { LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); @@ -182,7 +191,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -191,7 +200,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = F1AP_get_UE_identifier(module_idP, CC_idP, 0); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -200,7 +209,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_SRBID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = 1; + ie->value.choice.SRBID = srb_idP; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); // issue in here @@ -236,6 +245,12 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, uint8_t *buffer; uint32_t len; + int f1ap_uid = f1ap_add_ue (&f1ap_du_ue[module_idP], module_idP, CC_idP,UE_id, rntiP); + + if (f1ap_uid < 0 ) { + LOG_E(DU_F1AP, "Failed to add UE \n"); + return -1; + } /* Create */ /* 0. Message Type */ @@ -254,7 +269,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = F1AP_get_UE_identifier(module_idP, CC_idP, UE_id); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[module_idP].du_ue_f1ap_id[f1ap_uid]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -311,3 +326,11 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); return 0; } + + +void init_f1ap_du_ue_inst (void) { + + memset(f1ap_du_ue, 0, sizeof(f1ap_du_ue)); +} + + diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 87a94f651e..e0f2f8f71f 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -39,9 +39,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, - int CC_idP, - uint8_t *sduP, +int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, + rb_id_t srb_idP, + uint8_t *sduP, sdu_size_t sdu_lenP); int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index f07419d3ca..4f1b7f3d00 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -1135,7 +1135,7 @@ void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP){ pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti; pdcp_enb[ctxt_pP->module_id].uid[i]=i; pdcp_enb[ctxt_pP->module_id].num_ues++; - printf("add new uid is %d %x\n\n", i, ctxt_pP->rnti); + LOG_I(PDCP,"add new uid is %d %x\n\n", i, ctxt_pP->rnti); // ret=1; break; } diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 10a3e77aa0..d40fc99e13 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -707,7 +707,7 @@ void rlc_data_ind ( case ngran_eNB_DU : case ngran_gNB_DU : DU_send_UL_RRC_MESSAGE_TRANSFER( - ctxt_pP->module_id, + ctxt_pP, rb_idP, sdu_pP, sdu_sizeP diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 8056177123..720c23ce9d 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5771,10 +5771,11 @@ rrc_eNB_generate_RRCConnectionSetup( F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti; F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH; F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; - itti_send_msg_to_task (TASK_CU_F1, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); LOG_D(RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); break; case ngran_eNB_DU : -- GitLab From de205def25127dda29baaaa95b652a36a85e9ce3 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Wed, 19 Sep 2018 10:46:36 +0200 Subject: [PATCH 085/308] added configuration of DU L2 functions upon RRCConnectionSetup reception --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 108 +++++++++++++++++-- 1 file changed, 101 insertions(+), 7 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index b66921526e..ffabf3f3e3 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -40,6 +40,10 @@ #include "DL-CCCH-Message.h" #include "DL-DCCH-Message.h" +// for SRB1_logicalChannelConfig_defaultValue +#include "rrc_extern.h" +#include "common/ran_context.h" + // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which // replaces in ie->value.choice.C_RNTI, causing @@ -48,6 +52,7 @@ #undef C_RNTI extern f1ap_setup_req_t *f1ap_du_data; +extern RAN_CONTEXT_t RC; /* DL RRC Message Transfer */ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, @@ -73,7 +78,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint64_t rAT_FrequencySelectionPriority; DevAssert(pdu != NULL); - + if (stream != 0) { LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", assoc_id, stream); @@ -186,18 +191,107 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, break; case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n"); - // Get configuration - - break; + { + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n", (rnti_t)du_ue_f1ap_id); + // Get configuration + + // find rrc instance and ue_context for this UE + /* + eNB_RRC_INST *rrc; + rrc_eNB_ue_context_t *ue_context_pP = NULL; + for (int i = 0; i<RC.nb_inst; i++) { + rrc = RC.rrc[i]; + // note this requires that du_ue_f1ap_id == RNTI! + ue_context_pP = rrc_eNB_get_ue_context(rrc,(rnti_t)du_ue_f1ap_id); + if (ue_context_pP != NULL) break; + } + AssertFatal(ue_context_pP != NULL, "no UE context found!\n"); + */ + + // find MACRLC instance based on RNTI/UE_DU_ID + int macrlc_instance=-1; + + for (macrlc_instance=0;macrlc_instance<RC.nb_macrlc_inst;macrlc_instance++) + if (find_UE_id(macrlc_instance,du_ue_f1ap_id)>=0) break; + + AssertFatal(macrlc_instance>=0,"cannot find macrlc instance for ue\n"); + + RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; + // eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); + RadioResourceConfigDedicated_t* radioResourceConfigDedicated = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated; + + // get SRB logical channel information + SRB_ToAddModList_t *SRB_configList; + SRB_ToAddMod_t *SRB1_config; + LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + SRB_configList = radioResourceConfigDedicated->srb_ToAddModList; + + AssertFatal(SRB_configList!=NULL,"SRB_configList is null\n"); + for (int cnt = 0; cnt < (SRB_configList)->list.count; cnt++) { + if ((SRB_configList)->list.array[cnt]->srb_Identity == 1) { + SRB1_config = (SRB_configList)->list.array[cnt]; + + if (SRB1_config->logicalChannelConfig) { + if (SRB1_config->logicalChannelConfig->present == + SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + + + } + } + + rrc_mac_config_req_eNB( + macrlc_instance, + 0, //primaryCC_id, + 0,0,0,0,0, +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, +#endif + (rnti_t) du_ue_f1ap_id, //rnti + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (RadioResourceConfigCommonSIB_t *) NULL, +#endif + radioResourceConfigDedicated->physicalConfigDedicated, +#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + radioResourceConfigDedicated->mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + NULL, // measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL +#endif + ); + break; default: AssertFatal(1==0, "Unknown message\n"); break; - } + } + } } else if (srb_id == 1){ -- GitLab From c19bdb776f538f549a8df312ecc369bf6b666ecd Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 18 Sep 2018 15:11:37 +0200 Subject: [PATCH 086/308] add UE Context Setup Req at CU/DU - add message sender (CU) + handler (CU) and fill with data from ITTI message - add PLMNID_TO_MCC_MNC and BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4 macros - correct TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING: change name to TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING, make it send 4B, not 5 --- openair2/COMMON/f1ap_messages_def.h | 1 + openair2/COMMON/f1ap_messages_types.h | 32 +++++- openair2/F1AP/f1ap_cu_interface_management.c | 12 +-- openair2/F1AP/f1ap_cu_ue_context_management.c | 102 ++++++++++-------- openair2/F1AP/f1ap_cu_ue_context_management.h | 3 +- openair2/F1AP/f1ap_du_ue_context_management.c | 93 +++++++++++++++- openair3/UTILS/conversions.h | 45 +++++--- 7 files changed, 214 insertions(+), 74 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index f08a9534d4..80da410fac 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -39,6 +39,7 @@ MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_r /* RRC -> F1AP messages */ MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message ) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req ) +MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_req) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 9725431906..d133aab66e 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef F1AP_MESSAGES_TYPES_H_ #define F1AP_MESSAGES_TYPES_H_ +#include "rlc.h" + //-------------------------------------------------------------------------------------------// // Defines to access message fields. @@ -33,6 +35,7 @@ #define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message #define F1AP_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ul_rrc_message +#define F1AP_UE_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_setup_req #define F1AP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_resp #define F1AP_UE_CONTEXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_resp #define F1AP_UE_CONTEXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_fail @@ -249,8 +252,31 @@ typedef struct f1ap_ul_rrc_message_s { int rrc_container_length; } f1ap_ul_rrc_message_t; -/*typedef struct f1ap_ue_context_setup_req_s { - - } f1ap_ue_context_setup_req_t;*/ +typedef struct f1ap_up_tnl_s { + in_addr_t tl_address; // currently only IPv4 supported + uint32_t gtp_teid; +} f1ap_up_tnl_t; + +typedef struct f1ap_drb_to_be_setup_s { + uint8_t drb_id; + f1ap_up_tnl_t up_ul_tnl[2]; + uint8_t up_ul_tnl_length; + rlc_mode_t rlc_mode; +} f1ap_drb_to_be_setup_t; + +typedef struct f1ap_ue_context_setup_req_s { + uint32_t gNB_CU_ue_id; + uint32_t *gNB_DU_ue_id; + // SpCell Info + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + uint64_t nr_cellid; + uint32_t servCellId; + uint8_t *cu_to_du_rrc_information; + uint8_t cu_to_du_rrc_information_length; + f1ap_drb_to_be_setup_t *drbs_to_be_setup; + uint8_t drbs_to_be_setup_length; +} f1ap_ue_context_setup_req_t; #endif /* F1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 7198effdad..75f59c837a 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -633,12 +633,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ F1AP_CP_TransportLayerAddress_t transportLayerAddress; memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); - // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress; @@ -680,12 +680,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ F1AP_CP_TransportLayerAddress_t transportLayerAddress; memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); - // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress; @@ -722,12 +722,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ F1AP_CP_TransportLayerAddress_t transportLayerAddress; memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); - // TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); + // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 49398f91a1..82f97e4758 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -36,20 +36,17 @@ #include "f1ap_itti_messaging.h" #include "f1ap_cu_ue_context_management.h" -//void CU_send_UE_CONTEXT_SETUP_REQUEST(F1AP_UEContextSetupRequest_t *UEContextSetupRequest) { -int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { +extern f1ap_setup_req_t *f1ap_du_data_from_du; + +int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextSetupRequest_t *out; F1AP_UEContextSetupRequestIEs_t *ie; uint8_t *buffer; uint32_t len; - int i = 0; - - // for test - int mcc = 208; - int mnc = 93; - int mnc_digit_length = 8; + int i = 0, j = 0; /* Create */ /* 0. Message Type */ @@ -67,17 +64,17 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ /* c2. GNB_DU_UE_F1AP_ID */ - if (0) { + if (f1ap_ue_context_setup_req->gNB_DU_ue_id) { ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -89,9 +86,11 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI; /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, + f1ap_ue_context_setup_req->mnc, + f1ap_ue_context_setup_req->mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_ue_context_setup_req->nr_cellid, &nRCGI.nRCellIdentity); ie->value.choice.NRCGI = nRCGI; @@ -141,7 +140,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; for (i=0; - i<1; + i<0; i++) { F1AP_Candidate_SpCell_ItemIEs_t *candidate_spCell_item_ies; @@ -156,9 +155,12 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { /* - candidate_SpCell_ID */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); + /* TODO add correct mcc/mnc */ + MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, + f1ap_ue_context_setup_req->mnc, + f1ap_ue_context_setup_req->mnc_digit_length, + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_ue_context_setup_req->nr_cellid, &nRCGI.nRCellIdentity); candidate_spCell_item.candidate_SpCell_ID = nRCGI; @@ -198,7 +200,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { ie->value.choice.ResourceCoordinationTransferContainer.buf = malloc(4); ie->value.choice.ResourceCoordinationTransferContainer.size = 4; - *ie->value.choice.ResourceCoordinationTransferContainer.buf = "123"; + strncpy(ie->value.choice.ResourceCoordinationTransferContainer.buf, "123", 3); OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", @@ -215,7 +217,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; for (i=0; - i<1; + i<0; i++) { // F1AP_SCell_ToBeSetup_ItemIEs_t *scell_toBeSetup_item_ies; @@ -230,8 +232,11 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { // /* - sCell_ID */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); + /* TODO correct MCC/MNC */ + MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, + f1ap_ue_context_setup_req->mnc, + f1ap_ue_context_setup_req->mnc_digit_length, + &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); scell_toBeSetup_item.sCell_ID = nRCGI; @@ -254,7 +259,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; for (i=0; - i<1; + i<0; i++) { // F1AP_SRBs_ToBeSetup_ItemIEs_t *srbs_toBeSetup_item_ies; @@ -284,9 +289,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; - for (i=0; - i<1; - i++) { + for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; i++) { // F1AP_DRBs_ToBeSetup_ItemIEs_t *drbs_toBeSetup_item_ies; drbs_toBeSetup_item_ies = (F1AP_DRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetup_ItemIEs_t)); @@ -299,7 +302,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { memset((void *)&drbs_toBeSetup_item, 0, sizeof(F1AP_DRBs_ToBeSetup_Item_t)); /* dRBID */ - drbs_toBeSetup_item.dRBID = 30L; + drbs_toBeSetup_item.dRBID = f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id; /* qoSInformation */ drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; @@ -307,30 +310,35 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; /* ULTunnels_ToBeSetup_List */ - int maxnoofULTunnels = 1; // 2; - for (i=0; - i<maxnoofULTunnels; - i++) { - /* ULTunnels_ToBeSetup_Item */ - F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; + for (j = 0; j < f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl_length; j++) { + f1ap_up_tnl_t *up_tnl = &f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j]; + /* ULTunnels_ToBeSetup_Item */ + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; - // gTPTunnel - uLUPTNLInformation_ToBeSetup_Item = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + // gTPTunnel + uLUPTNLInformation_ToBeSetup_Item = calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = + F1AP_UPTransportLayerInformation_PR_gTPTunnel; + F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(up_tnl->tl_address, &gTPTunnel->transportLayerAddress); - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1234", - strlen("1234")); - - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + INT32_TO_OCTET_STRING(up_tnl->gtp_teid, &gTPTunnel->gTP_TEID); + + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); + ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); } /* rLCMode */ - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; // enum + /* TODO use rlc_mode from f1ap_drb_to_be_setup */ + switch (f1ap_ue_context_setup_req->drbs_to_be_setup[i].rlc_mode) { + case RLC_MODE_AM: + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_am; + break; + default: + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; + } /* OPTIONAL */ /* ULConfiguration */ @@ -445,7 +453,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* optional */ /* c3. NRCGI */ - if (1) { + if (0) { ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; ie->criticality = F1AP_Criticality_ignore; @@ -703,7 +711,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "4567", strlen("4567")); @@ -771,7 +779,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h index f103a17073..9e25309aa9 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.h +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -36,7 +36,8 @@ /* * UE Context Setup */ -int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance); +int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req); int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index d4d1020206..76aa4299a1 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -41,8 +41,91 @@ extern f1ap_setup_req_t *f1ap_du_data; int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + F1AP_F1AP_PDU_t *pdu) +{ + MessageDef *msg_p; // message to RRC + F1AP_UEContextSetupRequest_t *container; + F1AP_UEContextSetupRequestIEs_t *ie; + int i; + + DevAssert(pdu); + + msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; + f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); + + container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; + + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, false); + if (ie) { + f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); + if (f1ap_ue_context_setup_req->gNB_DU_ue_id) + *f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + } else { + f1ap_ue_context_setup_req->gNB_DU_ue_id = NULL; + } + + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SpCell_ID, true); + PLMNID_TO_MCC_MNC(&ie->value.choice.NRCGI.pLMN_Identity, + f1ap_ue_context_setup_req->mcc, + f1ap_ue_context_setup_req->mnc, + f1ap_ue_context_setup_req->mnc_digit_length); + BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); + + /* TODO: decode candidate SpCell */ + + /* TODO: decode CUtoDURRCInformation */ + + /* TODO: Candidate_SpCell_List */ + + /* TODO: SCell_ToBeSetup_List */ + + /* TODO: SRBs_ToBeSetup_List */ + + /* Decode DRBs_ToBeSetup_List */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); + f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, + sizeof(f1ap_drb_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, + "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { + f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; + F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; + drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; + + drb_p->drb_id = drbs_tobesetup_item_p->dRBID; + + /* TODO in the following, assume only one UP UL TNL is present. + * this matches/assumes OAI CU implementation, can be up to 2! */ + drb_p->up_ul_tnl_length = 1; + AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, + "no UL UP TNL Information in DRBs to be Setup list\n"); + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; + F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; + BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); + OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid); + + switch (drbs_tobesetup_item_p->rLCMode) { + case F1AP_RLCMode_rlc_am: + drb_p->rlc_mode = RLC_MODE_AM; + break; + default: + drb_p->rlc_mode = RLC_MODE_TM; + break; + } + } + + AssertFatal(0, "check configuration, send to appropriate handler\n"); + + return 0; } //void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { @@ -153,7 +236,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { // *transportLayerAddress.buf = 123; // dLUPTNLInformation_ToBeSetup_Item.dL_GTP_Tunnel_EndPoint.transportLayerAddress = transportLayerAddress; - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); @@ -441,7 +524,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); @@ -495,7 +578,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index 71ca1616fd..e2773aeedf 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -196,6 +196,17 @@ do { \ (oCTETsTRING)->size = 3; \ } while(0) +#define PLMNID_TO_MCC_MNC(oCTETsTRING, mCC, mNC, mNCdIGITlENGTH) \ +do { \ + mCC = ((oCTETsTRING)->buf[0] & 0x0F) * 100 + \ + ((oCTETsTRING)->buf[0] >> 4 & 0x0F) * 10 + \ + ((oCTETsTRING)->buf[1] & 0x0F); \ + mNCdIGITlENGTH = ((oCTETsTRING)->buf[1] >> 4 & 0x0F) == 0xF ? 2 : 3; \ + mNC = (mNCdIGITlENGTH == 2 ? 0 : ((oCTETsTRING)->buf[1] >> 4 & 0x0F) * 100) + \ + ((oCTETsTRING)->buf[2] & 0x0F) * 10 + \ + ((oCTETsTRING)->buf[2] >> 4 & 0x0F); \ +} while (0) + #define MCC_MNC_TO_TBCD(mCC, mNC, mNCdIGITlENGTH, tBCDsTRING) \ do { \ char _buf[3]; \ @@ -260,7 +271,7 @@ do { \ /* TS 38.473 v15.2.1 section 9.3.1.32: - * C RNTI + * C RNTI is BIT_STRING(16) */ #define C_RNTI_TO_BIT_STRING(mACRO, bITsTRING) \ do { \ @@ -272,21 +283,31 @@ do { \ } while(0) -/* TS 38.473 v15.1.1 section 9.3.2.1: - * TRANSPORT LAYER ADDRESS +/* TS 38.473 v15.1.1 section 9.3.2.3: + * TRANSPORT LAYER ADDRESS for IPv4 is 32bit (TS 38.414) */ -#define TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(mACRO, bITsTRING) \ +#define TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(mACRO, bITsTRING) \ do { \ - (bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \ - (bITsTRING)->buf[0] = (mACRO) >> 28; \ - (bITsTRING)->buf[1] = (mACRO) >> 20; \ - (bITsTRING)->buf[2] = (mACRO) >> 12; \ - (bITsTRING)->buf[3] = (mACRO) >> 4; \ - (bITsTRING)->buf[4] = ((mACRO) & 0x0f) << 4; \ - (bITsTRING)->size = 5; \ - (bITsTRING)->bits_unused = 4; \ + (bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \ + (bITsTRING)->buf[0] = (mACRO) >> 24 & 0xFF; \ + (bITsTRING)->buf[1] = (mACRO) >> 16 & 0xFF; \ + (bITsTRING)->buf[2] = (mACRO) >> 8 & 0xFF; \ + (bITsTRING)->buf[3] = (mACRO) >> 4 & 0xFF; \ + (bITsTRING)->size = 4; \ + (bITsTRING)->bits_unused = 0; \ } while(0) +#define BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(bITsTRING, mACRO) \ +do { \ + DevCheck((bITsTRING)->size == 4, (bITsTRING)->size, 4, 0); \ + DevCheck((bITsTRING)->bits_unused == 0, (bITsTRING)->bits_unused, 0, 0); \ + mACRO = ((bITsTRING)->buf[0] << 24) + \ + ((bITsTRING)->buf[1] << 16) + \ + ((bITsTRING)->buf[2] << 8) + \ + ((bITsTRING)->buf[3]); \ +} while (0) + + /* TS 38.473 v15.1.1 section 9.3.1.12: * NR CELL ID */ -- GitLab From cf55a513d910d84355580aa94cb9295a7ea5fa9c Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 18 Sep 2018 18:05:03 +0200 Subject: [PATCH 087/308] ASYNC_IF: peer addresses as const in interface --- openair2/UTIL/ASYNC_IF/link_manager.c | 2 +- openair2/UTIL/ASYNC_IF/link_manager.h | 2 +- openair2/UTIL/ASYNC_IF/socket_link.c | 6 +++--- openair2/UTIL/ASYNC_IF/socket_link.h | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 9e636ea1e2..7486fbd171 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -97,7 +97,7 @@ link_manager_t *create_link_manager( message_queue_t *receive_queue, socket_link_t *link, uint16_t type, - char *peer_addr, + const char *peer_addr, int port ) { link_manager_t *ret = NULL; diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index 391458e088..f7efc92867 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -58,7 +58,7 @@ link_manager_t *create_link_manager( message_queue_t *receive_queue, socket_link_t *link, uint16_t type, - char *peer_addr, + const char *peer_addr, int port); void destroy_link_manager(link_manager_t *); diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 8f06ed15ff..e7100a2797 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -115,7 +115,7 @@ error: return NULL; } -socket_link_t *new_link_client(char *server, int port) +socket_link_t *new_link_client(const char *server, int port) { socket_link_t *ret = NULL; struct sockaddr_in addr; @@ -208,7 +208,7 @@ error: } -socket_link_t *new_link_udp_client(char *server, int port){ +socket_link_t *new_link_udp_client(const char *server, int port){ socket_link_t *ret = NULL; ret = calloc(1, sizeof(socket_link_t)); @@ -307,7 +307,7 @@ error: return NULL; } -socket_link_t *new_link_sctp_client(char *server, int port) +socket_link_t *new_link_sctp_client(const char *server, int port) { socket_link_t *ret = NULL; diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h index c2cf3d3c10..1ce5c27424 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.h +++ b/openair2/UTIL/ASYNC_IF/socket_link.h @@ -47,11 +47,11 @@ typedef struct { } socket_link_t; socket_link_t *new_link_server(int port); -socket_link_t *new_link_client(char *server, int port); +socket_link_t *new_link_client(const char *server, int port); socket_link_t *new_link_udp_server(int port); -socket_link_t *new_link_udp_client(char *server, int port); +socket_link_t *new_link_udp_client(const char *server, int port); socket_link_t *new_link_sctp_server(int port); -socket_link_t *new_link_sctp_client(char *server, int port); +socket_link_t *new_link_sctp_client(const char *server, int port); int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, char *peer_addr, int port); int link_receive_packet(socket_link_t *link, void **data, int *size, uint16_t proto_type, char *peer_addr, int port); int close_link(socket_link_t *link); -- GitLab From 3b68376ad3d988bdd8cfd8370414b0d79e11dcc4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 18 Sep 2018 18:32:20 +0200 Subject: [PATCH 088/308] PROTO_AGENT: Restructure/simplify code, UDP only, no own configuration --- common/ran_context.h | 2 - openair2/ENB_APP/enb_config.c | 128 ----- openair2/ENB_APP/enb_config.h | 45 +- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 473 ++++-------------- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 11 +- .../LAYER2/PROTO_AGENT/proto_agent_async.c | 118 ++--- .../LAYER2/PROTO_AGENT/proto_agent_async.h | 11 +- .../LAYER2/PROTO_AGENT/proto_agent_defs.h | 18 +- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.h | 16 +- 9 files changed, 178 insertions(+), 644 deletions(-) diff --git a/common/ran_context.h b/common/ran_context.h index 85c22467f6..c0b58d2af2 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -103,8 +103,6 @@ typedef struct { pthread_mutex_t ru_mutex; /// condition variable for signaling setup completion of an RU pthread_cond_t ru_cond; - - struct cudu_params_s cudu; } RAN_CONTEXT_t; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 872a5ff358..c9e67a7ece 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -416,132 +416,6 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) { } -void RCconfig_cudu() { - int j; - char *transport_type; - char *du_type; - char *balancing; - - - - pthread_t myid = pthread_self(); - printf("CONFIG my id is %u\n", myid); - - paramdef_t DU_Params[] = DUPARAMS_DESC; - paramdef_t CU_Params[] = CUPARAMS_DESC; - paramlist_def_t DU_ParamList = {CONFIG_STRING_DU_LIST,NULL,0}; - paramlist_def_t CU_ParamList = {CONFIG_STRING_CU_LIST,NULL,0}; - - config_getlist( &DU_ParamList,DU_Params,sizeof(DU_Params)/sizeof(paramdef_t), NULL); - config_getlist( &CU_ParamList,CU_Params,sizeof(CU_Params)/sizeof(paramdef_t), NULL); - - paramdef_t CU_Bal[] = CU_BAL_DESC; - paramlist_def_t CU_BalList = {CONFIG_STRING_CU_BALANCING, NULL, 0}; - config_get(&CU_Bal, sizeof(CU_Bal)/sizeof(paramdef_t),NULL); - - //printf("%s\n", strdup(*(CU_Bal[0].strptr))); - - balancing = strdup(*(CU_Bal[0].strptr)); - if (strcmp(balancing, "ALL") == 0) - { - RC.cudu.cu_balancing = CU_BALANCING_ALL; - } - else if (strcmp(balancing, "ROUND_ROBIN") == 0) - { - RC.cudu.cu_balancing = CU_BALANCING_ROUND_ROBIN; - } - else - { - RC.cudu.cu_balancing = atoi(balancing) - 1; - } - - // DU Parameters - RC.cudu.local_du.du_interface = strdup(*(DU_ParamList.paramarray[0][DU_INTERFACE_F1U].strptr)); - RC.cudu.local_du.du_ipv4_address = strdup(*(DU_ParamList.paramarray[0][DU_ADDRESS_F1U].strptr)); - RC.cudu.local_du.du_port = *(DU_ParamList.paramarray[0][DU_PORT_F1U].iptr); - transport_type = strdup(*(DU_ParamList.paramarray[0][DU_TYPE_F1U].strptr)); - - if (strcmp(transport_type, "TCP") == 0) - { - RC.cudu.local_du.tcp = 1; - RC.cudu.local_du.udp = 0; - RC.cudu.local_du.sctp = 0; - } - else if (strcmp(transport_type, "UDP") == 0) - { - RC.cudu.local_du.tcp = 0; - RC.cudu.local_du.udp = 1; - RC.cudu.local_du.sctp = 0; - } - else if (strcmp(transport_type, "SCTP") == 0) - { - RC.cudu.local_du.tcp = 0; - RC.cudu.local_du.udp = 0; - RC.cudu.local_du.sctp = 1; - } - else - { - RC.cudu.local_du.tcp = 1; - RC.cudu.local_du.udp = 0; - RC.cudu.local_du.sctp = 0; - } - - //CU Parameters - j = CU_ParamList.numelt; - RC.cudu.serving_dus = j; - for (int k=0; k<j; k++) - { - RC.cudu.cu[k].cu_interface = strdup(*(CU_ParamList.paramarray[k][CU_INTERFACE_F1U].strptr)); - RC.cudu.cu[k].cu_ipv4_address = strdup(*(CU_ParamList.paramarray[k][CU_ADDRESS_F1U].strptr)); - RC.cudu.cu[k].cu_port = *(CU_ParamList.paramarray[k][CU_PORT_F1U].iptr); - RC.cudu.cu[k].cu_id = k; - du_type = strdup(*(CU_ParamList.paramarray[k][DU_TECH].strptr)); - transport_type = strdup(*(CU_ParamList.paramarray[k][CU_TYPE_F1U].strptr)); - if (strcmp(transport_type, "TCP") == 0) - { - RC.cudu.cu[k].tcp = 1; - RC.cudu.cu[k].udp = 0; - RC.cudu.cu[k].sctp = 0; - } - else if (strcmp(transport_type, "UDP") == 0) - { - RC.cudu.cu[k].tcp = 0; - RC.cudu.cu[k].udp = 1; - RC.cudu.cu[k].sctp = 0; - } - else if (strcmp(transport_type, "SCTP") == 0) - { - RC.cudu.cu[k].tcp = 0; - RC.cudu.cu[k].udp = 0; - RC.cudu.cu[k].sctp = 1; - } - else - { - RC.cudu.cu[k].tcp = 1; - RC.cudu.cu[k].udp = 0; - RC.cudu.cu[k].sctp = 0; - } - if (strcmp(du_type, "LTE") == 0) - { - RC.cudu.cu[k].du_type = DU_TYPE_LTE; - } - else if (strcmp(du_type, "WiFi") == 0) - { - RC.cudu.cu[k].du_type = DU_TYPE_WIFI; - } - else - { - RC.cudu.cu[k].du_type = DU_TYPE_LTE; - } - } - -} - -cudu_params_t *get_cudu_config() -{ - return &(RC.cudu); -} - int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { int num_enbs = 0; @@ -2828,8 +2702,6 @@ void RCConfig(void) { char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - // RCconfig_cudu(); - /* get global parameters, defined outside any section in the config file */ printf("Getting ENBSParams\n"); diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index cdca8bd240..715ef44483 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -82,37 +82,16 @@ typedef struct mme_ip_address_s { -typedef struct du_interfaces { - char *du_interface; - char *du_ipv4_address; - uint16_t du_port; - - - unsigned tcp:1; - unsigned udp:1; - unsigned sctp:1; - -}du_interfaces_t; - -typedef struct cu_interfaces { - char *cu_interface; - char *cu_ipv4_address; - uint16_t cu_port; - uint8_t du_type; - uint8_t cu_id; - - unsigned tcp:1; - unsigned udp:1; - unsigned sctp:1; - -}cu_interfaces_t; - -typedef struct cudu_params_s { - du_interfaces_t local_du; - cu_interfaces_t cu[MAX_DU]; - uint8_t serving_dus; - uint8_t cu_balancing; -}cudu_params_t; +typedef struct du_params { + const char *remote_ipv4_address; + const int16_t remote_port; +} du_params_t; + +typedef struct cu_params { + const char *local_interface; + const char *local_ipv4_address; + const uint16_t local_port; +} cu_params_t; typedef struct ru_config_s { // indicates if local or remote rf is used (1 == LOCAL) @@ -145,11 +124,7 @@ void ru_config_display(void); int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc); int RCconfig_S1(MessageDef *msg_p, uint32_t i); -int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i); -int RCconfig_CU_F1(uint32_t i); -void RCconfig_cudu(void); -cudu_params_t *get_cudu_config(void); void read_config_and_init(void); int RCconfig_X2(MessageDef *msg_p, uint32_t i); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index fd809d5f9a..e798500357 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -45,251 +45,84 @@ proto_agent_instance_t proto_agent[MAX_DU]; proto_agent_instance_t proto_server[MAX_DU]; -char in_ip[40]; -static uint16_t in_port; -char local_cache[40]; - -void *send_thread(void *args); -//void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); -pthread_t cu_thread[MAX_DU], du_thread; + Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); -mod_id_t client_mod[MAX_DU], server_mod; proto_agent_async_channel_t *client_channel[MAX_DU], *server_channel; -proto_recv_t client_info[MAX_DU]; #define TEST_MOD 0 -uint8_t tcp = 0; -uint8_t udp = 0; -uint8_t sctp = 0; -char *link_type = NULL; - - #define ECHO -/* Thread continuously listening for incomming packets */ -/* -void *receive_thread(void *args) { - - proto_agent_instance_t *d = args; - void *data; - int size; - int priority; - err_code_t err_code = 0; - - Protocol__FlexsplitMessage *msg; - - while (1) { - if (proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(PROTO_AGENT, "Received message with size %d and priority %d, calling message handle\n", size, priority); - - msg=proto_agent_handle_message(d->enb_id, data, size); - - if (msg == NULL) - { - LOG_D(PROTO_AGENT, "msg to send back is NULL\n"); - } - - if (msg != NULL){ - if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - LOG_D(PROTO_AGENT, "sent message with size %d\n", size); - } - } - - return NULL; - -error: - LOG_E(PROTO_AGENT, "receive_thread: error %d occured\n",err_code); - return NULL; -} -*/ - -/* utility function to create a thread */ -/* -pthread_t new_thread(void *(*f)(void *), void *b) { - pthread_t t; - pthread_attr_t att; - - if (pthread_attr_init(&att)){ - fprintf(stderr, "pthread_attr_init err\n"); - exit(1); - } - if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) { - fprintf(stderr, "pthread_attr_setdetachstate err\n"); - exit(1); - } - if (pthread_create(&t, &att, f, b)) { - fprintf(stderr, "pthread_create err\n"); - exit(1); - } - if (pthread_attr_destroy(&att)) { - fprintf(stderr, "pthread_attr_destroy err\n"); - exit(1); - } - - return t; -} -*/ -/* Function to be called as a thread: - it is calling the proto_agent_server with - the appropriate arguments -*/ - -void * proto_server_init(void *args) -{ - //printf( "Initializing server thread for listening connections\n"); - mod_id_t mod_id = (mod_id_t) 0; - cudu_params_t* cudu = NULL; - cudu = get_cudu_config(); - proto_server_start(mod_id, (const cudu_params_t*) cudu); - return NULL; -} - /* Server side function; upon a new connection reception, sends the hello packets */ -int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){ - +int proto_server_start(mod_id_t mod_id, const cu_params_t *cu) +{ int channel_id; - char *peer_address = NULL; - - proto_server[mod_id].enb_id = mod_id; + + DevAssert(cu->local_interface); + DevAssert(cu->local_ipv4_address); + DevAssert(cu->local_port > 1024); // "unprivileged" port - server_mod = mod_id; + proto_server[mod_id].mod_id = mod_id; - if (cudu->local_du.du_ipv4_address != NULL) - { - //LOG_D(PROTO_AGENT, "DU ADDRESS IS %s\n",cudu->local_du.du_ipv4_address); - peer_address = strdup(cudu->local_du.du_ipv4_address); - strcpy(in_ip, cudu->local_du.du_ipv4_address); - } - else - { - strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS); - //LOG_D(PROTO_AGENT, "Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); - } - if (cudu->local_du.du_port != 0) - in_port = cudu->local_du.du_port; - else - { - in_port = DEFAULT_PROTO_AGENT_PORT; - //LOG_D(PROTO_AGENT, "Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); - } + /* Initialize the channel container */ - if(cudu->local_du.tcp == 1) - { - tcp = 1; - link_type = strdup("TCP"); - LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", - proto_server[mod_id].enb_id, - in_ip, - in_port); - } - else if(cudu->local_du.udp == 1) - { - udp = 1; - link_type = strdup("UDP"); - LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over UDP\n", - proto_server[mod_id].enb_id, - in_ip, - in_port); - } - else if(cudu->local_du.sctp == 1) - { - sctp = 1; - link_type = strdup("SCTP"); - LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over SCTP\n", - proto_server[mod_id].enb_id, - in_ip, - in_port); - } - else - { - tcp = 1; - link_type = strdup("TCP"); - LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", - proto_server[mod_id].enb_id, - in_ip, - in_port); - - } - - /* - * Initialize the channel container - */ + /* TODO only initialize the first time */ proto_agent_init_channel_container(); /*Create the async channel info*/ - proto_agent_async_channel_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port, link_type, peer_address); + proto_agent_async_channel_t *channel_info; + channel_info = proto_server_async_channel_info(mod_id, cu->local_ipv4_address, cu->local_port); server_channel = channel_info; - /*Create a channel using the async channel info*/ + /* Create a channel using the async channel info */ channel_id = proto_agent_create_channel((void *) channel_info, proto_agent_async_msg_send, proto_agent_async_msg_recv, proto_agent_async_release); - - if (channel_id <= 0) { - goto error; - } + if (channel_id <= 0) goto error; proto_agent_channel_t *channel = proto_agent_get_channel(channel_id); - - - if (tcp == 1) channel->type = 0; - else if (udp == 1) channel->type = 1; - else if (sctp == 1) channel->type = 2; - else channel->type = 0; - - if (channel == NULL) { - goto error; - } + if (!channel) goto error; + proto_server[mod_id].channel = channel; - /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ + /* Register the channel for all underlying agents (use ENB_AGENT_MAX) */ proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); // Code for sending the HELLO/ECHO_REQ message once a connection is established - uint8_t *msg = NULL; - Protocol__FlexsplitMessage *init_msg=NULL; - int msg_flag = 0; - - if (udp == 0) - { - // If the comm is not UDP, allow the server to send the first packet over the channel - //printf( "Proto agent Server: Calling the echo_request packet constructor\n"); - msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); - if (msg_flag != 0) - goto error; - - int msgsize = 0; - if (init_msg != NULL) - msg = proto_agent_pack_message(init_msg, &msgsize); - - if (msg!= NULL) - { - LOG_D(PROTO_AGENT, "Server sending the message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); - } - /* After sending the message, wait for any replies; - the server thread blocks until it reads any data - over the channel - */ + //uint8_t *msg = NULL; + //Protocol__FlexsplitMessage *init_msg=NULL; + + //if (udp == 0) + //{ + // // If the comm is not UDP, allow the server to send the first packet over the channel + // //printf( "Proto agent Server: Calling the echo_request packet constructor\n"); + // msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); + // if (msg_flag != 0) + // goto error; + // + // int msgsize = 0; + // if (init_msg != NULL) + // msg = proto_agent_pack_message(init_msg, &msgsize); + + // if (msg!= NULL) + // { + // LOG_D(PROTO_AGENT, "Server sending the message over the async channel\n"); + // proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); + // } + // /* After sending the message, wait for any replies; + // the server thread blocks until it reads any data + // over the channel + // */ + + //} + + proto_server[mod_id].recv_thread = new_thread(proto_server_receive, &proto_server[mod_id]); - } - - - du_thread=new_thread(proto_server_receive, &proto_server[mod_id]); - LOG_D(PROTO_AGENT, "server ends with thread_id %lu\n",du_thread); return 0; error: @@ -298,139 +131,67 @@ error: } -int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_params_t *cudu){ - +int proto_agent_start(mod_id_t mod_id, const du_params_t *du) +{ int channel_id; - char *peer_address = NULL; - // cudu_params_t *cudu = get_cudu_config(); - - proto_agent[cu_id].enb_id = cu_id; - client_mod[cu_id] = cu_id; // FIXME: Allow for multiple types, now it will allow for DUs of different type per mod_id - - client_info[cu_id].type_id = type_id; - client_info[cu_id].mod_id = cu_id; + + DevAssert(du->remote_ipv4_address); + DevAssert(du->remote_port > 1024); // "unprivileged" port - /* - * check the configuration - Getting all the values from the config file - */ + proto_agent[mod_id].mod_id = mod_id; - if (cudu->cu[cu_id].cu_ipv4_address != NULL) - { - strcpy(in_ip, cudu->cu[cu_id].cu_ipv4_address); - peer_address = strdup(cudu->cu[cu_id].cu_ipv4_address); - } - else - { - strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS); - LOG_D(PROTO_AGENT, "Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); - } - if (cudu->cu[cu_id].cu_port != 0) - in_port = cudu->cu[cu_id].cu_port; - else - { - in_port = DEFAULT_PROTO_AGENT_PORT; - LOG_D(PROTO_AGENT, "Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); - } - - if(cudu->cu[cu_id].tcp == 1) - { - tcp = 1; - link_type = strdup("TCP"); - LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", - proto_server[cu_id].enb_id, - in_ip, - in_port); - } - else if(cudu->cu[cu_id].udp == 1) - { - udp = 1; - link_type = strdup("UDP"); - LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over UDP\n", - proto_server[cu_id].enb_id, - in_ip, - in_port); - } - else if(cudu->cu[cu_id].sctp == 1) - { - sctp = 1; - link_type = strdup("SCTP"); - LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over SCTP\n", - proto_server[cu_id].enb_id, - in_ip, - in_port); - } - else - { - tcp = 1; - link_type = strdup("TCP"); - LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", - proto_server[cu_id].enb_id, - in_ip, - in_port); - - } - - /* - * Initialize the channel container - */ + /* TODO only initialize the first time */ proto_agent_init_channel_container(); /*Create the async channel info*/ - proto_agent_async_channel_t *channel_info = proto_agent_async_channel_info(cu_id, in_ip, in_port, link_type, peer_address); - client_channel[cu_id] = channel_info; + proto_agent_async_channel_t *channel_info = proto_agent_async_channel_info(mod_id, du->remote_ipv4_address, du->remote_port); + if (!channel_info) goto error; + /*Create a channel using the async channel info*/ channel_id = proto_agent_create_channel((void *) channel_info, proto_agent_async_msg_send, proto_agent_async_msg_recv, proto_agent_async_release); - if (channel_id <= 0) { - goto error; - } + if (channel_id <= 0) goto error; proto_agent_channel_t *channel = proto_agent_get_channel(channel_id); + if (!channel) goto error; + proto_agent[mod_id].channel = channel; - if (channel == NULL) { - goto error; - } - - if (tcp == 1) channel->type = 0; - else if (udp == 1) channel->type = 1; - else if (sctp == 1) channel->type = 2; - else channel->type = 0; - - /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ - proto_agent_register_channel(cu_id, channel, ENB_AGENT_MAX); + /* Register the channel for all underlying agents (use ENB_AGENT_MAX) */ + proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); - uint8_t *msg = NULL; - Protocol__FlexsplitMessage *init_msg=NULL; - int msg_flag; + //uint8_t *msg = NULL; + //Protocol__FlexsplitMessage *init_msg=NULL; + //int msg_flag; // In the case of UDP comm, start the echo request from the client side; the server thread should be blocked until it reads the SRC port of the 1st packet - if (udp == 1) - { - msg_flag = proto_agent_echo_request(cu_id, NULL, &init_msg); - - - - if (msg_flag != 0) - goto error; - - int msgsize = 0; - if (init_msg != NULL) - msg = proto_agent_pack_message(init_msg, &msgsize); - - if (msg!= NULL) - { - LOG_D(PROTO_AGENT, "Client sending the ECHO_REQUEST message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); - } - } + //if (udp == 1) + //{ + // msg_flag = proto_agent_echo_request(cu_id, NULL, &init_msg); + + + + // if (msg_flag != 0) + // goto error; + // + // int msgsize = 0; + // if (init_msg != NULL) + // msg = proto_agent_pack_message(init_msg, &msgsize); + + // if (msg!= NULL) + // { + // LOG_D(PROTO_AGENT, "Client sending the ECHO_REQUEST message over the async channel\n"); + // proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); + // } + //} + // /* After sending the message, wait for any replies; the server thread blocks until it reads any data over the channel */ - cu_thread[cu_id]=new_thread(proto_client_receive, (void *) &client_info[cu_id]); + proto_agent[mod_id].recv_thread = new_thread(proto_client_receive, &proto_agent[mod_id]); return 0; error: @@ -439,26 +200,26 @@ error: } -void -proto_agent_send_hello(void) -{ - uint8_t *msg = NULL; - Protocol__FlexsplitMessage *init_msg=NULL; - int msg_flag = 0; - - - //printf( "PDCP agent: Calling the HELLO packet constructor\n"); - msg_flag = proto_agent_hello(proto_agent[TEST_MOD].enb_id, NULL, &init_msg); - - int msgsize = 0; - if (msg_flag == 0) - { - proto_agent_serialize_message(init_msg, &msg, &msgsize); - } - - LOG_D(PROTO_AGENT, "Agent sending the message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[TEST_MOD]); -} +//void +//proto_agent_send_hello(void) +//{ +// uint8_t *msg = NULL; +// Protocol__FlexsplitMessage *init_msg=NULL; +// int msg_flag = 0; +// +// +// //printf( "PDCP agent: Calling the HELLO packet constructor\n"); +// msg_flag = proto_agent_hello(proto_agent[TEST_MOD].mod_id, NULL, &init_msg); +// +// int msgsize = 0; +// if (msg_flag == 0) +// { +// proto_agent_serialize_message(init_msg, &msg, &msgsize); +// } +// +// LOG_D(PROTO_AGENT, "Agent sending the message over the async channel\n"); +// proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[TEST_MOD]); +//} void @@ -543,7 +304,8 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f args->sdu_p = malloc(sdu_sizeP); memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); - msg_flag = proto_agent_pdcp_data_ind(proto_server[server_mod].enb_id, (void *) args, &init_msg); + AssertFatal(0, "need mod_id here\n"); + msg_flag = proto_agent_pdcp_data_ind(proto_server[0].mod_id, (void *) args, &init_msg); if (msg_flag != 0) goto error; @@ -598,7 +360,7 @@ proto_server_receive(void *args) LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority); - msg=proto_agent_handle_message(d->enb_id, data, size); + msg=proto_agent_handle_message(d->mod_id, data, size); if (msg == NULL) { @@ -631,9 +393,8 @@ error: void * proto_client_receive(void *args) { - - proto_recv_t* recv = args; - mod_id_t recv_mod = recv->mod_id; + AssertFatal(0, "check proto_client_receive\n"); + mod_id_t recv_mod = 0; LOG_D(PROTO_AGENT, "\n\nrecv mod is %u\n\n",recv_mod); //proto_agent_instance_t *d = &proto_agent[TEST_MOD]; @@ -692,19 +453,3 @@ error: return NULL; } - - -uint8_t select_du(uint8_t max_dus) -{ - static uint8_t selected = 0; - if (selected < max_dus -1 ) - { - selected++; - } - else - { - selected = 0; - } - return selected; -} - diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 520a438aa7..468016a2ec 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -45,20 +45,13 @@ void * proto_server_init(void *args); void * proto_server_receive(void *args); void * proto_client_receive(void *args); -int proto_agent_start(uint8_t enb_id, mod_id_t mod_id, uint8_t type_id, cudu_params_t *cudu); -int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu); +int proto_agent_start(mod_id_t mod_id, const du_params_t *du); +int proto_server_start(mod_id_t mod_id, const cu_params_t* cu); int proto_agent_stop(mod_id_t mod_id); void *proto_agent_task(void *args); -uint8_t select_du(uint8_t max_dus); -typedef struct -{ - mod_id_t mod_id; - uint8_t type_id; -}proto_recv_t; - void proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 07c528da5b..0e206b7183 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -34,61 +34,35 @@ #include "common/utils/LOG/log.h" -uint16_t proto_udp = 0; -uint16_t proto_tcp = 0; -uint16_t proto_sctp = 0; - -proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr) { - +proto_agent_async_channel_t * +proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t port) +{ + LOG_E(PROTO_AGENT, "does not bind to specific address at the moment, ignoring %s\n", ip); proto_agent_async_channel_t *channel; - channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); - - channel->port = dst_port; - channel->peer_addr = NULL; + channel = malloc(sizeof(proto_agent_channel_t)); if (channel == NULL) goto error; + channel->port = port; + channel->peer_addr = NULL; + channel->enb_id = mod_id; - /*Create a socket*/ - if (strcmp(type, "TCP") == 0) - { - proto_tcp = 1; - printf("PROTO_AGENT: sTARTING TCP SERVER\n"); - channel->link = new_link_server(dst_port); - channel->type = 0; - } - else if (strcmp(type, "UDP") == 0) - { - proto_udp = 1; - //channel->link = new_udp_link_server(dst_port); - channel->link = new_link_udp_server(dst_port); - channel->type = 1; - channel->peer_addr = peer_addr; - } - else if (strcmp(type, "SCTP") == 0) - { - proto_sctp = 1; - //channel->link = new_sctp_link_server(dst_port); - channel->link = new_link_sctp_server(dst_port); - channel->type = 2; - } + channel->link = new_link_udp_server(port); if (channel->link == NULL) goto error; - /* - * create a message queue - */ - channel->send_queue = new_message_queue(); if (channel->send_queue == NULL) goto error; channel->receive_queue = new_message_queue(); if (channel->receive_queue == NULL) goto error; - /* - * create a link manager - */ - channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link, channel->type, channel->peer_addr, channel->port); + channel->manager = create_link_manager(channel->send_queue, + channel->receive_queue, + channel->link, + CHANNEL_UDP, + channel->peer_addr, + channel->port); if (channel->manager == NULL) goto error; return channel; @@ -99,55 +73,34 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, c } -proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr) { - +proto_agent_async_channel_t * +proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst_port) +{ proto_agent_async_channel_t *channel; channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); - - channel->port = dst_port; - channel->peer_addr = NULL; - + if (channel == NULL) goto error; + channel->port = dst_port; + channel->peer_addr = dst_ip; + channel->enb_id = mod_id; - /*Create a socket*/ - if (strcmp(type, "TCP") == 0) - { - proto_tcp = 1; - channel->link = new_link_client(dst_ip, dst_port); - channel->type = 0; - } - else if (strcmp(type, "UDP") == 0) - { - proto_udp = 1; - channel->link = new_link_udp_client(dst_ip, dst_port); - channel->type = 1; - channel->peer_addr = peer_addr; - } - else if (strcmp(type, "SCTP") == 0) - { - proto_sctp = 1; - channel->link = new_link_sctp_client(dst_ip, dst_port);; - channel->type = 2; - } - + channel->link = new_link_udp_client(channel->peer_addr, channel->port); if (channel->link == NULL) goto error; - /* - * create a message queue - */ - channel->send_queue = new_message_queue(); if (channel->send_queue == NULL) goto error; channel->receive_queue = new_message_queue(); if (channel->receive_queue == NULL) goto error; - /* - * create a link manager - */ - channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link, channel->type, channel->peer_addr, channel->port); + channel->manager = create_link_manager(channel->send_queue, + channel->receive_queue, + channel->link, + CHANNEL_UDP, + channel->peer_addr, + channel->port); if (channel->manager == NULL) goto error; return channel; @@ -163,19 +116,12 @@ int proto_agent_async_msg_send(void *data, int size, int priority, void *channel return message_put(channel->send_queue, data, size, priority); } -int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { +int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) +{ proto_agent_async_channel_t *channel; channel = (proto_agent_async_channel_t *)channel_info; - if (channel == NULL) - return 0; - else if (channel->type < 0) - return 0; - else if (channel->receive_queue == NULL) - return 0; - else - return message_get(channel->receive_queue, data, size, priority); - + return message_get(channel->receive_queue, data, size, priority); } void proto_agent_async_release(proto_agent_channel_t *channel) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h index c7a72d2983..681fb83b1b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h @@ -39,10 +39,9 @@ #include "proto_agent_net_comm.h" -typedef struct { - mod_id_t enb_id; - uint16_t type; // 0-> TCP, 1-> UDP, 2->SCTP - char *peer_addr; +typedef struct proto_agent_async_channel_s { + mod_id_t enb_id; + const char *peer_addr; int port; socket_link_t *link; message_queue_t *send_queue; @@ -50,8 +49,8 @@ typedef struct { link_manager_t *manager; } proto_agent_async_channel_t; -proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr); -proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr); +proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst_port); +proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t _port); int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h index 2202390749..0e0302002c 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h @@ -98,9 +98,9 @@ typedef enum { typedef uint8_t xid_t; typedef uint8_t mod_id_t; // module or enb id typedef uint8_t lcid_t; -typedef int32_t err_code_t; - +typedef int32_t err_code_t; +#define CHANNEL_UDP 1 typedef struct { /* general info */ @@ -113,12 +113,16 @@ typedef struct { uint32_t rx_msg[NUM_MAX_ENB]; uint32_t tx_msg[NUM_MAX_ENB]; -}proto_agent_info_t; +} proto_agent_info_t; -typedef struct { - mod_id_t enb_id; +/* forward declaration */ +struct proto_agent_channel_s; + +typedef struct proto_agent_instance_s { + mod_id_t mod_id; proto_agent_info_t agent_info; - -}proto_agent_instance_t; + struct proto_agent_channel_s *channel; + pthread_t recv_thread; +} proto_agent_instance_t; #endif diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h index b489c64416..6647de6e1b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h @@ -41,16 +41,18 @@ #include "tree.h" #define ENB_AGENT_MAX 9 +/* forward declaration */ +struct proto_agent_async_channel_s; + /*Channel related information used for Tx/Rx of protocol messages*/ typedef struct proto_agent_channel_s { RB_ENTRY(proto_agent_channel_s) entry; -int channel_id; -void *channel_info; -uint16_t type; // 0-> TCP, 1-> UDP, 2->SCTP -/*Callbacks for channel message Tx and Rx*/ -int (*msg_send)(void *data, int size, int priority, void *channel_info); -int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); -void (*release)(struct proto_agent_channel_s *channel); + int channel_id; + struct proto_agent_async_channel_s *channel_info; + /*Callbacks for channel message Tx and Rx*/ + int (*msg_send)(void *data, int size, int priority, void *channel_info); + int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); + void (*release)(struct proto_agent_channel_s *channel); } proto_agent_channel_t; typedef struct proto_agent_channel_instance_s{ -- GitLab From 3ad16e980675afecb497b552e0a2609e8cf46c68 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 18 Sep 2018 18:51:19 +0200 Subject: [PATCH 089/308] minor fixes --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 57 +++++++++---------- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 8 +-- .../LAYER2/PROTO_AGENT/proto_agent_async.c | 11 ++-- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 5 -- 4 files changed, 35 insertions(+), 46 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index e798500357..ee12cd6257 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -49,8 +49,6 @@ pthread_t new_thread(void *(*f)(void *), void *b); Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); -proto_agent_async_channel_t *client_channel[MAX_DU], *server_channel; - #define TEST_MOD 0 #define ECHO @@ -77,8 +75,6 @@ int proto_server_start(mod_id_t mod_id, const cu_params_t *cu) proto_agent_async_channel_t *channel_info; channel_info = proto_server_async_channel_info(mod_id, cu->local_ipv4_address, cu->local_port); - server_channel = channel_info; - /* Create a channel using the async channel info */ channel_id = proto_agent_create_channel((void *) channel_info, proto_agent_async_msg_send, @@ -223,8 +219,10 @@ error: void -proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, - confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) +proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, const mui_t muiP, + confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { //LOG_D(PROTO_AGENT, "PROTOPDCP: sending the data req over the async channel\n"); @@ -233,6 +231,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct Protocol__FlexsplitMessage *init_msg=NULL; int msg_flag = 0; + mod_id_t mod_id = ctxt_pP->module_id; //printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n"); @@ -249,7 +248,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct args->sdu_p = malloc(sdu_sizeP); memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); - msg_flag = proto_agent_pdcp_data_req(type_id, (void *) args, &init_msg); + msg_flag = proto_agent_pdcp_data_req(mod_id, (void *) args, &init_msg); if (msg_flag != 0) goto error; @@ -263,7 +262,8 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct LOG_D(PROTO_AGENT, "Sending the pdcp data_req message over the async channel\n"); if (msg!=NULL) - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[mod_id]); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, + proto_agent[mod_id].channel->channel_info); } else @@ -290,6 +290,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f int msg_flag = 0; + mod_id_t mod_id = ctxt_pP->module_id; //printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n"); @@ -304,8 +305,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f args->sdu_p = malloc(sdu_sizeP); memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); - AssertFatal(0, "need mod_id here\n"); - msg_flag = proto_agent_pdcp_data_ind(proto_server[0].mod_id, (void *) args, &init_msg); + msg_flag = proto_agent_pdcp_data_ind(mod_id, (void *) args, &init_msg); if (msg_flag != 0) goto error; @@ -318,7 +318,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f if (msg!=NULL) { LOG_D(PROTO_AGENT, "Sending the pdcp data_ind message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) server_channel); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_server[mod_id].channel->channel_info); } } else @@ -339,7 +339,7 @@ error: void * proto_server_receive(void *args) { - proto_agent_instance_t *d = args; + proto_agent_instance_t *inst = args; void *data = NULL; int size; int priority; @@ -353,14 +353,14 @@ proto_server_receive(void *args) msg = NULL; ser_msg = NULL; - if (proto_agent_async_msg_recv(&data, &size, &priority, server_channel)){ + if (proto_agent_async_msg_recv(&data, &size, &priority, inst->channel->channel_info)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority); - msg=proto_agent_handle_message(d->mod_id, data, size); + msg=proto_agent_handle_message(inst->mod_id, data, size); if (msg == NULL) { @@ -373,9 +373,9 @@ proto_server_receive(void *args) LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); if (ser_msg != NULL){ - if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){ - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){ + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; } LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } @@ -394,10 +394,8 @@ void * proto_client_receive(void *args) { AssertFatal(0, "check proto_client_receive\n"); - mod_id_t recv_mod = 0; + proto_agent_instance_t *inst = args; - LOG_D(PROTO_AGENT, "\n\nrecv mod is %u\n\n",recv_mod); - //proto_agent_instance_t *d = &proto_agent[TEST_MOD]; void *data = NULL; int size; int priority; @@ -412,19 +410,16 @@ proto_client_receive(void *args) msg = NULL; ser_msg = NULL; - while(client_channel[recv_mod] == NULL) - { - //just wait - } - LOG_D(PROTO_AGENT, "Will receive packets\n"); - if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel[recv_mod])){ + if (proto_agent_async_msg_recv(&data, &size, &priority, inst->channel->channel_info)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - LOG_D(PROTO_AGENT, "Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", size, priority, recv_mod); + LOG_D(PROTO_AGENT, + "Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", + size, priority, inst->mod_id); - msg=proto_agent_handle_message(recv_mod, data, size); + msg = proto_agent_handle_message(inst->mod_id, data, size); if (msg == NULL) { @@ -437,9 +432,9 @@ proto_client_receive(void *args) LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); if (ser_msg != NULL){ - if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel[recv_mod])){ - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){ + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; } LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 468016a2ec..7b69b82379 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -52,10 +52,10 @@ int proto_agent_stop(mod_id_t mod_id); void *proto_agent_task(void *args); -void proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, - const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, - confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP); +void proto_agent_send_rlc_data_req( const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP, + sdu_size_t sdu_sizeP, mem_block_t *sdu_pP); void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 0e206b7183..9bf861b056 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -110,21 +110,20 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst return NULL; } -int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { +int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) +{ proto_agent_async_channel_t *channel = channel_info; - return message_put(channel->send_queue, data, size, priority); } int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { - proto_agent_async_channel_t *channel; - channel = (proto_agent_async_channel_t *)channel_info; - + proto_agent_async_channel_t *channel = channel_info; return message_get(channel->receive_queue, data, size, priority); } -void proto_agent_async_release(proto_agent_channel_t *channel) { +void proto_agent_async_release(proto_agent_channel_t *channel) +{ proto_agent_async_channel_t *channel_info; channel_info = (proto_agent_async_channel_t *) channel->channel_info; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index d89c0b09ae..147af52a12 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -45,11 +45,6 @@ #include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rrc_eNB_UE_context.h" -//#include "LAYER2/PDCP_v10.1.0/pdcp_primitives.h" - -void * enb[NUM_MAX_ENB]; -void * enb_ue[NUM_MAX_ENB]; -void * enb_rrc[NUM_MAX_ENB]; /* * message primitives -- GitLab From 1cd43984c22e8ce6d8cb59c42dcf863a5ce4fbf9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 19 Sep 2018 11:56:54 +0200 Subject: [PATCH 090/308] Remove PDCP/RLC code depending on old F1U/PROTO_AGENT --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 45 ++++++----------------------- openair2/LAYER2/RLC/rlc.c | 11 +++---- 2 files changed, 15 insertions(+), 41 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 4f1b7f3d00..e3fec20747 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -375,50 +375,23 @@ boolean_t pdcp_data_req( LOG_F(PDCP,"\n"); #ifndef UETARGET - static cudu_params_t *cudu = NULL; - if (ctxt_pP->enb_flag == 1) - { - if (cudu == NULL) - { - cudu = get_cudu_config(); - } - static int agent_started = 1; - if (agent_started == 1) - { - for (int k =0; k<cudu->serving_dus; k++) - { - proto_agent_start(0, cudu->cu[k].cu_id, cudu->cu[k].du_type, cudu); - } - agent_started = 0; - } - } if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) { - if (cudu->cu_balancing == CU_BALANCING_ALL) { - for (int j =0; j<cudu->serving_dus; j++) - { - proto_agent_send_rlc_data_req(0,cudu->cu[j].du_type, ctxt_pP, srb_flagP, MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - } - rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p + LOG_E(PDCP, "proto_agent_send_rlc_data_req()\n"); + { + //proto_agent_send_rlc_data_req(0,cudu->cu[j].du_type, ctxt_pP, srb_flagP, + //MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + } + //rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,sourceL2Id - ,destinationL2Id + //,sourceL2Id + //,destinationL2Id #endif - ); + //); } - else if (cudu->cu_balancing == CU_BALANCING_ROUND_ROBIN) - { - int selected_du = select_du(cudu->serving_dus); - proto_agent_send_rlc_data_req(cudu->cu[selected_du].cu_id,cudu->cu[selected_du].du_type,ctxt_pP, srb_flagP, MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - } - else - { - int index = cudu->cu_balancing; - proto_agent_send_rlc_data_req(cudu->cu[index].cu_id,cudu->cu[index].du_type,ctxt_pP, srb_flagP, MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - } free_mem_block(pdcp_pdu_p, __FUNCTION__); rlc_status = ack_result; diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index d40fc99e13..793e140641 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -63,17 +63,18 @@ async_server_thread_init (void) //create log_list //log_list_init(&log_list); + AssertFatal(0, "this should not be reached!\n"); async_server_shutdown = 0; if ((pthread_mutex_init (&async_server_lock, NULL) != 0) || (pthread_cond_init (&async_server_notify, NULL) != 0)) { return; } - if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL) - != 0) { - async_server_thread_finalize(); - return; - } + //if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL) + // != 0) { + // async_server_thread_finalize(); + // return; + //} } -- GitLab From 144a0a37e5e958cb07d97cefdcf45fd21e358ff5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 19 Sep 2018 12:11:56 +0200 Subject: [PATCH 091/308] define display_backtrace() without void --- common/utils/itti/backtrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/itti/backtrace.h b/common/utils/itti/backtrace.h index 9a77767cf4..b4620b6bed 100644 --- a/common/utils/itti/backtrace.h +++ b/common/utils/itti/backtrace.h @@ -24,7 +24,7 @@ #ifndef BACKTRACE_H_ #define BACKTRACE_H_ -void display_backtrace(void); +void display_backtrace(); void backtrace_handle_signal(siginfo_t *info); -- GitLab From 24884bfb2bff03e7ebfbe895b98c62fc3b055944 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Wed, 19 Sep 2018 18:57:48 +0200 Subject: [PATCH 092/308] Update complete elements with ue context setup request --- openair2/COMMON/f1ap_messages_types.h | 14 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 459 ++++++++++++++++-- openair2/F1AP/f1ap_du_ue_context_management.c | 41 +- openair2/F1AP/f1ap_handlers.c | 4 +- openair3/UTILS/conversions.h | 34 +- 5 files changed, 503 insertions(+), 49 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index d133aab66e..fbc5995617 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -247,6 +247,7 @@ typedef struct f1ap_initial_ul_rrc_message_s { typedef struct f1ap_ul_rrc_message_s { uint32_t gNB_CU_ue_id; uint32_t gNB_DU_ue_id; + uint16_t rnti; uint8_t srb_id; uint8_t *rrc_container; int rrc_container_length; @@ -265,18 +266,25 @@ typedef struct f1ap_drb_to_be_setup_s { } f1ap_drb_to_be_setup_t; typedef struct f1ap_ue_context_setup_req_s { - uint32_t gNB_CU_ue_id; + uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti uint32_t *gNB_DU_ue_id; + uint16_t rnti; // SpCell Info uint16_t mcc; uint16_t mnc; uint8_t mnc_digit_length; uint64_t nr_cellid; + uint8_t servCellIndex; + uint8_t cellULConfigured; uint32_t servCellId; uint8_t *cu_to_du_rrc_information; uint8_t cu_to_du_rrc_information_length; - f1ap_drb_to_be_setup_t *drbs_to_be_setup; - uint8_t drbs_to_be_setup_length; + f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req + uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req + s1ap_initial_context_setup_req_t *s1ap_initial_context_setup_req; + // coniatner for the rrc_eNB_generate_SecurityModeCommand message + uint8_t *rrc_container; + int rrc_container_length; } f1ap_ue_context_setup_req_t; #endif /* F1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 82f97e4758..da04a80578 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -122,16 +122,26 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; - ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); + /* optional */ + /* 6.1 cG_ConfigInfo */ + ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); /* optional */ + /* 6.2 uE_CapabilityRAT_ContainerList */ + ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); + /* optional */ + /* 6.3 measConfig */ + ie->value.choice.CUtoDURRCInformation.measConfig = (F1AP_MeasConfig_t *)calloc(1, sizeof(F1AP_MeasConfig_t)); + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.measConfig, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ /* c7. Candidate_SpCell_List */ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); @@ -149,7 +159,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; - /* 5.1 Candidate_SpCell_Item */ + /* 7.1 Candidate_SpCell_Item */ F1AP_Candidate_SpCell_Item_t candidate_spCell_item; memset((void *)&candidate_spCell_item, 0, sizeof(F1AP_Candidate_SpCell_Item_t)); @@ -178,11 +188,18 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRXCycle; + /* 8.1 longDRXCycleLength */ ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + + /* optional */ + /* 8.2 shortDRXCycleLength */ if (0) { ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum } + + /* optional */ + /* 8.3 shortDRXCycleTimer */ if (0) { ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; @@ -226,11 +243,11 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, scell_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; scell_toBeSetup_item_ies->value.present = F1AP_SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; - /* 8.1 SCell_ToBeSetup_Item */ + /* 10.1 SCell_ToBeSetup_Item */ F1AP_SCell_ToBeSetup_Item_t scell_toBeSetup_item; memset((void *)&scell_toBeSetup_item, 0, sizeof(F1AP_SCell_ToBeSetup_Item_t)); - // /* - sCell_ID */ + /* 10.1.1 sCell_ID */ F1AP_NRCGI_t nRCGI; /* TODO correct MCC/MNC */ MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, @@ -238,12 +255,19 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - scell_toBeSetup_item.sCell_ID = nRCGI; - /* sCellIndex */ + /* 10.1.2 sCellIndex */ scell_toBeSetup_item.sCellIndex = 3; // issue here - // /* ADD */ + + /* OPTIONAL */ + /* 10.1.3 sCellULConfigured*/ + if (0) { + scell_toBeSetup_item.sCellULConfigured = (F1AP_CellULConfigured_t *)calloc(1, sizeof(F1AP_CellULConfigured_t)); + scell_toBeSetup_item.sCellULConfigured = F1AP_CellULConfigured_ul_and_sul; // enum + } + + /* ADD */ scell_toBeSetup_item_ies->value.choice.SCell_ToBeSetup_Item = scell_toBeSetup_item; ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetup_List.list, @@ -251,7 +275,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - // /* mandatory */ + + /* mandatory */ /* c11. SRBs_ToBeSetup_List */ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List; @@ -268,13 +293,20 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, srbs_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; srbs_toBeSetup_item_ies->value.present = F1AP_SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; - /* 9.1 SRBs_ToBeSetup_Item */ + /* 11.1 SRBs_ToBeSetup_Item */ F1AP_SRBs_ToBeSetup_Item_t srbs_toBeSetup_item; memset((void *)&srbs_toBeSetup_item, 0, sizeof(F1AP_SRBs_ToBeSetup_Item_t)); - /* - sRBID */ + /* 11.1.1 sRBID */ srbs_toBeSetup_item.sRBID = 2L; + /* OPTIONAL */ + /* 11.1.2 duplicationIndication */ + if (0) { + srbs_toBeSetup_item.duplicationIndication = (F1AP_DuplicationIndication_t *)calloc(1, sizeof(F1AP_DuplicationIndication_t)); + srbs_toBeSetup_item.duplicationIndication = F1AP_DuplicationIndication_true; // enum + } + /* ADD */ srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item = srbs_toBeSetup_item; ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetup_List.list, @@ -297,53 +329,355 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, drbs_toBeSetup_item_ies->criticality = F1AP_Criticality_reject; drbs_toBeSetup_item_ies->value.present = F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; - /* 10.1 DRBs_ToBeSetup_Item */ + /* 12.1 DRBs_ToBeSetup_Item */ F1AP_DRBs_ToBeSetup_Item_t drbs_toBeSetup_item; memset((void *)&drbs_toBeSetup_item, 0, sizeof(F1AP_DRBs_ToBeSetup_Item_t)); - /* dRBID */ - drbs_toBeSetup_item.dRBID = f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id; - - /* qoSInformation */ - drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; - - /* ULTunnels_ToBeSetup_List */ + /* 12.1.1 dRBID */ + drbs_toBeSetup_item.dRBID = f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id; // 9 + + /* 12.1.2 qoSInformation */ + int some_decide_qos = 1; // BK: Need Check + if (some_decide_qos) { + drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; + + /* 12.1.2.1 eUTRANQoS */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + + /* 12.1.2.1.1 qCI */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; + + /* 12.1.2.1.2 allocationAndRetentionPriority */ + { + /* 12.1.2.1.2.1 priorityLevel */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + + /* 12.1.2.1.2.2 pre_emptionCapability */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_may_trigger_pre_emption; // enum + + /* 12.1.2.1.2.2 pre_emptionVulnerability */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + } + + /* OPTIONAL */ + /* 12.1.2.1.3 gbrQosInformation */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation = (F1AP_GBR_QosInformation_t *)calloc(1, sizeof(F1AP_GBR_QosInformation_t)); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_MaximumBitrateDL, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_MaximumBitrateUL, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_GuaranteedBitrateDL, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_GuaranteedBitrateUL, 1L); + } + + } else { + /* 12.1.2 dRB_Information */ + drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_dRB_Information; + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information = (F1AP_DRB_Information_t *)calloc(1, sizeof(F1AP_DRB_Information_t)); + + /* 12.1.2.1 dRB_QoS */ + { + /* qoS_Characteristics */ + { + int some_decide_qoS_characteristics = 1; // BK: Need Check + if (some_decide_qoS_characteristics) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); + + /* fiveQI */ + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; + + /* OPTIONAL */ + /* qoSPriorityLevel */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; + } + + /* OPTIONAL */ + /* averagingWindow */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; + } + + /* OPTIONAL */ + /* maxDataBurstVolume */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; + } + + } else { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); + + /* qoSPriorityLevel */ + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; + + /* packetDelayBudget */ + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; + + /* packetErrorRate */ + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate = 1L; + + /* OPTIONAL */ + /* delayCritical */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + } + + /* OPTIONAL */ + /* averagingWindow */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + } + + /* OPTIONAL */ + /* maxDataBurstVolume */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + } + + } // if some_decide_qoS_characteristics + + } // qoS_Characteristics + + /* nGRANallocationRetentionPriority */ + { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + } // nGRANallocationRetentionPriority + + /* OPTIONAL */ + /* gBR_QoS_Flow_Information */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); + + /* OPTIONAL */ + /* maxPacketLossRateDownlink */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + } + + /* OPTIONAL */ + /* maxPacketLossRateUplink */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + } + + } + + /* OPTIONAL */ + /* reflective_QoS_Attribute */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; + } + + } // dRB_QoS + + /* 12.1.2.2 sNSSAI */ + { + /* sST */ + OCTET_STRING_fromBuf(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sST, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + /* OPTIONAL */ + /* sD */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sD = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sD, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + } + } + /* OPTIONAL */ + /* 12.1.2.3 notificationControl */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = (F1AP_NotificationControl_t *)calloc(1, sizeof(F1AP_NotificationControl_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = F1AP_NotificationControl_active; // enum + } + + /* 12.1.2.4 flows_Mapped_To_DRB_List */ // BK: need verifiy + int k; + for (k = 0; k < 1; k ++) { + + F1AP_Flows_Mapped_To_DRB_Item_t flows_mapped_to_drb_item; + memset((void *)&flows_mapped_to_drb_item, 0, sizeof(F1AP_Flows_Mapped_To_DRB_Item_t)); + + /* qoSFlowIndicator */ + flows_mapped_to_drb_item.qoSFlowIndicator = 1L; + + /* qoSFlowLevelQoSParameters */ + { + /* qoS_Characteristics */ + { + int some_decide_qoS_characteristics = 1; // BK: Need Check + if (some_decide_qoS_characteristics) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); + + /* fiveQI */ + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; + + /* OPTIONAL */ + /* qoSPriorityLevel */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; + } + + /* OPTIONAL */ + /* averagingWindow */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; + } + + /* OPTIONAL */ + /* maxDataBurstVolume */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; + } + + } else { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); + + /* qoSPriorityLevel */ + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; + + /* packetDelayBudget */ + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; + + /* packetErrorRate */ + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate = 1L; + + /* OPTIONAL */ + /* delayCritical */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + } + + /* OPTIONAL */ + /* averagingWindow */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + } + + /* OPTIONAL */ + /* maxDataBurstVolume */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + } + + } // if some_decide_qoS_characteristics + + } // qoS_Characteristics + + /* nGRANallocationRetentionPriority */ + { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + } // nGRANallocationRetentionPriority + + /* OPTIONAL */ + /* gBR_QoS_Flow_Information */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); + asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); + asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); + asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); + asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); + + /* OPTIONAL */ + /* maxPacketLossRateDownlink */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + } + + /* OPTIONAL */ + /* maxPacketLossRateUplink */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + } + + } + + /* OPTIONAL */ + /* reflective_QoS_Attribute */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = 1L; + } + + } // qoSFlowLevelQoSParameters + // BK: need check + ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->flows_Mapped_To_DRB_List.list, &flows_mapped_to_drb_item); + } + + } // if some_decide_qos + + /* 12.1.3 uLUPTNLInformation_ToBeSetup_List */ for (j = 0; j < f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl_length; j++) { f1ap_up_tnl_t *up_tnl = &f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j]; - /* ULTunnels_ToBeSetup_Item */ + + /* 12.3.1 ULTunnels_ToBeSetup_Item */ F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; - // gTPTunnel + /* 12.3.1.1 gTPTunnel */ uLUPTNLInformation_ToBeSetup_Item = calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = - F1AP_UPTransportLayerInformation_PR_gTPTunnel; + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + /* 12.3.1.1.1 transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(up_tnl->tl_address, &gTPTunnel->transportLayerAddress); + /* 12.3.1.1.2 gTP_TEID */ INT32_TO_OCTET_STRING(up_tnl->gtp_teid, &gTPTunnel->gTP_TEID); + // Add uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); } - /* rLCMode */ + /* 12.1.4 rLCMode */ /* TODO use rlc_mode from f1ap_drb_to_be_setup */ switch (f1ap_ue_context_setup_req->drbs_to_be_setup[i].rlc_mode) { - case RLC_MODE_AM: - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_am; - break; - default: - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; + case RLC_MODE_AM: + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_am; + break; + default: + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; } /* OPTIONAL */ - /* ULConfiguration */ + /* 12.1.5 ULConfiguration */ if (0) { drbs_toBeSetup_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + drbs_toBeSetup_item.uLConfiguration->uLUEConfiguration = F1AP_ULUEConfiguration_no_data; + } + + /* OPTIONAL */ + /* 12.1.6 duplicationActivation */ + if (0) { + drbs_toBeSetup_item.duplicationActivation = (F1AP_DuplicationActivation_t *)calloc(1, sizeof(F1AP_DuplicationActivation_t)); + drbs_toBeSetup_item.duplicationActivation = F1AP_DuplicationActivation_active; // enum } /* ADD */ @@ -355,11 +689,56 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* OPTIONAL */ + /* InactivityMonitoringRequest */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringRequest; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_InactivityMonitoringRequest; + ie->value.choice.InactivityMonitoringRequest = F1AP_InactivityMonitoringRequest_true; // 0 + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* OPTIONAL */ + /* RAT_FrequencyPriorityInformation */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RAT_FrequencyPriorityInformation; + + int some_decide_rat = 1; // BK: Need Check + if (some_decide_rat) { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 11L; + } else { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 11L; + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* OPTIONAL */ + /* RRCContainer */ if (0) { - //F1AP_InactivityMonitoringRequest_t InactivityMonitoringRequest; - //F1AP_RAT_FrequencyPriorityInformation_t RAT_FrequencyPriorityInformation; - //F1AP_RRCContainer_t RRCContainer; - //F1AP_MaskedIMEISV_t MaskedIMEISV; + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* OPTIONAL */ + /* MaskedIMEISV */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_MaskedIMEISV; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_MaskedIMEISV; + MaskedIMEISV_TO_BIT_STRING(12340000, &ie->value.choice.MaskedIMEISV); // size (64) + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* encode */ @@ -698,7 +1077,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS->qCI = 253L; - /* ULTunnels_ToBeSetupMod_List */ + /* uLUPTNLInformation_ToBeSetup_List */ int j = 0; int maxnoofULTunnels = 1; // 2; for (j=0; @@ -711,13 +1090,15 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + /* transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + /* gTP_TEID */ OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "4567", strlen("4567")); + // Add uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_toBeSetupMod_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 76aa4299a1..7d8a8026c0 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -56,10 +56,13 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; + /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + /* optional */ + /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, false); if (ie) { @@ -70,6 +73,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->gNB_DU_ue_id = NULL; } + /* SpCell_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SpCell_ID, true); PLMNID_TO_MCC_MNC(&ie->value.choice.NRCGI.pLMN_Identity, @@ -78,15 +82,42 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->mnc_digit_length); BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); - /* TODO: decode candidate SpCell */ - /* TODO: decode CUtoDURRCInformation */ + /* ServCellIndex */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_ServCellndex, true); + f1ap_ue_context_setup_req->servCellIndex = ie->value.choice.ServCellIndex; + + /* optional */ + /* CellULConfigured */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SpCellULConfigured, false); // SpCellULConfigured + if (ie) { + f1ap_ue_context_setup_req->cellULConfigured = malloc(sizeof(uint32_t)); + if (f1ap_ue_context_setup_req->cellULConfigured) + f1ap_ue_context_setup_req->cellULConfigured = ie->value.choice.CellULConfigured; + } else { + f1ap_ue_context_setup_req->cellULConfigured = NULL; + } + + /* CUtoDURRCInformation */ + + + /* Candidate_SpCell_List */ + + + /* optional */ + /* DRXCycle */ + + /* optional */ + /* ResourceCoordinationTransferContainer */ + - /* TODO: Candidate_SpCell_List */ + /* SCell_ToBeSetup_List */ - /* TODO: SCell_ToBeSetup_List */ + /* SRBs_ToBeSetup_List */ - /* TODO: SRBs_ToBeSetup_List */ + /* DRBs_ToBeSetup_List */ /* Decode DRBs_ToBeSetup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index ef0b6d1f5c..6d957e4ad6 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -37,6 +37,8 @@ #include "f1ap_du_interface_management.h" #include "f1ap_cu_rrc_message_transfer.h" #include "f1ap_du_rrc_message_transfer.h" +#include "f1ap_cu_ue_context_management.h" +#include "f1ap_du_ue_context_management.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; @@ -49,7 +51,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* ErrorIndication */ { 0, 0, 0 }, /* gNBDUConfigurationUpdate */ { 0, 0, 0 }, /* gNBCUConfigurationUpdate */ - { 0, 0, 0 }, /* UEContextSetup */ + { DU_handle_UE_CONTEXT_SETUP_REQUEST, CU_handle_UE_CONTEXT_SETUP_RESPONSE, 0 }, /* UEContextSetup */ { 0, 0, 0 }, /* UEContextRelease */ { 0, 0, 0 }, /* UEContextModification */ { 0, 0, 0 }, /* UEContextModificationRequired */ diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index e2773aeedf..4763352af7 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -283,7 +283,7 @@ do { \ } while(0) -/* TS 38.473 v15.1.1 section 9.3.2.3: +/* TS 38.473 v15.2.1 section 9.3.2.3: * TRANSPORT LAYER ADDRESS for IPv4 is 32bit (TS 38.414) */ #define TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(mACRO, bITsTRING) \ @@ -323,6 +323,38 @@ do { \ (bITsTRING)->bits_unused = 4; \ } while(0) +/* TS 38.473 v15.2.1 section 9.3.1.55: + * MaskedIMEISV is BIT_STRING(64) + */ +#define MaskedIMEISV_TO_BIT_STRING(mACRO, bITsTRING) \ +do { \ + (bITsTRING)->buf = calloc(8, sizeof(uint8_t)); \ + (bITsTRING)->buf[0] = (mACRO) >> 56 & 0xFF; \ + (bITsTRING)->buf[1] = (mACRO) >> 48 & 0xFF; \ + (bITsTRING)->buf[2] = (mACRO) >> 40 & 0xFF; \ + (bITsTRING)->buf[3] = (mACRO) >> 32 & 0xFF; \ + (bITsTRING)->buf[4] = (mACRO) >> 24 & 0xFF; \ + (bITsTRING)->buf[5] = (mACRO) >> 16 & 0xFF; \ + (bITsTRING)->buf[6] = (mACRO) >> 8 & 0xFF; \ + (bITsTRING)->buf[7] = (mACRO) >> 4 & 0xFF; \ + (bITsTRING)->size = 8; \ + (bITsTRING)->bits_unused = 0; \ +} while(0) + +#define BIT_STRING_TO_MaskedIMEISV(bITsTRING, mACRO) \ +do { \ + DevCheck((bITsTRING)->size == 8, (bITsTRING)->size, 8, 0); \ + DevCheck((bITsTRING)->bits_unused == 0, (bITsTRING)->bits_unused, 0, 0); \ + mACRO = ((bITsTRING)->buf[0] << 56) + \ + ((bITsTRING)->buf[1] << 48) + \ + ((bITsTRING)->buf[2] << 40) + \ + ((bITsTRING)->buf[3] << 32) + \ + ((bITsTRING)->buf[4] << 24) + \ + ((bITsTRING)->buf[5] << 16) + \ + ((bITsTRING)->buf[6] << 8) + \ + ((bITsTRING)->buf[7]); \ +} while (0) + /* TS 36.413 v10.9.0 section 9.2.1.37: * Macro eNB ID: * Equal to the 20 leftmost bits of the Cell -- GitLab From a7be0cc2a81592e69ad93da36f78e22d76643aba Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Wed, 19 Sep 2018 19:47:11 +0200 Subject: [PATCH 093/308] send F1AP_UL_RRC_MESSAGE from rrc --- openair2/COMMON/f1ap_messages_types.h | 2 + openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_cu_task.c | 4 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 25 ++++----- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 6 +-- openair2/F1AP/f1ap_du_task.c | 7 +++ openair2/RRC/LTE/rrc_defs.h | 6 +++ openair2/RRC/LTE/rrc_eNB.c | 55 +++++++++++++++++--- openair2/RRC/LTE/rrc_eNB_S1AP.c | 22 ++++++++ 9 files changed, 101 insertions(+), 28 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index fbc5995617..ed04cc704e 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -83,6 +83,8 @@ typedef struct f1ap_setup_req_s { uint16_t sctp_in_streams; uint16_t sctp_out_streams; + uint16_t default_sctp_stream_id; + // F1_Setup_Req payload uint64_t gNB_DU_id; char *gNB_DU_name; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 802cd167a2..4948e2ebe1 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -271,7 +271,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return -1; } - cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id, buffer, len, 0); + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/ , buffer, len, 0 /* BK: fix me*/); return 0; } diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index eeed466ceb..ccdc85fa69 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -147,10 +147,8 @@ void *F1AP_CU_task(void *arg) { case F1AP_DL_RRC_MESSAGE: // from rrc LOG_I(CU_F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); - // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - // &F1AP_SETUP_RESP(received_msg)); CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &F1AP_SETUP_RESP(received_msg)); + &F1AP_DL_RRC_MESSAGE(received_msg)); break; // case F1AP_SETUP_RESPONSE: // This is from RRC diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 9149607e96..0b8a67ce93 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -94,13 +94,15 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); // this should be the one transmitted via initial ul rrc message transfer + LOG_D(DU_F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer if (f1ap_du_add_cu_ue_id(&f1ap_du_ue[instance],du_ue_f1ap_id,cu_ue_f1ap_id) < 0 ) { LOG_E(DU_F1AP, "Failed to find the F1AP UID \n"); //return -1; } - + /* optional */ /* oldgNB_DU_UE_F1AP_ID */ if (0) { @@ -160,11 +162,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } -//void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, - rb_id_t srb_idP, - uint8_t *sduP, - sdu_size_t sdu_lenP) { +int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, + f1ap_ul_rrc_message_t *f1ap_ul_rrc) { LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); @@ -191,7 +190,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)]; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[instance].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], f1ap_ul_rrc->rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -200,7 +199,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)]; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[instance].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], f1ap_ul_rrc->rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -209,7 +208,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_SRBID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = srb_idP; + ie->value.choice.SRBID = f1ap_ul_rrc->srb_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); // issue in here @@ -219,7 +218,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, f1ap_ul_rrc->rrc_container, f1ap_ul_rrc->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ @@ -228,9 +227,11 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, return -1; } + du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); return 0; } + /* UL RRC Message Transfer */ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, @@ -323,7 +324,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, return -1; } - du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); + du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index e0f2f8f71f..a8e704aaa4 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -39,10 +39,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, - rb_id_t srb_idP, - uint8_t *sduP, - sdu_size_t sdu_lenP); +int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, + f1ap_ul_rrc_message_t *f1ap_ul_rrc); int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 3f99810a22..73dc40e655 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -93,6 +93,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; + f1ap_du_data->default_sctp_stream_id = 0; DU_send_F1_SETUP_REQUEST(instance); @@ -159,6 +160,12 @@ void *F1AP_DU_task(void *arg) { &received_msg->ittiMsg.sctp_data_ind); break; + case F1AP_UL_RRC_MESSAGE: // from rrc + LOG_I(DU_F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); + DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_UL_RRC_MESSAGE(received_msg)); + break; + case TERMINATE_MESSAGE: LOG_W(DU_F1AP, " *** Exiting DU_F1AP thread\n"); itti_exit_task(); diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 7408f64f35..0c81a04a7f 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -512,6 +512,11 @@ typedef struct HANDOVER_INFO_UE_s { uint8_t measFlag; } HANDOVER_INFO_UE; +typedef struct RRC_CONTAINER_s{ + char *buffer; + uint8_t size; +} RRC_CONTAINER_t; + typedef struct eNB_RRC_UE_s { uint8_t primaryCC_id; #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) @@ -539,6 +544,7 @@ typedef struct eNB_RRC_UE_s { HANDOVER_INFO* handover_info; MeasResults_t* measResults; + RRC_CONTAINER_t *security_mode_cmd; UE_EUTRA_Capability_t* UE_Capability; ImsiMobileIdentity_t imsi; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 720c23ce9d..1f58e85668 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1095,7 +1095,28 @@ rrc_eNB_process_RRCConnectionSetupComplete( rrc_eNB_generate_SecurityModeCommand( ctxt_pP, ue_context_pP); +/* + if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)) { + +message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UE_CONTEXT_SETUP_REQ); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload; + + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); + } +*/ // rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP); + } } @@ -1146,7 +1167,9 @@ rrc_eNB_generate_SecurityModeCommand( rrc_eNB_mui, size); - rrc_data_req( + if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB)) { + rrc_data_req( ctxt_pP, DCCH, rrc_eNB_mui++, @@ -1154,6 +1177,7 @@ rrc_eNB_generate_SecurityModeCommand( size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); + } } @@ -6944,14 +6968,29 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. present == RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - rrc_eNB_process_RRCConnectionSetupComplete( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); - ue_context_p->ue_context.Status = RRC_CONNECTED; - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", + + if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU) ) { + MessageDef *message_p; + message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UL_RRC_MESSAGE); + F1AP_UL_RRC_MESSAGE (message_p).rrc_container = &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8; + F1AP_UL_RRC_MESSAGE (message_p).rrc_container_length = strlen(&ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); + F1AP_UL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_UL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; + F1AP_UL_RRC_MESSAGE (message_p).rnti = ue_context_p->ue_context.rnti; + F1AP_UL_RRC_MESSAGE (message_p).srb_id = DCCH; + itti_send_msg_to_task (TASK_DU_F1, ctxt_pP->module_id, message_p); + LOG_D(RRC, "Send F1AP_UL_RRC_MESSAGE with ITTI\n"); + } else { //if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) || + // (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB) ) { + rrc_eNB_process_RRCConnectionSetupComplete( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); + ue_context_p->ue_context.Status = RRC_CONNECTED; + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - + } //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future if (rrc_agent_registered[ctxt_pP->module_id]) { agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 7d24228602..15ea141301 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1059,6 +1059,28 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char rrc_eNB_generate_UECapabilityEnquiry (&ctxt, ue_context_p); } } +/* + if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) || + (RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) || + (RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){ + + message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UE_CONTEXT_SETUP_REQ); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload; + + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); + + } +*/ + return (0); } } -- GitLab From 578ce9ebe124fcc9c6e9e598d6a0fef2b9c58544 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Wed, 19 Sep 2018 20:14:55 +0200 Subject: [PATCH 094/308] up to RRCConnectionSetupComplete Transmission in UE --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 25 ++++- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 109 ++++++++++--------- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 4 +- openair2/LAYER2/RLC/rlc.c | 23 ++-- 4 files changed, 100 insertions(+), 61 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index edf267240a..37f4b50af8 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -45,6 +45,7 @@ #include "rrc_extern.h" #include "common/ran_context.h" +#include "rrc_eNB_UE_context.h" // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which @@ -179,7 +180,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, &asn_DEF_DL_CCCH_Message, (void**)&dl_ccch_msg, ie->value.choice.RRCContainer.buf, - ie->value.choice.RRCContainer.size,0,0); + rrc_dl_sdu_len,0,0); switch (dl_ccch_msg->message.choice.c1.present) { case DL_CCCH_MessageType__c1_PR_NOTHING: @@ -242,7 +243,19 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // This should be somewhere in the f1ap_cudu_ue_inst_t int macrlc_instance = 0; - + + rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); + + eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); + + memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, + (void*)ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len); + + ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; + rrc_mac_config_req_eNB( macrlc_instance, 0, //primaryCC_id, @@ -250,7 +263,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) 0, #endif - f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id), //rnti + rnti, (BCCH_BCH_Message_t *) NULL, (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) @@ -462,6 +475,12 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, return -1; } + struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]); + ue_context_p->ue_id_rnti = rntiP; + ue_context_p->ue_context.rnti = rntiP; + ue_context_p->ue_context.random_ue_identity = rntiP; + ue_context_p->ue_context.Srb0.Active = 1; + RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); return 0; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 3309ba7b9f..a5039f8e8d 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -608,13 +608,13 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, { - eNB_MAC_INST *mac = RC.mac[module_idP]; - COMMON_channels_t *cc = mac->common_channels; - int16_t rrc_sdu_length; - int UE_id = -1; - uint16_t msg4_padding; - uint16_t msg4_post_padding; - uint16_t msg4_header; + eNB_MAC_INST *mac = RC.mac[module_idP]; + COMMON_channels_t *cc = mac->common_channels; + int16_t rrc_sdu_length; + int UE_id = -1; + uint16_t msg4_padding; + uint16_t msg4_post_padding; + uint16_t msg4_header; uint8_t *vrb_map; int first_rb; @@ -1021,55 +1021,52 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, UE_RNTI(module_idP,UE_id),1, // 1 transport block &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case - - LOG_D(MAC, + + if (rrc_sdu_length > 0) { + LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n", module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length); - - // AssertFatal(rrc_sdu_length > 0, - // "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length); - - - - if (rrc_sdu_length > 0) LOG_I(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n", - module_idP, CC_idP, frameP, subframeP, ra->rnti); - else LOG_I(MAC, - "eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 without RRC Piggyback (RNTI %x)\n", - module_idP, CC_idP, frameP, subframeP, ra->rnti); - - /// Choose first 4 RBs for Msg4, should really check that these are free! - first_rb = 0; + + // AssertFatal(rrc_sdu_length > 0, + // "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length); + + + + LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n", + module_idP, CC_idP, frameP, subframeP, ra->rnti); - vrb_map[first_rb] = 1; - vrb_map[first_rb + 1] = 1; - vrb_map[first_rb + 2] = 1; - vrb_map[first_rb + 3] = 1; - - - // Compute MCS/TBS for 3 PRB (coded on 4 vrb) - msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header - - if ((rrc_sdu_length + msg4_header) <= 22) { - ra->msg4_mcs = 4; - ra->msg4_TBsize = 22; - } else if ((rrc_sdu_length + msg4_header) <= 28) { - ra->msg4_mcs = 5; - ra->msg4_TBsize = 28; - } else if ((rrc_sdu_length + msg4_header) <= 32) { - ra->msg4_mcs = 6; - ra->msg4_TBsize = 32; + /// Choose first 4 RBs for Msg4, should really check that these are free! + first_rb = 0; + + vrb_map[first_rb] = 1; + vrb_map[first_rb + 1] = 1; + vrb_map[first_rb + 2] = 1; + vrb_map[first_rb + 3] = 1; + + + // Compute MCS/TBS for 3 PRB (coded on 4 vrb) + msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header + + if ((rrc_sdu_length + msg4_header) <= 22) { + ra->msg4_mcs = 4; + ra->msg4_TBsize = 22; + } else if ((rrc_sdu_length + msg4_header) <= 28) { + ra->msg4_mcs = 5; + ra->msg4_TBsize = 28; + } else if ((rrc_sdu_length + msg4_header) <= 32) { + ra->msg4_mcs = 6; + ra->msg4_TBsize = 32; } else if ((rrc_sdu_length + msg4_header) <= 41) { - ra->msg4_mcs = 7; - ra->msg4_TBsize = 41; + ra->msg4_mcs = 7; + ra->msg4_TBsize = 41; } else if ((rrc_sdu_length + msg4_header) <= 49) { - ra->msg4_mcs = 8; - ra->msg4_TBsize = 49; + ra->msg4_mcs = 8; + ra->msg4_TBsize = 49; } else if ((rrc_sdu_length + msg4_header) <= 57) { - ra->msg4_mcs = 9; - ra->msg4_TBsize = 57; + ra->msg4_mcs = 9; + ra->msg4_TBsize = 57; } - + fill_nfapi_dl_dci_1A(dl_config_pdu, 4, // aggregation_level ra->rnti, // rnti 1, // rnti_type, CRNTI @@ -1080,7 +1077,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, 1, // ndi 0, // rv 0); // vrb_flag - + LOG_D(MAC, "Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n", frameP, subframeP, dl_req_body->number_pdu, @@ -1218,6 +1215,18 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti); } } // CCE Allocation feasible + } + else { + LOG_I(MAC, + "eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Delaying Msg4 for RRC Piggyback (RNTI %x)\n", + module_idP, CC_idP, frameP, subframeP, ra->rnti); + ra->Msg4_subframe ++; + if (ra->Msg4_subframe == 10) { + ra->Msg4_frame++; + ra->Msg4_frame&=1023; + ra->Msg4_subframe = 0; + } + } } // msg4 frame/subframe } // else rach_resource_type } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index e3fec20747..972d4f16ef 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -396,7 +396,9 @@ boolean_t pdcp_data_req( free_mem_block(pdcp_pdu_p, __FUNCTION__); rlc_status = ack_result; } + else +#endif /*UETARGET*/ { //It should never get here rlc_status = rlc_data_req(ctxt_pP @@ -413,7 +415,7 @@ boolean_t pdcp_data_req( #endif ); } -#endif /*UETARGET*/ + } switch (rlc_status) { diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 793e140641..0219dd4345 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -690,7 +690,7 @@ void rlc_data_ind ( sdu_pP); } else -#endif /*UETARGET*/ + { switch (RC.rrc[ctxt_pP->module_id]->node_type){ @@ -727,6 +727,15 @@ void rlc_data_ind ( } } +#else + pdcp_data_ind ( + ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, + sdu_sizeP, + sdu_pP); +#endif } //----------------------------------------------------------------------------- void rlc_data_conf (const protocol_ctxt_t* const ctxt_pP, @@ -797,19 +806,19 @@ rlc_module_init (void) pool_buffer_init(); - +/* #ifndef UETARGET - /* Launch the RLC listening server - * as a separate thread - */ + // Launch the RLC listening server + // as a separate thread + static int started = 0; if (started == 0) { async_server_thread_init(); started = 1; } -#endif /*UETARGET*/ - +#endif +*/ return(0); } //----------------------------------------------------------------------------- -- GitLab From cee89cb389245b2fd13a0ddf31b9741b78180f82 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Wed, 19 Sep 2018 21:22:24 +0200 Subject: [PATCH 095/308] Send the UL_RRC_MESSAGE over DCCH from CU to RRC --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 28 ++++++++++++++------ openair2/LAYER2/RLC/rlc.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 3 +-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 4948e2ebe1..638717b54f 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -332,7 +332,10 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; - LOG_D(CU_F1AP, "srb_id %lu \n", srb_id); + if (srb_id < 1 ) + LOG_E(CU_F1AP, "Unexpected UL RRC MESSAGE for srb_id %lu (CCCH)\n", srb_id); + else + LOG_D(CU_F1AP, "UL RRC MESSAGE for srb_id %lu in DCCH \n", srb_id); // issue in here @@ -340,16 +343,25 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - // BK: need check - // create an ITTI message and copy SDU - message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); - memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - ccch_sdu_len = ie->value.choice.RRCContainer.size; - memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, - ccch_sdu_len); + // print message in debug mode LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); LOG_D(CU_F1AP, "\n"); + // create an ITTI message and copy SDU + message_p = itti_alloc_new_message (TASK_CU_F1, RRC_DCCH_DATA_IND); + memset (RRC_DCCH_DATA_IND (message_p).sdu_p, 0, CCCH_SDU_SIZE); + + RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size; + memcpy(RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf, + ie->value.choice.RRCContainer.size); + + RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id; + RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id); + RRC_DCCH_DATA_IND (message_p).module_id = instance; + RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU + + itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); + return 0; } diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 793e140641..17918cd5ae 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -63,7 +63,7 @@ async_server_thread_init (void) //create log_list //log_list_init(&log_list); - AssertFatal(0, "this should not be reached!\n"); + //AssertFatal(0, "this should not be reached!\n"); async_server_shutdown = 0; if ((pthread_mutex_init (&async_server_lock, NULL) != 0) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 1f58e85668..4c54f75d29 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6981,8 +6981,7 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { F1AP_UL_RRC_MESSAGE (message_p).srb_id = DCCH; itti_send_msg_to_task (TASK_DU_F1, ctxt_pP->module_id, message_p); LOG_D(RRC, "Send F1AP_UL_RRC_MESSAGE with ITTI\n"); - } else { //if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) || - // (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB) ) { + } else { // eNB or CU node type rrc_eNB_process_RRCConnectionSetupComplete( ctxt_pP, ue_context_p, -- GitLab From a6d3efb9a4622b26baf560497d351f3b324f3394 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Thu, 20 Sep 2018 00:12:46 +0200 Subject: [PATCH 096/308] minor changes for testing --- openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c | 3 ++- openair1/SCHED_UE/phy_procedures_lte_ue.c | 7 ++++--- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 6 ++++-- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 6 +++++- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 4 ++-- openair2/LAYER2/MAC/mac.h | 2 ++ 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index e0ea796a82..799a450fbf 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -46,6 +46,7 @@ //#define DEBUG_DCI + #include "../LTE_TRANSPORT/dci_tools_common_extern.h" #include "../LTE_TRANSPORT/transport_proto.h" #include "transport_proto_ue.h" @@ -3326,7 +3327,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, harq_pid = subframe2harq_pid(frame_parms, pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe), pdcch_alloc2ul_subframe(frame_parms,subframe)); - LOG_D(PHY,"Frame %d, Subframe %d: Programming ULSCH for (%d.%d) => harq_pid %d\n", + LOG_I(PHY,"Frame %d, Subframe %d: Programming ULSCH for (%d.%d) => harq_pid %d\n", proc->frame_rx,subframe, pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe), pdcch_alloc2ul_subframe(frame_parms,subframe), harq_pid); diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index b7d05ba006..c6917b3996 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -73,6 +73,7 @@ extern double cpuf; + void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); @@ -1657,7 +1658,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB } - if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)){ + if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)){ LOG_D(PHY, "[UE %d][PUSCH %d] AbsSubframe %d.%d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, " "cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, ack_status_cw0 %d ack_status_cw1 %d bundling %d, Nbundled %d, CQI %d, RI %d\n", @@ -1679,7 +1680,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB ue->ulsch[eNB_id]->bundling, Nbundled, cqi_status, ri_status); - } + } @@ -2900,7 +2901,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint // we received a CRNTI, so we're in PUSCH if (ue->UE_mode[eNB_id] != PUSCH) { if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti); + LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti); } //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 37f4b50af8..52e321e553 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -67,7 +67,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - +#ifndef UETARGET LOG_D(DU_F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); MessageDef *message_p; @@ -308,6 +308,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, else if (srb_id == 2){ } +#endif return 0; } @@ -390,7 +391,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, rnti_t rntiP, uint8_t *sduP, sdu_size_t sdu_lenP) { - +#ifndef UETARGET F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransferIEs_t *ie; @@ -482,6 +483,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ue_context_p->ue_context.Srb0.Active = 1; RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); +#endif return 0; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index a5039f8e8d..efb41267cc 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -1221,6 +1221,9 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, "eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Delaying Msg4 for RRC Piggyback (RNTI %x)\n", module_idP, CC_idP, frameP, subframeP, ra->rnti); ra->Msg4_subframe ++; + ra->Msg4_delay_cnt++; + if (ra->Msg4_delay_cnt==10) cancel_ra_proc(module_idP, CC_idP, frameP, ra->rnti); + if (ra->Msg4_subframe == 10) { ra->Msg4_frame++; ra->Msg4_frame&=1023; @@ -1520,6 +1523,7 @@ initiate_ra_proc(module_id_t module_idP, LOG_D(MAC, "Frame %d, Subframe %d: Activating RA process %d\n", frameP, subframeP, i); ra[i].state = MSG2; + ra[i].Msg4_delay_cnt=0; ra[i].timing_offset = timing_offset; ra[i].preamble_subframe = subframeP; #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) @@ -1632,7 +1636,7 @@ cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, ra[i].RRC_timer = 20; ra[i].rnti = 0; ra[i].msg3_round = 0; - LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Canceled RA procedure for UE rnti %x\n", module_idP, CC_id, frameP, rnti); + LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Canceled RA procedure for UE rnti %x\n", module_idP, CC_id, frameP, rnti); } } } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 79939b061d..e1fce9c5f2 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -191,7 +191,7 @@ rx_sdu(const module_id_t enb_mod_idP, if (UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes < 0) UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0; } else { // we've got an error - LOG_I(MAC, + LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d\n", enb_mod_idP, harq_pid, CC_idP,frameP,subframeP, UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid], @@ -378,7 +378,7 @@ rx_sdu(const module_id_t enb_mod_idP, ); // prepare transmission of Msg4(RRCConnectionReconfiguration) ra->state = MSGCRNTI; - LOG_I(MAC, + LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) RRCConnectionReconfiguration(Msg4)\n", enb_mod_idP, frameP, subframeP, CC_idP, old_rnti, old_UE_id); diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 8804849a4a..20c585525a 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -1009,6 +1009,8 @@ typedef struct { sub_frame_t Msg3_subframe; /// Frame where Msg3 is to be sent frame_t Msg3_frame; + /// Delay cnt for Msg4 transmission (waiting for RRC message piggyback) + int Msg4_delay_cnt; /// Subframe where Msg4 is to be sent sub_frame_t Msg4_subframe; /// Frame where Msg4 is to be sent -- GitLab From 43def3d76cf64b3ed3ac670b8f86b76c52bdbef6 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Thu, 20 Sep 2018 01:38:57 +0200 Subject: [PATCH 097/308] crashes inside DU_send_UL_RRC_MESSAGE_TRANSFER --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 18 ++++++++++++++++-- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c | 3 ++- openair2/LAYER2/RLC/rlc.c | 8 ++++---- openair2/LAYER2/RLC/rlc_mac.c | 6 +++--- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index b848f57659..651491aba7 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -209,7 +209,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(RRC, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); // Get configuration RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; @@ -243,6 +243,20 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } } + protocol_ctxt_t ctxt; + ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id); + ctxt.module_id = instance; + ctxt.enb_flag = 1; + rrc_rlc_config_asn1_req(&ctxt, + SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL +#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (PMCH_InfoList_r9_t *) NULL, + 0,0 +# endif + ); + // This should be somewhere in the f1ap_cudu_ue_inst_t int macrlc_instance = 0; @@ -318,7 +332,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, f1ap_ul_rrc_message_t *f1ap_ul_rrc) { - LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); + LOG_I(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index e1fce9c5f2..69a6ff4612 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -686,7 +686,7 @@ rx_sdu(const module_id_t enb_mod_idP, //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4; } - LOG_D(MAC, + LOG_I(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n", enb_mod_idP, CC_idP, frameP, rx_lengths[i], UE_id, rx_lcids[i]); diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index d4e43fda47..e3f2e22f8e 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -42,7 +42,7 @@ #include "UL-AM-RLC.h" #include "DL-AM-RLC.h" - +#define TRACE_RLC_AM_PDU 1 //----------------------------------------------------------------------------- uint32_t rlc_am_get_status_pdu_buffer_occupancy( @@ -936,6 +936,7 @@ rlc_am_mac_data_indication ( (void)l_rlc_p; /* avoid gcc warning "unused variable" */ + LOG_I(RLC, "In rlc_am_mac_indication: size %d\n",tb_size_in_bytes); #if TRACE_RLC_AM_PDU || MESSAGE_CHART_GENERATOR if (data_indP.data.nb_elements > 0) { diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index da568c86f8..3ecd794a06 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -665,15 +665,15 @@ void rlc_data_ind ( //----------------------------------------------------------------------------- -#if defined(TRACE_RLC_PAYLOAD) - LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] Display of rlc_data_ind: size %u\n", + //#if defined(TRACE_RLC_PAYLOAD) + LOG_I(RLC, PROTOCOL_CTXT_FMT"[%s %u] Display of rlc_data_ind: size %u\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, sdu_sizeP); - rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP); -#endif + // rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP); + //#endif #if T_TRACER if (ctxt_pP->enb_flag) diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index dbc2d1d342..b3d8d36dc5 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -38,7 +38,7 @@ #include "assertions.h" #include "common/utils/LOG/vcd_signal_dumper.h" -//#define DEBUG_MAC_INTERFACE 1 +#define DEBUG_MAC_INTERFACE 1 //----------------------------------------------------------------------------- struct mac_data_ind mac_rlc_deserialize_tb ( @@ -260,7 +260,7 @@ void mac_rlc_data_ind ( #ifdef DEBUG_MAC_INTERFACE if (num_tbP) { - LOG_D(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n", + LOG_I(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n", PROTOCOL_CTXT_ARGS(&ctxt), channel_idP, RLC_MAX_LC, @@ -292,7 +292,7 @@ void mac_rlc_data_ind ( rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; - //AssertFatal (0 , "%s RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP); + AssertFatal (0 , "%s RLC not configured lcid %u ! (h_rc %d)\n", __FUNCTION__,channel_idP,h_rc); } struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP); -- GitLab From ac5e8cbdfc1e2e931787ba1854472054e92d7877 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Thu, 20 Sep 2018 02:10:49 +0200 Subject: [PATCH 098/308] UL_RRC_MESSAGE_TRANSFER arrives in CU, which crashes :-( --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 23 ++++++++++++++------ openair2/F1AP/f1ap_du_rrc_message_transfer.h | 9 ++++++-- openair2/LAYER2/RLC/rlc.c | 12 +++++----- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 651491aba7..63066a4b8d 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -329,10 +329,15 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } -int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - f1ap_ul_rrc_message_t *f1ap_ul_rrc) { +int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, + const rb_id_t rb_idP, + const sdu_size_t sdu_sizeP, + const uint8_t *sdu_pP + ) { - LOG_I(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); + + + rnti_t rnti = ctxt_pP->rnti; F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; @@ -357,7 +362,11 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[instance].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], f1ap_ul_rrc->rnti)]; + + instance_t instance = ctxt_pP->module_id; + + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[instance].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], rnti)]; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -366,7 +375,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[instance].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], f1ap_ul_rrc->rnti)]; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[instance].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -375,7 +384,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_SRBID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = f1ap_ul_rrc->srb_id; + ie->value.choice.SRBID = rb_idP; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); // issue in here @@ -385,7 +394,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, f1ap_ul_rrc->rrc_container, f1ap_ul_rrc->rrc_container_length); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sdu_pP, sdu_sizeP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index a8e704aaa4..3ec4762932 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -39,9 +39,14 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, +int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_p, + const rb_id_t rb_id, + const sdu_size_t sdu_size, + const uint8_t *sdu_p); +/* + instance_t instance, f1ap_ul_rrc_message_t *f1ap_ul_rrc); - +*/ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, int UE_id, diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 3ecd794a06..f377869edd 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -705,14 +705,12 @@ void rlc_data_ind ( sdu_sizeP, sdu_pP); break; - case ngran_eNB_DU : + case ngran_eNB_DU : case ngran_gNB_DU : - DU_send_UL_RRC_MESSAGE_TRANSFER( - ctxt_pP, - rb_idP, - sdu_pP, - sdu_sizeP - ); + DU_send_UL_RRC_MESSAGE_TRANSFER(ctxt_pP, + rb_idP, + sdu_sizeP, + sdu_pP->data); break; default: -- GitLab From 2acdfc14b2d5af72e5bd30f64d09e437eb4829f7 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Thu, 20 Sep 2018 02:24:43 +0200 Subject: [PATCH 099/308] UL_RRC_MESSAGE_TRANSFER correctly received in CU. But : it shouldn't go directly to RRC, it has to go through PDCP via pdcp_data_ind --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 638717b54f..0a9e260aae 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -333,7 +333,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; if (srb_id < 1 ) - LOG_E(CU_F1AP, "Unexpected UL RRC MESSAGE for srb_id %lu (CCCH)\n", srb_id); + LOG_E(CU_F1AP, "Unexpected UL RRC MESSAGE for srb_id %lu \n", srb_id); else LOG_D(CU_F1AP, "UL RRC MESSAGE for srb_id %lu in DCCH \n", srb_id); @@ -344,13 +344,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); // print message in debug mode - LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - LOG_D(CU_F1AP, "\n"); // create an ITTI message and copy SDU + + message_p = itti_alloc_new_message (TASK_CU_F1, RRC_DCCH_DATA_IND); - memset (RRC_DCCH_DATA_IND (message_p).sdu_p, 0, CCCH_SDU_SIZE); + + RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size); RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size; memcpy(RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf, -- GitLab From 5f758074ef3dc5652125d5f5dacba9c1008e9d6c Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Thu, 20 Sep 2018 02:53:26 +0200 Subject: [PATCH 100/308] RRCConnectionSetupComplete received in CU! (needed to allocate mem_pool for pdcp. remaining transactions on SRB1 and then SRB2 need to use PDCP (DCCH). --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 16 ++++++++++++++-- openair2/F1AP/f1ap_cu_task.c | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 0a9e260aae..1b30602cdf 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -346,7 +346,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, // print message in debug mode // create an ITTI message and copy SDU - + /* message_p = itti_alloc_new_message (TASK_CU_F1, RRC_DCCH_DATA_IND); @@ -362,6 +362,18 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); - + */ + protocol_ctxt_t ctxt; + ctxt.module_id = instance; + ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id); + ctxt.enb_flag = 1; + mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); + memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); + pdcp_data_ind (&ctxt, + 1, + 0, + srb_id, + ie->value.choice.RRCContainer.size, + mb); return 0; } diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index ccdc85fa69..55a1160c46 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -111,6 +111,9 @@ void *F1AP_CU_task(void *arg) { LOG_I(CU_F1AP,"Starting F1AP at CU\n"); + // no RLC in CU, initialize mem pool for PDCP + pool_buffer_init(); + itti_mark_task_ready(TASK_CU_F1); cu_task_send_sctp_init_req(0); -- GitLab From f060385b6aa24eda619f9cb92f7827a16b7020e0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 10:25:23 +0200 Subject: [PATCH 101/308] Improve UDP support of ASYNC_IF * peer_addr is now const * new_link_udp_server() can bind to address or INADDR_ANY * socket_udp_receive() happens without a loop * socket_udp_send() happens without a loop * sending in two packets (first size, then data) is only performed for TCP, SCTP, not for UDP anymore (it is unreliable, so we could miss something and will receive complete garbage) --- openair2/UTIL/ASYNC_IF/link_manager.c | 2 +- openair2/UTIL/ASYNC_IF/link_manager.h | 2 +- openair2/UTIL/ASYNC_IF/socket_link.c | 137 +++++++++++--------------- openair2/UTIL/ASYNC_IF/socket_link.h | 7 +- 4 files changed, 64 insertions(+), 84 deletions(-) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 7486fbd171..ddbb89fdaa 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -76,7 +76,7 @@ static void *link_manager_receiver_thread(void *_manager) LOG_D(MAC, "starting link manager receiver thread\n"); while (manager->run) { - if (link_receive_packet(manager->socket_link, &data, &size, manager->type, manager->peer_addr, manager->port)) + if (link_receive_packet(manager->socket_link, &data, &size, manager->type)) goto error; /* todo: priority */ if (message_put(manager->receive_queue, data, size, 0)) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index f7efc92867..f749119de6 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -46,7 +46,7 @@ typedef struct { message_queue_t *receive_queue; socket_link_t *socket_link; uint16_t type; - char *peer_addr; + const char *peer_addr; int port; pthread_t sender; pthread_t receiver; diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index e7100a2797..d8dcb764e9 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -163,8 +163,8 @@ error: return NULL; } -socket_link_t *new_link_udp_server(int port){ - +socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port) +{ socket_link_t *ret = NULL; struct sockaddr_in si_me; @@ -181,19 +181,25 @@ socket_link_t *new_link_udp_server(int port){ //create a UDP socket if ((socket_server=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { - goto error; + goto error; } // zero out the structure memset((char *) &si_me, 0, sizeof(si_me)); si_me.sin_family = AF_INET; - si_me.sin_port = htons(port); - si_me.sin_addr.s_addr = INADDR_ANY; + si_me.sin_port = htons(bind_port); + if (bind_addr) { + if (!inet_aton(bind_addr, &si_me.sin_addr)) + goto error; + } else { + si_me.sin_addr.s_addr = INADDR_ANY; + } //bind socket to port if( bind(socket_server , (struct sockaddr*)&si_me, sizeof(si_me) ) == -1) { - goto error; + fprintf(stderr, "could not bind to address %s: %s\n", bind_addr, strerror(errno)); + goto error; } ret->socket_fd = socket_server; ret->peer_port = 0; @@ -356,13 +362,11 @@ error: return NULL; } -static int socket_udp_send(int socket_fd, void *buf, int size, char *peer_addr, int port) +static int socket_udp_send(int socket_fd, void *buf, int size, const char *peer_addr, int port) { - struct sockaddr_in si_other; int slen = sizeof(si_other); - char *s = buf; - int l; + int l; int my_socket; LOG_D(PROTO_AGENT,"UDP send\n"); @@ -378,15 +382,10 @@ static int socket_udp_send(int socket_fd, void *buf, int size, char *peer_addr, exit(1); } - while (size) { - l = sendto(my_socket, s, size, 0, (struct sockaddr *) &si_other, slen); - if (l == -1) goto error; - if (l == 0) { printf("\n\n\nERROR PROTO_AGENT: %s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } - size -= l; - s += l; - } + l = sendto(my_socket, buf, size, 0, (struct sockaddr *) &si_other, slen); + if (l == -1) goto error; - return 0; + return l; error: LOG_E(MAC,"socket_udp_send: ERROR: %s\n", strerror(errno)); return -1; @@ -398,20 +397,14 @@ static int socket_udp_receive(int socket_fd, void *buf, int size) struct sockaddr_in client; socklen_t slen; - char *s = buf; int l; - while (size) { - l = recvfrom(socket_fd, s, size, 0, (struct sockaddr *) &client, &slen); - getsockname(socket_fd, (struct sockaddr *)&client, &slen); - LOG_D(PROTO_AGENT, "Got message from src port: %u\n", ntohs(client.sin_port)); - if (l == -1) goto error; - if (l == 0) goto socket_closed; - size -= l; - s += l; - } + l = recvfrom(socket_fd, buf, size, 0, (struct sockaddr *) &client, &slen); + //getsockname(socket_fd, (struct sockaddr *)&client, &slen); + if (l == -1) goto error; + if (l == 0) goto socket_closed; - return ntohs(client.sin_port); + return l; error: LOG_E(MAC, "socket_udp_receive: ERROR: %s\n", strerror(errno)); @@ -476,18 +469,18 @@ socket_closed: /* * return -1 on error and 0 if the sending was fine */ -int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, char *peer_addr, int port) +int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, const char *peer_addr, int peer_port) { char sizebuf[4]; int32_t s = size; - /* send the size first, maximum is 2^31 bytes */ - sizebuf[0] = (s >> 24) & 255; - sizebuf[1] = (s >> 16) & 255; - sizebuf[2] = (s >> 8) & 255; - sizebuf[3] = s & 255; if ((proto_type == 0) || (proto_type == 2)) { + /* send the size first, maximum is 2^31 bytes */ + sizebuf[0] = (s >> 24) & 255; + sizebuf[1] = (s >> 16) & 255; + sizebuf[2] = (s >> 8) & 255; + sizebuf[3] = s & 255; if (socket_send(link->socket_fd, sizebuf, 4) == -1) goto error; @@ -496,29 +489,18 @@ int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_t if (socket_send(link->socket_fd, data, size) == -1) goto error; - link->bytes_sent += size; - link->packets_sent++; } else if (proto_type == 1 ) { - while (link->peer_port == 0) - { - sleep(0.1); - } - LOG_D(PROTO_AGENT, "peer port is %d", link->peer_port); - if (socket_udp_send(link->socket_fd, sizebuf, 4, peer_addr, link->peer_port) == -1) - goto error; - - LOG_I(PROTO_AGENT,"sent 4 bytes over the channel\n"); - link->bytes_sent += 4; - - if (socket_udp_send(link->socket_fd, data, size, peer_addr, link->peer_port) == -1) + /* UDP is connectionless -> only send the data */ + if (socket_udp_send(link->socket_fd, data, size, peer_addr, peer_port) == -1) goto error; - link->bytes_sent += size; - link->packets_sent++; } + link->bytes_sent += size; + link->packets_sent++; + return 0; error: @@ -529,50 +511,47 @@ error: * return -1 on error and 0 if the sending was fine */ -int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uint16_t proto_type, char *peer_addr, int port) +int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uint16_t proto_type) { unsigned char sizebuf[4]; - int32_t size; + int32_t size = 0; void *data = NULL; - int peer_port = 0; /* received the size first, maximum is 2^31 bytes */ if ((proto_type == 0) || (proto_type == 2)) { if (socket_receive(link->socket_fd, sizebuf, 4) == -1) goto error; - } - else if (proto_type == 1) - { - /* received the size first, maximum is 2^31 bytes */ - peer_port = socket_udp_receive(link->socket_fd, sizebuf, 4); - if ( peer_port == -1) - goto error; - if (peer_port == 0) link->peer_port = peer_port; - } - - size = (sizebuf[0] << 24) | - (sizebuf[1] << 16) | - (sizebuf[2] << 8) | - sizebuf[3]; - link->bytes_received += 4; + size = (sizebuf[0] << 24) | + (sizebuf[1] << 16) | + (sizebuf[2] << 8) | + sizebuf[3]; + link->bytes_received += 4; + + data = malloc(size); + if (data == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } - data = malloc(size); - if (data == NULL) { - LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - if ((proto_type == 0) || (proto_type == 2)) - { - if (socket_receive(link->socket_fd, data, size) == -1) goto error; } else if (proto_type == 1) - { - if (socket_udp_receive(link->socket_fd, data, size) == -1) + { + /* we get a single packet (no size, UDP could lose it). Therefore, prepare + * for the maximum UDP packet size */ + size = 65535; + data = malloc(size); + if (data == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + + size = socket_udp_receive(link->socket_fd, data, size); + if (size < 0) goto error; } diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h index 1ce5c27424..a7a83f66c6 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.h +++ b/openair2/UTIL/ASYNC_IF/socket_link.h @@ -48,12 +48,13 @@ typedef struct { socket_link_t *new_link_server(int port); socket_link_t *new_link_client(const char *server, int port); -socket_link_t *new_link_udp_server(int port); +/* setting bind_addr to NULL binds server to INADDR_ANY */ +socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port); socket_link_t *new_link_udp_client(const char *server, int port); socket_link_t *new_link_sctp_server(int port); socket_link_t *new_link_sctp_client(const char *server, int port); -int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, char *peer_addr, int port); -int link_receive_packet(socket_link_t *link, void **data, int *size, uint16_t proto_type, char *peer_addr, int port); +int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, const char *peer_addr, int port); +int link_receive_packet(socket_link_t *link, void **data, int *size, uint16_t proto_type); int close_link(socket_link_t *link); -- GitLab From 278fc6d711230cdd9ea6f72700bd25154df0c558 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 11:25:37 +0200 Subject: [PATCH 102/308] Improve PROTO_AGENT * unified CU/DU in one PROTO_AGENT instance since they are symmetric from UDP POV * delete a lot of unnecessary code * better error handling * can reciprocally send data --- openair2/ENB_APP/enb_config.h | 12 +- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 243 +++--------------- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 11 +- .../LAYER2/PROTO_AGENT/proto_agent_async.c | 51 +--- .../LAYER2/PROTO_AGENT/proto_agent_async.h | 7 +- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 2 + 6 files changed, 59 insertions(+), 267 deletions(-) diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 715ef44483..2e17511213 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -79,19 +79,13 @@ typedef struct mme_ip_address_s { char *ipv6_address; } mme_ip_address_t; - - - -typedef struct du_params { - const char *remote_ipv4_address; - const int16_t remote_port; -} du_params_t; - typedef struct cu_params { const char *local_interface; const char *local_ipv4_address; const uint16_t local_port; -} cu_params_t; + const char *remote_ipv4_address; + const int16_t remote_port; +} cudu_params_t; typedef struct ru_config_s { // indicates if local or remote rf is used (1 == LOCAL) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index ee12cd6257..74efca028d 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -43,7 +43,6 @@ #define ENB_AGENT_MAX 9 proto_agent_instance_t proto_agent[MAX_DU]; -proto_agent_instance_t proto_server[MAX_DU]; pthread_t new_thread(void *(*f)(void *), void *b); @@ -56,15 +55,17 @@ Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); /* Server side function; upon a new connection reception, sends the hello packets */ -int proto_server_start(mod_id_t mod_id, const cu_params_t *cu) +int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) { int channel_id; - DevAssert(cu->local_interface); - DevAssert(cu->local_ipv4_address); - DevAssert(cu->local_port > 1024); // "unprivileged" port + DevAssert(p->local_interface); + DevAssert(p->local_ipv4_address); + DevAssert(p->local_port > 1024); // "unprivileged" port + DevAssert(p->remote_ipv4_address); + DevAssert(p->remote_port > 1024); // "unprivileged" port - proto_server[mod_id].mod_id = mod_id; + proto_agent[mod_id].mod_id = mod_id; /* Initialize the channel container */ @@ -73,7 +74,9 @@ int proto_server_start(mod_id_t mod_id, const cu_params_t *cu) /*Create the async channel info*/ proto_agent_async_channel_t *channel_info; - channel_info = proto_server_async_channel_info(mod_id, cu->local_ipv4_address, cu->local_port); + channel_info = proto_agent_async_channel_info(mod_id, p->local_ipv4_address, p->local_port, + p->remote_ipv4_address, p->remote_port); + if (!channel_info) goto error; /* Create a channel using the async channel info */ channel_id = proto_agent_create_channel((void *) channel_info, @@ -84,7 +87,7 @@ int proto_server_start(mod_id_t mod_id, const cu_params_t *cu) proto_agent_channel_t *channel = proto_agent_get_channel(channel_id); if (!channel) goto error; - proto_server[mod_id].channel = channel; + proto_agent[mod_id].channel = channel; /* Register the channel for all underlying agents (use ENB_AGENT_MAX) */ proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); @@ -117,8 +120,9 @@ int proto_server_start(mod_id_t mod_id, const cu_params_t *cu) //} - proto_server[mod_id].recv_thread = new_thread(proto_server_receive, &proto_server[mod_id]); + proto_agent[mod_id].recv_thread = new_thread(proto_agent_receive, &proto_agent[mod_id]); + fprintf(stderr, "[PROTO_AGENT] server started at port %s:%d\n", p->local_ipv4_address, p->local_port); return 0; error: @@ -127,75 +131,6 @@ error: } -int proto_agent_start(mod_id_t mod_id, const du_params_t *du) -{ - int channel_id; - - DevAssert(du->remote_ipv4_address); - DevAssert(du->remote_port > 1024); // "unprivileged" port - - proto_agent[mod_id].mod_id = mod_id; - - /* TODO only initialize the first time */ - proto_agent_init_channel_container(); - - /*Create the async channel info*/ - - proto_agent_async_channel_t *channel_info = proto_agent_async_channel_info(mod_id, du->remote_ipv4_address, du->remote_port); - if (!channel_info) goto error; - - /*Create a channel using the async channel info*/ - channel_id = proto_agent_create_channel((void *) channel_info, - proto_agent_async_msg_send, - proto_agent_async_msg_recv, - proto_agent_async_release); - if (channel_id <= 0) goto error; - - proto_agent_channel_t *channel = proto_agent_get_channel(channel_id); - if (!channel) goto error; - proto_agent[mod_id].channel = channel; - - /* Register the channel for all underlying agents (use ENB_AGENT_MAX) */ - proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); - - //uint8_t *msg = NULL; - //Protocol__FlexsplitMessage *init_msg=NULL; - //int msg_flag; - - // In the case of UDP comm, start the echo request from the client side; the server thread should be blocked until it reads the SRC port of the 1st packet - //if (udp == 1) - //{ - // msg_flag = proto_agent_echo_request(cu_id, NULL, &init_msg); - - - - // if (msg_flag != 0) - // goto error; - // - // int msgsize = 0; - // if (init_msg != NULL) - // msg = proto_agent_pack_message(init_msg, &msgsize); - - // if (msg!= NULL) - // { - // LOG_D(PROTO_AGENT, "Client sending the ECHO_REQUEST message over the async channel\n"); - // proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); - // } - //} - // - /* After sending the message, wait for any replies; - the server thread blocks until it reads any data - over the channel - */ - proto_agent[mod_id].recv_thread = new_thread(proto_client_receive, &proto_agent[mod_id]); - return 0; - -error: - LOG_E(PROTO_AGENT, "there was an error in proto_agent_start()\n"); - return 1; - -} - //void //proto_agent_send_hello(void) //{ @@ -224,16 +159,14 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { - - //LOG_D(PROTO_AGENT, "PROTOPDCP: sending the data req over the async channel\n"); - uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; - int msg_flag = 0; + int msgsize = 0; mod_id_t mod_id = ctxt_pP->module_id; - //printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n"); + DevAssert(proto_agent[mod_id].channel); + DevAssert(proto_agent[mod_id].channel->channel_info); data_req_args *args = malloc(sizeof(data_req_args)); @@ -249,27 +182,12 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); msg_flag = proto_agent_pdcp_data_req(mod_id, (void *) args, &init_msg); - if (msg_flag != 0) - goto error; + if (msg_flag != 0 || !init_msg) goto error; - int msgsize = 0; - if (init_msg != NULL) - { + msg = proto_agent_pack_message(init_msg, &msgsize); + if (!msg) goto error; - msg = proto_agent_pack_message(init_msg, &msgsize); - - - LOG_D(PROTO_AGENT, "Sending the pdcp data_req message over the async channel\n"); - - if (msg!=NULL) - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, - proto_agent[mod_id].channel->channel_info); - - } - else - { - goto error; - } + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info); return; error: @@ -283,16 +201,14 @@ void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { - //LOG_D(PROTO_AGENT, "PROTOPDCP: Sending Data Indication over the async channel\n"); - uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg = NULL; - - int msg_flag = 0; + int msgsize = 0; mod_id_t mod_id = ctxt_pP->module_id; - //printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n"); + DevAssert(proto_agent[mod_id].channel); + DevAssert(proto_agent[mod_id].channel->channel_info); data_req_args *args = malloc(sizeof(data_req_args)); @@ -306,25 +222,13 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); msg_flag = proto_agent_pdcp_data_ind(mod_id, (void *) args, &init_msg); - if (msg_flag != 0) - goto error; + if (msg_flag != 0 || !init_msg) goto error; + + msg = proto_agent_pack_message(init_msg, &msgsize); + if (!msg) goto error; + + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info); - int msgsize = 0; - - if (init_msg != NULL) - { - msg = proto_agent_pack_message(init_msg, &msgsize); - - if (msg!=NULL) - { - LOG_D(PROTO_AGENT, "Sending the pdcp data_ind message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_server[mod_id].channel->channel_info); - } - } - else - { - goto error; - } return; error: @@ -333,11 +237,8 @@ error: } - - - void * -proto_server_receive(void *args) +proto_agent_receive(void *args) { proto_agent_instance_t *inst = args; void *data = NULL; @@ -360,91 +261,29 @@ proto_server_receive(void *args) LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority); - msg=proto_agent_handle_message(inst->mod_id, data, size); - - if (msg == NULL) - { - LOG_D(PROTO_AGENT, "msg to send back is NULL\n"); + msg = proto_agent_handle_message(inst->mod_id, data, size); + if (!msg) { + LOG_D(PROTO_AGENT, "msg to send back is NULL\n"); + continue; } - else - { - ser_msg = proto_agent_pack_message(msg, &size); + + ser_msg = proto_agent_pack_message(msg, &size); + if (!ser_msg) { + continue; } LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); - if (ser_msg != NULL){ - if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){ - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - LOG_D(PROTO_AGENT, "sent message with size %d\n", size); - } - - } - - return NULL; - -error: - LOG_E(PROTO_AGENT, "server_receive_thread: error %d occured\n",err_code); - return NULL; - -} - -void * -proto_client_receive(void *args) -{ - AssertFatal(0, "check proto_client_receive\n"); - proto_agent_instance_t *inst = args; - - void *data = NULL; - int size; - int priority; - err_code_t err_code; - - Protocol__FlexsplitMessage *msg; - uint8_t *ser_msg; - - - while (1) { - - msg = NULL; - ser_msg = NULL; - - if (proto_agent_async_msg_recv(&data, &size, &priority, inst->channel->channel_info)){ + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; - } - - LOG_D(PROTO_AGENT, - "Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", - size, priority, inst->mod_id); - - msg = proto_agent_handle_message(inst->mod_id, data, size); - - if (msg == NULL) - { - LOG_D(PROTO_AGENT, "msg to send back is NULL\n"); - } - else - { - ser_msg = proto_agent_pack_message(msg, &size); - } - LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); - - if (ser_msg != NULL){ - if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){ - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } - + } return NULL; error: - LOG_E(PROTO_AGENT, " client_receive_thread: error %d occured\n",err_code); + LOG_E(PROTO_AGENT, "proto_agent_receive(): error %d occured\n",err_code); return NULL; - } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 7b69b82379..45f5f1a6aa 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -41,16 +41,9 @@ #include "ENB_APP/enb_config.h" // for enb properties -void * proto_server_init(void *args); -void * proto_server_receive(void *args); -void * proto_client_receive(void *args); +void * proto_agent_receive(void *args); -int proto_agent_start(mod_id_t mod_id, const du_params_t *du); -int proto_server_start(mod_id_t mod_id, const cu_params_t* cu); - -int proto_agent_stop(mod_id_t mod_id); - -void *proto_agent_task(void *args); +int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p); void proto_agent_send_rlc_data_req( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 9bf861b056..f28547dc48 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -35,20 +35,20 @@ #include "common/utils/LOG/log.h" proto_agent_async_channel_t * -proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t port) +proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bind_port, + const char* peer_ip, uint16_t peer_port) { - LOG_E(PROTO_AGENT, "does not bind to specific address at the moment, ignoring %s\n", ip); proto_agent_async_channel_t *channel; channel = malloc(sizeof(proto_agent_channel_t)); if (channel == NULL) goto error; - channel->port = port; - channel->peer_addr = NULL; + channel->peer_port = peer_port; + channel->peer_addr = peer_ip; channel->enb_id = mod_id; - channel->link = new_link_udp_server(port); + channel->link = new_link_udp_server(bind_ip, bind_port); if (channel->link == NULL) goto error; @@ -62,51 +62,14 @@ proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t port) channel->link, CHANNEL_UDP, channel->peer_addr, - channel->port); - if (channel->manager == NULL) goto error; - - return channel; - - error: - LOG_E(PROTO_AGENT,"there was an error\n"); - return NULL; -} - - -proto_agent_async_channel_t * -proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst_port) -{ - proto_agent_async_channel_t *channel; - channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); - - if (channel == NULL) - goto error; - - channel->port = dst_port; - channel->peer_addr = dst_ip; - - channel->enb_id = mod_id; - channel->link = new_link_udp_client(channel->peer_addr, channel->port); - - if (channel->link == NULL) goto error; - - channel->send_queue = new_message_queue(); - if (channel->send_queue == NULL) goto error; - channel->receive_queue = new_message_queue(); - if (channel->receive_queue == NULL) goto error; - - channel->manager = create_link_manager(channel->send_queue, - channel->receive_queue, - channel->link, - CHANNEL_UDP, - channel->peer_addr, - channel->port); + channel->peer_port); if (channel->manager == NULL) goto error; return channel; error: LOG_E(PROTO_AGENT,"there was an error\n"); + fprintf(stderr, "error creating proto_agent_async_channel_t\n"); return NULL; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h index 681fb83b1b..780f004681 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h @@ -42,15 +42,16 @@ typedef struct proto_agent_async_channel_s { mod_id_t enb_id; const char *peer_addr; - int port; + int peer_port; socket_link_t *link; message_queue_t *send_queue; message_queue_t *receive_queue; link_manager_t *manager; } proto_agent_async_channel_t; -proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst_port); -proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t _port); +proto_agent_async_channel_t * +proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bind_port, + const char *peer_ip, uint16_t peer_port); int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index bfa4ed105c..11d95bfc3d 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -82,6 +82,8 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; goto error; } + /* after deserialization, we don't need the original data memory anymore */ + free(data); Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message; if (header->has_type) { -- GitLab From d94ae11fe0372e9dd93030fd78265c4825213e33 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 11:52:28 +0200 Subject: [PATCH 103/308] Add test programs to verify F1U --- cmake_targets/CMakeLists.txt | 30 ++++- openair2/LAYER2/PROTO_AGENT/cu_test.c | 169 ++++++++++++++++++++++++++ openair2/LAYER2/PROTO_AGENT/du_test.c | 162 ++++++++++++++++++++++++ 3 files changed, 360 insertions(+), 1 deletion(-) create mode 100644 openair2/LAYER2/PROTO_AGENT/cu_test.c create mode 100644 openair2/LAYER2/PROTO_AGENT/du_test.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f5c5425737..7ad42079de 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2062,6 +2062,34 @@ target_link_libraries (lte-softmodem NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl) +add_executable(cu_test + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/cu_test.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c + ${T_SOURCE} +) +target_link_libraries(cu_test + ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB} + ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl +) + +add_executable(du_test + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/du_test.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c + ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c + ${T_SOURCE} +) +target_link_libraries(du_test + ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB} + ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl +) + target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) @@ -2310,7 +2338,7 @@ if (${T_TRACER}) #all "add_executable" definitions (except tests, rb_tool, updatefw) lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1 dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim - pdcchsim pucchsim prachsim syncsim ulsim + pdcchsim pucchsim prachsim syncsim ulsim cu_test du_test #all "add_library" definitions ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB F1AP_LIB F1AP oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif diff --git a/openair2/LAYER2/PROTO_AGENT/cu_test.c b/openair2/LAYER2/PROTO_AGENT/cu_test.c new file mode 100644 index 0000000000..923b70607c --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/cu_test.c @@ -0,0 +1,169 @@ +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <sys/time.h> + +#include "ENB_APP/enb_paramdef.h" +#include "LAYER2/PROTO_AGENT/proto_agent.h" +#define BUF_MAX 1400 + +int recv_client = 0; +FILE *output; + +void usage(char *prg_name) +{ + fprintf(stderr, "usage: %s <file or ->\n", prg_name); + fprintf(stderr, " - is stdin\n"); + fprintf(stderr, " received packets are written to stdout\n"); +} + +long uelapsed(struct timeval *s, struct timeval *e) +{ + return e->tv_sec * 1000000 + e->tv_usec - (s->tv_sec * 1000000 + s->tv_usec); +} + +boolean_t +pdcp_data_ind( + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const sdu_size_t sdu_buffer_sizeP, + mem_block_t* const sdu_buffer_pP +) +{ + fwrite(sdu_buffer_pP->data, sdu_buffer_sizeP, 1, stdout); + free_mem_block(sdu_buffer_pP, __func__); + fflush(stdout); + recv_client = 1; + return 0; +} + +int main(int argc, char *argv[]) +{ + const cudu_params_t params = { + .local_interface = "lo", + .local_ipv4_address = "192.168.12.45", + .local_port = 6464, + .remote_ipv4_address = "192.168.12.45", + .remote_port = 6465 + }; + + protocol_ctxt_t p; + memset(&p, 0, sizeof p); + mem_block_t mem; + char s[BUF_MAX]; + size_t size, totsize = 0; + struct timeval t_start, t_end; + FILE *f; + + if (argc != 2) { + usage(argv[0]); + return 1; + } + + if (strcmp(argv[1], "-") == 0) { + f = stdin; + } else { + f = fopen(argv[1], "r"); + } + if (!f) { + fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno)); + return 2; + } + + pool_buffer_init(); + if (proto_agent_start(0, ¶ms) != 0) { + fprintf(stderr, "error on proto_agent_start()\n"); + return 3; + } + + /* wait for first packet of client */ + while (!recv_client) sleep(1); + fprintf(stderr, "reading file\n"); + + /* now send back at the same time */ + gettimeofday(&t_start, NULL); + while ((size = fread(s, 1, BUF_MAX, f)) > 0) { + usleep(100); + totsize += size; + mem.data = &s[0]; + proto_agent_send_rlc_data_req(&p, 0, 0, 0, 0, 0, size, &mem); + } + gettimeofday(&t_end, NULL); + fclose(f); + long us = uelapsed(&t_start, &t_end); + fprintf(stderr, "read %ld bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", + totsize, us / 1000, ((float) totsize ) / us, + ((float) totsize) / us * 8); + fprintf(stderr, "check files using 'diff afile bfile'\n"); + + /* give some time in case the other direction is slower */ + sleep(60); + return 0; +} + +/* + ********************************************************* + * arbitrary functions, needed for linking (used or not) * + ********************************************************* + */ + +rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + mem_block_t *sdu_pP +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,const uint32_t * const sourceL2Id + ,const uint32_t * const destinationL2Id +#endif + ) +{ + fprintf(stderr, "This should never be called on the CU\n"); + exit(1); +} + +pthread_t new_thread(void *(*f)(void *), void *b) { + pthread_t t; + pthread_attr_t att; + + if (pthread_attr_init(&att)){ + fprintf(stderr, "pthread_attr_init err\n"); + exit(1); + } + if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) { + fprintf(stderr, "pthread_attr_setdetachstate err\n"); + exit(1); + } + if (pthread_create(&t, &att, f, b)) { + fprintf(stderr, "pthread_create err\n"); + exit(1); + } + if (pthread_attr_destroy(&att)) { + fprintf(stderr, "pthread_attr_destroy err\n"); + exit(1); + } + + return t; +} + +int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) +{ + return 0; +} + +int config_get(paramdef_t *params,int numparams, char *prefix) +{ + return 0; +} + +int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) +{ + return 0; +} diff --git a/openair2/LAYER2/PROTO_AGENT/du_test.c b/openair2/LAYER2/PROTO_AGENT/du_test.c new file mode 100644 index 0000000000..e23503cc74 --- /dev/null +++ b/openair2/LAYER2/PROTO_AGENT/du_test.c @@ -0,0 +1,162 @@ +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <sys/time.h> + +#include "ENB_APP/enb_paramdef.h" +#include "LAYER2/PROTO_AGENT/proto_agent.h" + +#define BUF_MAX 1400 + +void usage(char *prg_name) +{ + fprintf(stderr, "usage: %s <file or ->\n", prg_name); + fprintf(stderr, " - is stdin\n"); + fprintf(stderr, " received packets are written to stdout\n"); +} + +long uelapsed(struct timeval *s, struct timeval *e) +{ + return e->tv_sec * 1000000 + e->tv_usec - (s->tv_sec * 1000000 + s->tv_usec); +} + + +rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + mem_block_t *sdu_pP +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,const uint32_t * const sourceL2Id + ,const uint32_t * const destinationL2Id +#endif + ) +{ + fwrite(sdu_pP->data, sdu_sizeP, 1, stdout); + free_mem_block(sdu_pP, __func__); + fflush(stdout); + return 0; +} + +int main(int argc, char *argv[]) +{ + const cudu_params_t params = { + .local_interface = "lo", + .local_ipv4_address = "192.168.12.45", + .local_port = 6465, + .remote_ipv4_address = "192.168.12.45", + .remote_port = 6464 + }; + + protocol_ctxt_t p; + memset(&p, 0, sizeof p); + mem_block_t mem; + char s[BUF_MAX]; + size_t size, totsize = 0; + struct timeval t_start, t_end; + FILE *f; + + if (argc != 2) { + usage(argv[0]); + return 1; + } + + if (strcmp(argv[1], "-") == 0) { + f = stdin; + } else { + f = fopen(argv[1], "r"); + } + if (!f) { + fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno)); + return 2; + } + + pool_buffer_init(); + if (proto_agent_start(0, ¶ms) != 0) { + fprintf(stderr, "error on proto_agent_start()\n"); + return 3; + } + + gettimeofday(&t_start, NULL); + while ((size = fread(s, 1, BUF_MAX, f)) > 0) { + usleep(100); + totsize += size; + mem.data = &s[0]; + proto_agent_send_pdcp_data_ind(&p, 0, 0, 0, size, &mem); + } + gettimeofday(&t_end, NULL); + fclose(f); + long us = uelapsed(&t_start, &t_end); + fprintf(stderr, "read %ld bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", + totsize, us / 1000, ((float) totsize ) / us, + ((float) totsize) / us * 8); + fprintf(stderr, "check files using 'diff afile bfile'\n"); + + /* wait, we are possibly receiving data */ + sleep(60); + return 0; +} + +/* + ********************************************************* + * arbitrary functions, needed for linking (used or not) * + ********************************************************* + */ + +boolean_t +pdcp_data_ind( + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const sdu_size_t sdu_buffer_sizeP, + mem_block_t* const sdu_buffer_pP +) +{ + fprintf(stderr, "This should never be called on the DU\n"); + exit(1); +} + +pthread_t new_thread(void *(*f)(void *), void *b) { + pthread_t t; + pthread_attr_t att; + + if (pthread_attr_init(&att)){ + fprintf(stderr, "pthread_attr_init err\n"); + exit(1); + } + if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) { + fprintf(stderr, "pthread_attr_setdetachstate err\n"); + exit(1); + } + if (pthread_create(&t, &att, f, b)) { + fprintf(stderr, "pthread_create err\n"); + exit(1); + } + if (pthread_attr_destroy(&att)) { + fprintf(stderr, "pthread_attr_destroy err\n"); + exit(1); + } + + return t; +} + +int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) +{ + return 0; +} + +int config_get(paramdef_t *params,int numparams, char *prefix) +{ + return 0; +} + +int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) +{ + return 0; +} -- GitLab From 4318072bb7d1e85d444879b51f6e80cdeb83e5ed Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 12:54:20 +0200 Subject: [PATCH 104/308] PROTO_AGENT: don't send ACKs, formatting --- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 4 +- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 355 +++++++----------- .../LAYER2/PROTO_AGENT/proto_agent_common.h | 8 +- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 24 +- 4 files changed, 146 insertions(+), 245 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 45f5f1a6aa..8d86786651 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -37,8 +37,10 @@ #ifndef PROTO_AGENT_H_ #define PROTO_AGENT_H_ -#include "proto_agent_common.h" #include "ENB_APP/enb_config.h" // for enb properties +/* avoid warnings */ +#undef NUM_MAX_ENB +#include "proto_agent_common.h" void * proto_agent_receive(void *args); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 147af52a12..9fe4ce21ee 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -28,7 +28,7 @@ *******************************************************************************/ /*! \file proto_agent_common.c - * \brief common primitives for all agents + * \brief common primitives for all agents * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 @@ -38,8 +38,10 @@ #include <dlfcn.h> #include <time.h> -#include "proto_agent_common.h" #include "PHY/phy_extern.h" +/* avoid warnings */ +#undef NUM_MAX_ENB +#include "proto_agent_common.h" #include "common/utils/LOG/log.h" #include "RRC/LTE/rrc_extern.h" @@ -78,7 +80,8 @@ void read_dl_data_header(int *pdu_type, int *spare, int *seqno, uint32_t header) return; } -int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size){ +int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size) +{ *size = protocol__f1u_message__get_packed_size(msg); *buf = malloc(*size); @@ -90,12 +93,13 @@ int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size){ return 0; error: - LOG_E(F1U, "an error occured\n"); + LOG_E(F1U, "an error occured\n"); return -1; } -int f1u_deserialize_message(void *data, int size, Protocol__F1uMessage **msg) { +int f1u_deserialize_message(void *data, int size, Protocol__F1uMessage **msg) +{ *msg = protocol__f1u_message__unpack(NULL, size, data); if (*msg == NULL) goto error; @@ -107,8 +111,8 @@ int f1u_deserialize_message(void *data, int size, Protocol__F1uMessage **msg) { return -1; } -int f1u_dl_data_create_header(uint32_t pdu_type, uint32_t f1u_sn, Protocol__DlDataHeader **header) { - +int f1u_dl_data_create_header(uint32_t pdu_type, uint32_t f1u_sn, Protocol__DlDataHeader **header) +{ *header = malloc(sizeof(Protocol__DlDataHeader)); if(*header == NULL) goto error; @@ -126,7 +130,6 @@ int f1u_dl_data_create_header(uint32_t pdu_type, uint32_t f1u_sn, Protocol__DlDa int f1u_dl_data(const void *params, Protocol__F1uMessage **msg) { - // Initialize the PDCP params dl_data_args *args = (dl_data_args *)params; @@ -163,7 +166,7 @@ int f1u_dl_data(const void *params, Protocol__F1uMessage **msg) dl_data->header = header; return 0; - + error: if(header != NULL) free(header); @@ -171,11 +174,10 @@ int f1u_dl_data(const void *params, Protocol__F1uMessage **msg) free(*msg); LOG_E(F1U, "%s: an error occured\n", __FUNCTION__); return -1; - } -int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size) { - +int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size) +{ *size = protocol__flexsplit_message__get_packed_size(msg); *buf = malloc(*size); @@ -187,36 +189,37 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf return 0; error: - LOG_E(MAC, "an error occured\n"); + LOG_E(MAC, "an error occured\n"); return -1; } /* We assume that the buffer size is equal to the message size. Should be chekced durint Tx/Rx */ -int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg) { +int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg) +{ *msg = protocol__flexsplit_message__unpack(NULL, size, data); if (*msg == NULL) - goto error; + goto error; return 0; - + error: LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } -int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header) { - +int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header) +{ *header = malloc(sizeof(Protocol__FspHeader)); if(*header == NULL) goto error; - + protocol__fsp_header__init(*header); LOG_D(PROTO_AGENT, "Initialized the PROTOBUF message header\n"); (*header)->version = FLEXSPLIT_VERSION; LOG_D(PROTO_AGENT, "Set the vversion to FLEXSPLIT_VERSION\n"); - (*header)->has_version = 1; + (*header)->has_version = 1; (*header)->type = type; (*header)->has_type = 1; (*header)->xid = xid; @@ -242,15 +245,15 @@ int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__Fle // Initialize the PDCP params data_req_args *args = (data_req_args *)params; - + // Create the protobuf header Protocol__FspHeader *header; xid_t xid = mod_id; LOG_D(PROTO_AGENT, "creating the data_req message\n"); - + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0) goto error; - + /* Begin constructing the messages. They are defined as follows: * 1) fspRlcPdu is storing the bytes of the packet * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) @@ -261,19 +264,19 @@ int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__Fle pdu = malloc(sizeof(Protocol__FspRlcPdu)); rlc_data = malloc(sizeof(Protocol__FspRlcData)); data_req = malloc(sizeof(Protocol__FspRlcDataReq)); - + protocol__fsp_ctxt__init(ctxt); protocol__fsp_rlc_pdu__init(pdu); protocol__fsp_rlc_data__init(rlc_data); protocol__fsp_rlc_data_req__init(data_req); - + // Copy data to the RlcPdu structure pdu->fsp_pdu_data.data = malloc(args->sdu_size); pdu->fsp_pdu_data.len = args->sdu_size; - - memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); + + memcpy(pdu->fsp_pdu_data.data, args->sdu_p->data, args->sdu_size); pdu->has_fsp_pdu_data = 1; - + // Copy data to the ctxt structure ctxt->fsp_mod_id = args->ctxt->module_id; ctxt->fsp_enb_flag = args->ctxt->enb_flag; @@ -291,7 +294,7 @@ int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__Fle ctxt->has_fsp_subframe = 1; ctxt->has_fsp_enb_index = 1; - rlc_data->fsp_ctxt = ctxt; + rlc_data->fsp_ctxt = ctxt; rlc_data->fsp_srb_flag = args->srb_flag; rlc_data->fsp_mbms_flag = args->MBMS_flag; rlc_data->fsp_rb_id = args->rb_id; @@ -299,7 +302,7 @@ int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__Fle rlc_data->fsp_confirm = args->confirm; rlc_data->fsp_sdu_buffer_size = args->sdu_size; rlc_data->fsp_pdu = pdu; - + rlc_data->has_fsp_srb_flag = 1; rlc_data->has_fsp_mbms_flag = 1; rlc_data->has_fsp_rb_id = 1; @@ -307,28 +310,28 @@ int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__Fle rlc_data->has_fsp_confirm = 1; rlc_data->has_fsp_sdu_buffer_size = 1; - // Up to here, everything is a signle message that is packed inside another. The final data_req + // Up to here, everything is a signle message that is packed inside another. The final data_req // will be created later, after the setting of all variables - + data_req->header = header; data_req->enb_id = mod_id; data_req->has_enb_id = 1; data_req->pdcp_data = rlc_data; - + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); if(*msg == NULL) goto error; - + protocol__flexsplit_message__init(*msg); - + (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG; (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK (*msg)->has_msg_dir = 1; (*msg)->data_req_msg = data_req; - + return 0; - + error: if(header != NULL) free(header); @@ -342,13 +345,12 @@ int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__Fle free(*msg); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; - } int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG) goto error; - + free(msg->data_req_msg->header); free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data); free(msg->data_req_msg->pdcp_data->fsp_pdu); @@ -357,7 +359,7 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { free(msg->data_req_msg); free(msg); return 0; - + error: LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; @@ -377,39 +379,31 @@ int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__Fl } -int proto_agent_pdcp_data_req_ack(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - Protocol__FspHeader *header; - xid_t xid; rlc_op_status_t result = 0; - - LOG_D(PROTO_AGENT, "creating the data_req_ack message\n"); - + Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReq *data_req = input->data_req_msg; - - xid = data_req->header->xid; + Protocol__FspCtxt *ctxt = NULL; Protocol__FspRlcData *rlc_data = NULL; - - + rlc_data = data_req->pdcp_data; - ctxt = rlc_data->fsp_ctxt; - - protocol_ctxt_t *ctxt_pP; - srb_flag_t srb_flagP = 0; - rb_id_t rb_idP = 0; - mui_t muiP = 0; - confirm_t confirmP = 0; - sdu_size_t pdcp_pdu_size = 0; - MBMS_flag_t flag_MBMS = 0; - mem_block_t *pdcp_pdu_p = NULL; - + + protocol_ctxt_t *ctxt_pP; + srb_flag_t srb_flagP = 0; + rb_id_t rb_idP = 0; + mui_t muiP = 0; + confirm_t confirmP = 0; + MBMS_flag_t flag_MBMS = 0; + sdu_size_t pdcp_pdu_size = 0; + mem_block_t *pdcp_pdu_p = NULL; // Create a new protocol context for handling the packet - ctxt_pP = malloc(sizeof(protocol_ctxt_t)); + if (!ctxt_pP) goto error; ctxt_pP->module_id = ctxt->fsp_mod_id; ctxt_pP->enb_flag = ctxt->fsp_enb_flag; ctxt_pP->instance = ctxt->fsp_instance; @@ -417,18 +411,17 @@ int proto_agent_pdcp_data_req_ack(mod_id_t mod_id, const void *params, Protocol_ ctxt_pP->frame = ctxt->fsp_frame; ctxt_pP->subframe = ctxt->fsp_subframe; ctxt_pP->eNB_index = ctxt->fsp_enb_index; - + srb_flagP = rlc_data->fsp_srb_flag; flag_MBMS = rlc_data->fsp_mbms_flag; rb_idP = rlc_data->fsp_rb_id; muiP = rlc_data->fsp_muip; confirmP = rlc_data->fsp_confirm; - pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; + pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__); - + if (!pdcp_pdu_p) goto error; memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); - result = rlc_data_req((const protocol_ctxt_t*) ctxt_pP ,(const srb_flag_t) srb_flagP ,(const MBMS_flag_t) flag_MBMS @@ -440,70 +433,31 @@ int proto_agent_pdcp_data_req_ack(mod_id_t mod_id, const void *params, Protocol_ #ifdef Rel14 ,NULL ,NULL - #endif + #endif ); - Protocol__FspRlcDataReqAck *ack = NULL; - - if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ_ACK, &header) != 0) - goto error; + return result; - ack = malloc(sizeof(Protocol__FspRlcDataReqAck)); - protocol__fsp_rlc_data_req_ack__init(ack); - - ack->header = header; - ack->result = result; - ack->has_result = 1; - - *msg = malloc(sizeof(Protocol__FlexsplitMessage)); - if(*msg == NULL) - goto error; - - protocol__flexsplit_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK; - (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->has_msg_dir = 1; - (*msg)->data_req_ack = ack; - return 0; - error: - if (pdcp_pdu_p != NULL) + if (ctxt_pP) + free(ctxt_pP); + if (pdcp_pdu_p) free_mem_block(pdcp_pdu_p, __func__); - if(header != NULL) - free(header); - if(ack!=NULL) - free(ack); - if(*msg != NULL) - free(*msg); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } -int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK) - goto error; - - free(msg->data_req_ack->header); - free(msg->data_req_ack); - free(msg); - return 0; - - error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) { +int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) +{ if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG) goto error; - + free(msg->data_req_ack->header); free(msg->data_req_ack); free(msg); return 0; - + error: LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; @@ -518,15 +472,15 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle // Initialize the PDCP params data_req_args *args = (data_req_args *)params; - + // Create the protobuf header Protocol__FspHeader *header; xid_t xid = mod_id; LOG_D(PROTO_AGENT, "creating the data_ind message\n"); - + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND, &header) != 0) goto error; - + /* Begin constructing the messages. They are defined as follows: * 1) fspRlcPdu is storing the bytes of the packet * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) @@ -537,19 +491,19 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle pdu = malloc(sizeof(Protocol__FspRlcPdu)); rlc_data = malloc(sizeof(Protocol__FspRlcData)); data_ind = malloc(sizeof(Protocol__FspPdcpDataInd)); - + protocol__fsp_ctxt__init(ctxt); protocol__fsp_rlc_pdu__init(pdu); protocol__fsp_rlc_data__init(rlc_data); protocol__fsp_pdcp_data_ind__init(data_ind); - + // Copy data to the RlcPdu structure pdu->fsp_pdu_data.data = malloc(args->sdu_size); pdu->fsp_pdu_data.len = args->sdu_size; - - memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); + + memcpy(pdu->fsp_pdu_data.data, args->sdu_p->data, args->sdu_size); pdu->has_fsp_pdu_data = 1; - + // Copy data to the ctxt structure ctxt->fsp_mod_id = args->ctxt->module_id; ctxt->fsp_enb_flag = args->ctxt->enb_flag; @@ -567,7 +521,7 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle ctxt->has_fsp_subframe = 1; ctxt->has_fsp_enb_index = 1; - rlc_data->fsp_ctxt = ctxt; + rlc_data->fsp_ctxt = ctxt; rlc_data->fsp_srb_flag = args->srb_flag; rlc_data->fsp_mbms_flag = args->MBMS_flag; rlc_data->fsp_rb_id = args->rb_id; @@ -579,20 +533,20 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle rlc_data->has_fsp_rb_id = 1; rlc_data->has_fsp_sdu_buffer_size = 1; - // Up to here, everything is a signle message that is packed inside another. The final data_req + // Up to here, everything is a signle message that is packed inside another. The final data_req // will be created later, after the setting of all variables - + data_ind->header = header; data_ind->enb_id = mod_id; data_ind->has_enb_id = 1; data_ind->rlc_data = rlc_data; - - + + *msg = malloc(sizeof(Protocol__FlexsplitMessage)); if(*msg == NULL) goto error; - + protocol__flexsplit_message__init(*msg); LOG_D(PROTO_AGENT,"setting the message case to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG); @@ -600,9 +554,9 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK (*msg)->has_msg_dir = 1; (*msg)->data_ind_msg = data_ind; //data_req; - + return 0; - + error: if(header != NULL) free(header); @@ -616,122 +570,71 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle free(*msg); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; - } -int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - Protocol__FspHeader *header; - Protocol__FspPdcpDataIndAck *ack = NULL; + boolean_t result = 0; - xid_t xid; - rlc_op_status_t result = 0; - - //printf("PROTO_AGENT: creating the data_ind_ack message\n"); - Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg; - - xid = data_ind->header->xid; Protocol__FspCtxt *ctxt = NULL; Protocol__FspRlcData *rlc_data = NULL; - - + rlc_data = data_ind->rlc_data; - ctxt = rlc_data->fsp_ctxt; - - protocol_ctxt_t *ctxt_pP; - srb_flag_t srb_flagP = 0; - rb_id_t rb_idP = 0; - sdu_size_t pdcp_pdu_size = 0; - MBMS_flag_t flag_MBMS = 0; - mem_block_t *pdcp_pdu_p = NULL; - + + protocol_ctxt_t *ctxt_pP; + srb_flag_t srb_flagP = 0; + rb_id_t rb_idP = 0; + sdu_size_t pdcp_pdu_size = 0; + MBMS_flag_t flag_MBMS = 0; + mem_block_t *pdcp_pdu_p = NULL; // Create a new protocol context for handling the packet - ctxt_pP = malloc(sizeof(protocol_ctxt_t)); - //FIXME: - //ctxt_pP->module_id = ctxt->fsp_mod_id; - ctxt_pP->module_id = 0; + if (!ctxt_pP) goto error; + ctxt_pP->module_id = ctxt->fsp_mod_id; ctxt_pP->enb_flag = ctxt->fsp_enb_flag; ctxt_pP->instance = ctxt->fsp_instance; ctxt_pP->rnti = ctxt->fsp_rnti; ctxt_pP->frame = ctxt->fsp_frame; ctxt_pP->subframe = ctxt->fsp_subframe; ctxt_pP->eNB_index = ctxt->fsp_enb_index; - + srb_flagP = rlc_data->fsp_srb_flag; flag_MBMS = rlc_data->fsp_mbms_flag; rb_idP = rlc_data->fsp_rb_id; - pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; + pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__); - + if (!pdcp_pdu_p) goto error; + memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); - + // if (xid == 1) // pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); // else if (xid == 0) // FIXME: USE a preprocessed definition - pdcp_data_ind((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); + result = pdcp_data_ind(ctxt_pP, + srb_flagP, + flag_MBMS, + rb_idP, + pdcp_pdu_size, + pdcp_pdu_p); - if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND_ACK, &header) != 0) - goto error; + return result; - ack = malloc(sizeof(Protocol__FspPdcpDataIndAck)); - protocol__fsp_pdcp_data_ind_ack__init(ack); - - ack->header = header; - ack->result = result; - ack->has_result = 1; - - *msg = malloc(sizeof(Protocol__FlexsplitMessage)); - if(*msg == NULL) - goto error; - - protocol__flexsplit_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_ACK; - (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->has_msg_dir = 1; - // FIXME: the following was (*msg)->data_req_ack = ack; - // but this throws compiler warning. Probably we want the following instead - (*msg)->data_ind_ack = ack; - - return 0; - error: - if(header != NULL) - free(header); - if(ack!=NULL) - free(ack); - if(*msg != NULL) - free(*msg); - if (pdcp_pdu_p != NULL) + if (ctxt_pP) + free(ctxt_pP); + if (pdcp_pdu_p) free_mem_block(pdcp_pdu_p, __func__); - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; - } - -int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_ACK) - goto error; - - free(msg->data_req_ack->header); - free(msg->data_req_ack); - free(msg); - return 0; - - error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - +int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ Protocol__FspHeader *header; Protocol__FspHello *hello_msg = NULL; @@ -750,14 +653,14 @@ int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMe *msg = malloc(sizeof(Protocol__FlexsplitMessage)); if(*msg == NULL) goto error; - + protocol__flexsplit_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG; (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->has_msg_dir = 1; (*msg)->hello_msg = hello_msg; return 0; - + error: if(header != NULL) free(header); @@ -770,11 +673,11 @@ int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMe } -int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) { - +int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) +{ if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG) goto error; - + free(msg->hello_msg->header); free(msg->hello_msg); free(msg); @@ -785,7 +688,8 @@ int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) { return -1; } -int proto_agent_echo_request(mod_id_t mod_id, const void* params, Protocol__FlexsplitMessage **msg) { +int proto_agent_echo_request(mod_id_t mod_id, const void* params, Protocol__FlexsplitMessage **msg) +{ Protocol__FspHeader *header; Protocol__FspEchoRequest *echo_request_msg = NULL; @@ -793,7 +697,7 @@ int proto_agent_echo_request(mod_id_t mod_id, const void* params, Protocol__Flex if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0) goto error; LOG_D(PROTO_AGENT, "creating the echo request message\n"); - + echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest)); if(echo_request_msg == NULL) goto error; @@ -823,30 +727,29 @@ int proto_agent_echo_request(mod_id_t mod_id, const void* params, Protocol__Flex return -1; } -int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg) { +int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg) +{ if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG) goto error; - + free(msg->echo_request_msg->header); free(msg->echo_request_msg); free(msg); return 0; - + error: LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } -int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - +int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ xid_t xid; Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspEchoRequest *echo_req = input->echo_request_msg; Protocol__FspEchoReply *echo_reply_msg = NULL; xid = (echo_req->header)->xid; - - LOG_D(PROTO_AGENT, "creating the echo reply message\n"); Protocol__FspHeader *header; if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0) @@ -882,12 +785,12 @@ int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__Flexsp int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG) goto error; - + free(msg->echo_reply_msg->header); free(msg->echo_reply_msg); free(msg); return 0; - + error: LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index d81561c14c..40b4bbd6d8 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -95,13 +95,11 @@ int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__Flexsp int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg); int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); -int proto_agent_pdcp_data_req_ack(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg); -int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg); int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg); -int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); -int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg); +int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); @@ -119,7 +117,7 @@ typedef struct _data_req_args data_req_args; typedef struct _dl_data_args dl_data_args; struct _data_req_args{ - protocol_ctxt_t* ctxt; + const protocol_ctxt_t* ctxt; srb_flag_t srb_flag; MBMS_flag_t MBMS_flag; rb_id_t rb_id; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index 11d95bfc3d..04b7c2c401 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -40,13 +40,13 @@ #include "assertions.h" proto_agent_message_decoded_callback proto_agent_messages_callback[][3] = { - {proto_agent_hello, 0, 0}, - {proto_agent_echo_reply, 0, 0}, - {0, just_print, 0}, - {proto_agent_pdcp_data_req_ack, 0, 0}, - {0, proto_agent_get_ack_result, 0}, - {proto_agent_pdcp_data_ind_ack, 0, 0}, - {0, just_print, 0}, + {proto_agent_hello, 0, 0}, /* agent hello */ + {proto_agent_echo_reply, 0, 0}, /* echo */ + {0, just_print, 0}, /* just print */ + {proto_agent_pdcp_data_req_process, 0, 0}, /* PDCP data REQ */ + {0, proto_agent_get_ack_result, 0}, /* get ACK result */ + {proto_agent_pdcp_data_ind_process, 0, 0}, /* PDCP data IND */ + {0, just_print, 0}, /* just print */ }; proto_agent_message_destruction_callback proto_message_destruction_callback[] = { @@ -54,10 +54,9 @@ proto_agent_message_destruction_callback proto_message_destruction_callback[] = proto_agent_destroy_echo_request, proto_agent_destroy_echo_reply, proto_agent_destroy_pdcp_data_req, - proto_agent_destroy_pdcp_data_req_ack, + 0, proto_agent_destroy_pdcp_data_ind, - proto_agent_destroy_pdcp_data_ind_ack, - + 0, }; //static const char *proto_agent_direction2String[] = { @@ -129,9 +128,8 @@ uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size) goto error; } - //TODO call proper destroy function - - err_code = ((*proto_message_destruction_callback[msg->msg_case-1])(msg)); + if (proto_message_destruction_callback[msg->msg_case-1]) + err_code = ((*proto_message_destruction_callback[msg->msg_case-1])(msg)); DevAssert(buffer !=NULL); -- GitLab From 7f40bf76fbb5ebfe42dec951d1ed34e8284cb6e2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 14:44:33 +0200 Subject: [PATCH 105/308] ASYNC_IF: join threads when destroying link manager --- openair2/UTIL/ASYNC_IF/link_manager.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index ddbb89fdaa..82fe142237 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -159,7 +159,8 @@ void destroy_link_manager(link_manager_t *manager) { LOG_D(MAC, "destroying link manager\n"); manager->run = 0; - /* todo: force threads to stop (using a dummy message?) */ + pthread_join(manager->sender, NULL); + pthread_join(manager->receiver, NULL); } #ifdef SERVER_TEST -- GitLab From b564b116d3fbcbdb3d4c8b87de6df928ca8bcd17 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 15:02:24 +0200 Subject: [PATCH 106/308] Fix memory leaks in PROTO_AGENT --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 53 +++++++++---------- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 1 + .../LAYER2/PROTO_AGENT/proto_agent_async.c | 6 +-- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 8 ++- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 6 +-- 5 files changed, 38 insertions(+), 36 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 74efca028d..a03ba2781b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -131,6 +131,11 @@ error: } +void proto_agent_stop(mod_id_t mod_id) +{ + proto_agent_destroy_channel(proto_agent[mod_id].channel->channel_id); +} + //void //proto_agent_send_hello(void) //{ @@ -164,24 +169,21 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, int msg_flag = 0; int msgsize = 0; mod_id_t mod_id = ctxt_pP->module_id; + data_req_args args; DevAssert(proto_agent[mod_id].channel); DevAssert(proto_agent[mod_id].channel->channel_info); - data_req_args *args = malloc(sizeof(data_req_args)); - - args->ctxt = malloc(sizeof(protocol_ctxt_t)); - memcpy(args->ctxt, ctxt_pP, sizeof(protocol_ctxt_t)); - args->srb_flag = srb_flagP; - args->MBMS_flag = MBMS_flagP; - args->rb_id = rb_idP; - args->mui = muiP; - args->confirm = confirmP; - args->sdu_size = sdu_sizeP; - args->sdu_p = malloc(sdu_sizeP); - memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); - - msg_flag = proto_agent_pdcp_data_req(mod_id, (void *) args, &init_msg); + args.ctxt = ctxt_pP; + args.srb_flag = srb_flagP; + args.MBMS_flag = MBMS_flagP; + args.rb_id = rb_idP; + args.mui = muiP; + args.confirm = confirmP; + args.sdu_size = sdu_sizeP; + args.sdu_p = sdu_pP; + + msg_flag = proto_agent_pdcp_data_req(mod_id, (void *) &args, &init_msg); if (msg_flag != 0 || !init_msg) goto error; msg = proto_agent_pack_message(init_msg, &msgsize); @@ -206,22 +208,19 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f int msg_flag = 0; int msgsize = 0; mod_id_t mod_id = ctxt_pP->module_id; + data_req_args args; DevAssert(proto_agent[mod_id].channel); DevAssert(proto_agent[mod_id].channel->channel_info); - data_req_args *args = malloc(sizeof(data_req_args)); - - args->ctxt = malloc(sizeof(protocol_ctxt_t)); - memcpy(args->ctxt, ctxt_pP, sizeof(protocol_ctxt_t)); - args->srb_flag = srb_flagP; - args->MBMS_flag = MBMS_flagP; - args->rb_id = rb_idP; - args->sdu_size = sdu_sizeP; - args->sdu_p = malloc(sdu_sizeP); - memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); - - msg_flag = proto_agent_pdcp_data_ind(mod_id, (void *) args, &init_msg); + args.ctxt = ctxt_pP; + args.srb_flag = srb_flagP; + args.MBMS_flag = MBMS_flagP; + args.rb_id = rb_idP; + args.sdu_size = sdu_sizeP; + args.sdu_p = sdu_pP; + + msg_flag = proto_agent_pdcp_data_ind(mod_id, (void *) &args, &init_msg); if (msg_flag != 0 || !init_msg) goto error; msg = proto_agent_pack_message(init_msg, &msgsize); @@ -232,7 +231,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f return; error: - LOG_E(PROTO_AGENT, "there was an error\n"); + LOG_E(PROTO_AGENT, "there was an error in %s\n", __func__); return; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 8d86786651..c6416cd5f9 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -46,6 +46,7 @@ void * proto_agent_receive(void *args); int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p); +void proto_agent_stop(mod_id_t mod_id); void proto_agent_send_rlc_data_req( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index f28547dc48..d4386fba7a 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -68,7 +68,8 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bi return channel; error: - LOG_E(PROTO_AGENT,"there was an error\n"); + if (channel) + free(channel); fprintf(stderr, "error creating proto_agent_async_channel_t\n"); return NULL; } @@ -87,8 +88,7 @@ int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *chan void proto_agent_async_release(proto_agent_channel_t *channel) { - proto_agent_async_channel_t *channel_info; - channel_info = (proto_agent_async_channel_t *) channel->channel_info; + proto_agent_async_channel_t *channel_info = channel->channel_info; destroy_link_manager(channel_info->manager); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 9fe4ce21ee..9fee6ad812 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -453,8 +453,12 @@ int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG) goto error; - free(msg->data_req_ack->header); - free(msg->data_req_ack); + free(msg->data_ind_msg->header); + free(msg->data_ind_msg->rlc_data->fsp_pdu->fsp_pdu_data.data); + free(msg->data_ind_msg->rlc_data->fsp_pdu); + free(msg->data_ind_msg->rlc_data->fsp_ctxt); + free(msg->data_ind_msg->rlc_data); + free(msg->data_ind_msg); free(msg); return 0; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index 04b7c2c401..7c0cc6b372 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -104,10 +104,8 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, LOG_I(PROTO_AGENT, "decoded_message case : %d, direction : %d \n", decoded_message->msg_case-1, decoded_message->msg_dir-1); goto error; } - else if (err_code == 1) - { - protocol__flexsplit_message__free_unpacked(decoded_message, NULL); - } + + protocol__flexsplit_message__free_unpacked(decoded_message, NULL); LOG_D(PROTO_AGENT,"Returning REPLY message after the callback\n"); return reply_message; -- GitLab From eacd1cfbf0e21e79206b9c590aed34a3f01d2839 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 15:03:19 +0200 Subject: [PATCH 107/308] PROTO_AGENT test program changes --- openair2/LAYER2/PROTO_AGENT/cu_test.c | 14 +++++++++++--- openair2/LAYER2/PROTO_AGENT/du_test.c | 13 ++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/cu_test.c b/openair2/LAYER2/PROTO_AGENT/cu_test.c index 923b70607c..ae9a2129e5 100644 --- a/openair2/LAYER2/PROTO_AGENT/cu_test.c +++ b/openair2/LAYER2/PROTO_AGENT/cu_test.c @@ -35,12 +35,19 @@ pdcp_data_ind( ) { fwrite(sdu_buffer_pP->data, sdu_buffer_sizeP, 1, stdout); - free_mem_block(sdu_buffer_pP, __func__); fflush(stdout); + free_mem_block(sdu_buffer_pP, __func__); + /* cannot free because of const */ + free(ctxt_pP); recv_client = 1; return 0; } +void close_proto_agent(void) +{ + proto_agent_stop(0); +} + int main(int argc, char *argv[]) { const cudu_params_t params = { @@ -79,6 +86,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "error on proto_agent_start()\n"); return 3; } + atexit(close_proto_agent); /* wait for first packet of client */ while (!recv_client) sleep(1); @@ -87,7 +95,7 @@ int main(int argc, char *argv[]) /* now send back at the same time */ gettimeofday(&t_start, NULL); while ((size = fread(s, 1, BUF_MAX, f)) > 0) { - usleep(100); + usleep(10); totsize += size; mem.data = &s[0]; proto_agent_send_rlc_data_req(&p, 0, 0, 0, 0, 0, size, &mem); @@ -101,7 +109,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "check files using 'diff afile bfile'\n"); /* give some time in case the other direction is slower */ - sleep(60); + sleep(5); return 0; } diff --git a/openair2/LAYER2/PROTO_AGENT/du_test.c b/openair2/LAYER2/PROTO_AGENT/du_test.c index e23503cc74..04fac69f31 100644 --- a/openair2/LAYER2/PROTO_AGENT/du_test.c +++ b/openair2/LAYER2/PROTO_AGENT/du_test.c @@ -38,11 +38,17 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ) { fwrite(sdu_pP->data, sdu_sizeP, 1, stdout); - free_mem_block(sdu_pP, __func__); fflush(stdout); + free_mem_block(sdu_pP, __func__); + free(ctxt_pP); return 0; } +void close_proto_agent(void) +{ + proto_agent_stop(0); +} + int main(int argc, char *argv[]) { const cudu_params_t params = { @@ -81,10 +87,11 @@ int main(int argc, char *argv[]) fprintf(stderr, "error on proto_agent_start()\n"); return 3; } + atexit(close_proto_agent); gettimeofday(&t_start, NULL); while ((size = fread(s, 1, BUF_MAX, f)) > 0) { - usleep(100); + usleep(10); totsize += size; mem.data = &s[0]; proto_agent_send_pdcp_data_ind(&p, 0, 0, 0, size, &mem); @@ -98,7 +105,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "check files using 'diff afile bfile'\n"); /* wait, we are possibly receiving data */ - sleep(60); + sleep(5); return 0; } -- GitLab From 7ed0aa1d6ae71f68f0a9ef427038ad93004f301f Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 17:13:18 +0200 Subject: [PATCH 108/308] Add F1U proto_agent calls, remove old code --- common/utils/LOG/log.h | 5 -- openair2/F1AP/f1ap_cu_task.c | 12 ++++ openair2/F1AP/f1ap_du_task.c | 13 +++++ openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 49 ++++++++++------ openair2/LAYER2/RLC/rlc.c | 91 +---------------------------- openair2/LAYER2/RLC/rlc.h | 10 ---- 6 files changed, 60 insertions(+), 120 deletions(-) diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 22d393d1a7..21c51cba8f 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -524,11 +524,6 @@ static inline void updateTimes(uint64_t start, Meas *M, int period, char * txt) } #endif - -pthread_mutex_t async_server_lock; -pthread_cond_t async_server_notify; -int async_server_shutdown; - #endif diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 55a1160c46..925a6327d0 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -35,6 +35,7 @@ #include "f1ap_cu_interface_management.h" #include "f1ap_cu_rrc_message_transfer.h" #include "f1ap_cu_task.h" +#include "proto_agent.h" extern RAN_CONTEXT_t RC; @@ -64,6 +65,17 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data_from_du->assoc_id = sctp_new_association_resp->assoc_id; f1ap_du_data_from_du->sctp_in_streams = sctp_new_association_resp->in_streams; f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams; + + /* setup parameters for F1U and start the server */ + const cudu_params_t params = { + .local_interface = NULL, /* is not used */ + .local_ipv4_address = RC.rrc[instance]->eth_params_s.my_addr, + .local_port = RC.rrc[instance]->eth_params_s.my_portd, + .remote_ipv4_address = RC.rrc[instance]->eth_params_s.remote_addr, + .remote_port = RC.rrc[instance]->eth_params_s.remote_portd + }; + AssertFatal(proto_agent_start(instance, ¶ms) == 0, + "could not start PROTO_AGENT for F1U on instance %d!\n", instance); } void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 73dc40e655..bcd14cfa36 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -34,6 +34,9 @@ #include "f1ap_handlers.h" #include "f1ap_du_interface_management.h" #include "f1ap_du_task.h" +#include "proto_agent.h" + +extern RAN_CONTEXT_t RC; f1ap_setup_req_t *f1ap_du_data; @@ -95,6 +98,16 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; f1ap_du_data->default_sctp_stream_id = 0; + /* setup parameters for F1U and start the server */ + const cudu_params_t params = { + .local_interface = NULL, /* is not used */ + .local_ipv4_address = RC.mac[instance]->eth_params_n.my_addr, + .local_port = RC.mac[instance]->eth_params_n.my_portd, + .remote_ipv4_address = RC.mac[instance]->eth_params_n.remote_addr, + .remote_port = RC.mac[instance]->eth_params_n.remote_portd + }; + AssertFatal(proto_agent_start(instance, ¶ms) == 0, + "could not start PROTO_AGENT for F1U on instance %d!\n", instance); DU_send_F1_SETUP_REQUEST(instance); } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 972d4f16ef..3b4983a59d 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -189,11 +189,23 @@ boolean_t pdcp_data_req( (unsigned char*)&pdcp_pdu_p->data[0], sdu_buffer_sizeP); #endif - rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU + || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU + || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { + /* currently, there is no support to send also the source/destinationL2Id */ + proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, + confirmP, sdu_buffer_sizeP, pdcp_pdu_p); + /* assume good status */ + rlc_status = RLC_OP_STATUS_OK; + + } else { + rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, + confirmP, sdu_buffer_sizeP, pdcp_pdu_p #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,NULL, NULL + ,NULL, NULL #endif - ); + ); + } } else { rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES; LOG_W(PDCP,PROTOCOL_CTXT_FMT" PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n", @@ -377,24 +389,27 @@ boolean_t pdcp_data_req( #ifndef UETARGET if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) { + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU + || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU + || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { + /* currently, there is no support to send also the source/destinationL2Id */ + proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, + confirmP, pdcp_pdu_size, pdcp_pdu_p); + /* assume good status */ + rlc_status = RLC_OP_STATUS_OK; + } else { - { - LOG_E(PDCP, "proto_agent_send_rlc_data_req()\n"); - { - //proto_agent_send_rlc_data_req(0,cudu->cu[j].du_type, ctxt_pP, srb_flagP, - //MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - } - //rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p + rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, + confirmP, pdcp_pdu_size, pdcp_pdu_p #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - //,sourceL2Id - //,destinationL2Id + ,sourceL2Id + ,destinationL2Id #endif - //); - - } + ); + } /* end if node_type is CU */ - free_mem_block(pdcp_pdu_p, __FUNCTION__); - rlc_status = ack_result; + free_mem_block(pdcp_pdu_p, __FUNCTION__); + rlc_status = ack_result; } else diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index f377869edd..d54938d400 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -54,68 +54,7 @@ extern boolean_t pdcp_data_ind( -#include "rlc_proto_agent_primitives.h" -// PROTO AGENT -#ifndef UETARGET -void -async_server_thread_init (void) -{ - //create log_list - //log_list_init(&log_list); - - //AssertFatal(0, "this should not be reached!\n"); - async_server_shutdown = 0; - - if ((pthread_mutex_init (&async_server_lock, NULL) != 0) - || (pthread_cond_init (&async_server_notify, NULL) != 0)) { - return; - } - //if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL) - // != 0) { - // async_server_thread_finalize(); - // return; - //} - - -} - -int -async_server_thread_finalize (void) -{ - int err = 0; - - - if (pthread_mutex_lock (&async_server_lock) != 0) { - return -1; - } - - async_server_shutdown = 1; - - /* Wake up LOG thread */ - if ((pthread_cond_broadcast (&async_server_notify) != 0) - || (pthread_mutex_unlock (&async_server_lock) != 0)) { - err = -1; - } - - if (pthread_join (async_server_thread, NULL) != 0) { - err = -1; - } - - if (pthread_mutex_unlock (&async_server_lock) != 0) { - err = -1; - } - - if (!err) { - //log_list_free(&log_list); - pthread_mutex_lock (&async_server_lock); - pthread_mutex_destroy (&async_server_lock); - pthread_cond_destroy (&async_server_notify); - } - - return err; -} - -#endif /*UETARGET*/ +#include "proto_agent.h" //----------------------------------------------------------------------------- void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, const signed long sizeP) @@ -680,24 +619,13 @@ void rlc_data_ind ( T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); #endif #ifndef UETARGET - if ((!srb_flagP) && (ctxt_pP->enb_flag == 1)) + if (ctxt_pP->enb_flag == 1) { - proto_agent_send_pdcp_data_ind(ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_idP, - sdu_sizeP, - sdu_pP); - } - else - - { - switch (RC.rrc[ctxt_pP->module_id]->node_type){ case ngran_eNB_CU : case ngran_ng_eNB_CU : case ngran_gNB_CU : - pdcp_data_ind ( + proto_agent_send_pdcp_data_ind ( ctxt_pP, 1, // srb_flagP, 0, // MBMS_flagP, @@ -804,19 +732,6 @@ rlc_module_init (void) pool_buffer_init(); -/* -#ifndef UETARGET - // Launch the RLC listening server - // as a separate thread - - static int started = 0; - if (started == 0) - { - async_server_thread_init(); - started = 1; - } -#endif -*/ return(0); } //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 9aee5cbc11..cedfbe17de 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -682,14 +682,4 @@ int rlc_module_init(void); #define RLC_REVERSE_VIDEO "\e[7m" #define RLC_NORMAL_VIDEO "\e[27m" -// PROTO AGENT -pthread_t async_server_thread; -int async_server_thread_finalize (void); -void async_server_thread_init (void); - - - - - - #endif -- GitLab From 53d741f20dbf619a93a678976dfa51fc217071a2 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Thu, 20 Sep 2018 18:56:40 +0200 Subject: [PATCH 109/308] Generate the DCCH and send from pdcp --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 14 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 313 +++++----- openair2/F1AP/f1ap_du_task.c | 5 +- openair2/F1AP/f1ap_handlers.c | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 111 ++-- .../LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# | 534 ++++++++++++++++++ openair2/LAYER2/RLC/rlc_mac.c | 4 +- openair2/RRC/LTE/L2_interface_common.c | 6 + openair2/RRC/LTE/rrc_eNB.c | 6 +- openair2/RRC/LTE/rrc_eNB_S1AP.c | 1 - targets/COMMON/create_tasks.c | 4 + targets/RT/USER/lte-softmodem.c | 10 + 12 files changed, 824 insertions(+), 186 deletions(-) create mode 100644 openair2/LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 1b30602cdf..5ddb6fb187 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -264,7 +264,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); @@ -365,15 +365,17 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, */ protocol_ctxt_t ctxt; ctxt.module_id = instance; + ctxt.instance = instance; ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id); ctxt.enb_flag = 1; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); + LOG_I(CU_F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %d (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); pdcp_data_ind (&ctxt, - 1, - 0, - srb_id, - ie->value.choice.RRCContainer.size, - mb); + 1, // srb_flag + 0, // embms_flag + srb_id, + ie->value.choice.RRCContainer.size, + mb); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 63066a4b8d..12d599bc39 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -175,153 +175,208 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); + protocol_ctxt_t ctxt; + ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id); + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; + if (srb_id == 0) { DL_CCCH_Message_t* dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; dec_rval = uper_decode(NULL, - &asn_DEF_DL_CCCH_Message, - (void**)&dl_ccch_msg, - ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len,0,0); + &asn_DEF_DL_CCCH_Message, + (void**)&dl_ccch_msg, + ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len,0,0); switch (dl_ccch_msg->message.choice.c1.present) { - - case DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, "Received PR_NOTHING on DL-CCCH-Message\n"); - break; - - case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n"); - break; - - case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n"); - break; - - case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); - break; - - case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: + + case DL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, "Received PR_NOTHING on DL-CCCH-Message\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: { - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); - // Get configuration - - RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; - // eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; - AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); - RadioResourceConfigDedicated_t* radioResourceConfigDedicated = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated; - - // get SRB logical channel information - SRB_ToAddModList_t *SRB_configList; - SRB_ToAddMod_t *SRB1_config; - LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; - SRB_configList = radioResourceConfigDedicated->srb_ToAddModList; - - AssertFatal(SRB_configList!=NULL,"SRB_configList is null\n"); - for (int cnt = 0; cnt < (SRB_configList)->list.count; cnt++) { - if ((SRB_configList)->list.array[cnt]->srb_Identity == 1) { - SRB1_config = (SRB_configList)->list.array[cnt]; - - if (SRB1_config->logicalChannelConfig) { - if (SRB1_config->logicalChannelConfig->present == - SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { - SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; - } else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - } else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - - - } - } - - protocol_ctxt_t ctxt; - ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id); - ctxt.module_id = instance; - ctxt.enb_flag = 1; - rrc_rlc_config_asn1_req(&ctxt, - SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); + // Get configuration + + RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; + // eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); + RadioResourceConfigDedicated_t* radioResourceConfigDedicated = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated; + + // get SRB logical channel information + SRB_ToAddModList_t *SRB_configList; + SRB_ToAddMod_t *SRB1_config; + LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + SRB_configList = radioResourceConfigDedicated->srb_ToAddModList; + + AssertFatal(SRB_configList!=NULL,"SRB_configList is null\n"); + for (int cnt = 0; cnt < (SRB_configList)->list.count; cnt++) { + if ((SRB_configList)->list.array[cnt]->srb_Identity == 1) { + SRB1_config = (SRB_configList)->list.array[cnt]; + + if (SRB1_config->logicalChannelConfig) { + if (SRB1_config->logicalChannelConfig->present == + SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } + } // for + rrc_rlc_config_asn1_req(&ctxt, + SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL, - 0,0 + , (PMCH_InfoList_r9_t *) NULL, + 0,0 # endif - ); - - // This should be somewhere in the f1ap_cudu_ue_inst_t - int macrlc_instance = 0; - - rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id); - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); - - eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); - - memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, - (void*)ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len); - - ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; - - rrc_mac_config_req_eNB( - macrlc_instance, - 0, //primaryCC_id, - 0,0,0,0,0, + ); + + // This should be somewhere in the f1ap_cudu_ue_inst_t + int macrlc_instance = 0; + + rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); + + eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); + + memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, + (void*)ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len); + + ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; + + rrc_mac_config_req_eNB( + macrlc_instance, + 0, //primaryCC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0, #endif - rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - radioResourceConfigDedicated->physicalConfigDedicated, + radioResourceConfigDedicated->physicalConfigDedicated, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - radioResourceConfigDedicated->mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - NULL, // measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (MeasObjectToAddMod_t **) NULL, + radioResourceConfigDedicated->mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + NULL, // measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - break; - - default: - AssertFatal(1==0, - "Unknown message\n"); - break; - } - - } - } - else if (srb_id == 1){ + ); + break; + } // case - } - - else if (srb_id == 2){ + default: + AssertFatal(1==0, + "Unknown message\n"); + break; + }// switch case + } else if (srb_id == 1) { +// rrc_rlc_config_asn1_req(&ctxt, +// SRB_configList, +// (DRB_ToAddModList_t*) NULL, +// (DRB_ToReleaseList_t*) NULL +// #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +// , (PMCH_InfoList_r9_t *) NULL, +// 0,0 +// # endif +// ); + + LOG_I(DU_F1AP, "Received DL RRC Transfer on srb_id 1\n"); + rlc_op_status_t rlc_status; + boolean_t ret = TRUE; + mem_block_t *pdcp_pdu_p = NULL; + pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); + memset(&pdcp_pdu_p->data[0], 0, rrc_dl_sdu_len); + memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); + + if (pdcp_pdu_p != NULL) { + rlc_status = rlc_data_req(&ctxt + , 1 + , MBMS_FLAG_NO + , srb_id + , 0 + , 0 + , rrc_dl_sdu_len + , pdcp_pdu_p +#ifdef Rel14 + ,NULL + ,NULL +#endif + ); + switch (rlc_status) { + case RLC_OP_STATUS_OK: + LOG_D(PDCP, "Data sending request over RLC succeeded!\n"); + ret=TRUE; + break; + + case RLC_OP_STATUS_BAD_PARAMETER: + LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + ret= FALSE; + break; + + case RLC_OP_STATUS_INTERNAL_ERROR: + LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + ret= FALSE; + break; + + case RLC_OP_STATUS_OUT_OF_RESSOURCES: + LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + ret= FALSE; + break; + + default: + LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + ret= FALSE; + break; + } // switch case + return ret; + } // if pdcp_pdu_p + + } else if (srb_id == 2) { } #endif @@ -336,7 +391,6 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, ) { - rnti_t rnti = ctxt_pP->rnti; F1AP_F1AP_PDU_t pdu; @@ -402,6 +456,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } + LOG_W(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER on SRB %d for UE %x \n", rb_idP, rnti); du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); return 0; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index bcd14cfa36..64450a1ae7 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -175,8 +175,9 @@ void *F1AP_DU_task(void *arg) { case F1AP_UL_RRC_MESSAGE: // from rrc LOG_I(DU_F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); - DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &F1AP_UL_RRC_MESSAGE(received_msg)); + AssertFatal (1 == 0, "Should not be here!\n" ); + //DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // &F1AP_UL_RRC_MESSAGE(received_msg)); break; case TERMINATE_MESSAGE: diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 6d957e4ad6..b192cde0de 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -119,7 +119,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Calling the right handler */ - LOG_I(DU_F1AP, "Calling handler with instance %d\n",instance); + LOG_I(F1AP, "Calling handler with instance %d\n",instance); ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 3b4983a59d..bec37e1a29 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -49,9 +49,7 @@ #include "platform_constants.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "msc.h" - - - +#include "common/ngran_types.h" #if defined(ENABLE_SECURITY) # include "UTIL/OSA/osa_defs.h" @@ -411,53 +409,75 @@ boolean_t pdcp_data_req( free_mem_block(pdcp_pdu_p, __FUNCTION__); rlc_status = ack_result; } - - else + else // SRB #endif /*UETARGET*/ { - //It should never get here - rlc_status = rlc_data_req(ctxt_pP - , srb_flagP - , MBMS_FLAG_NO - , rb_idP - , muiP - , confirmP - , pdcp_pdu_size - , pdcp_pdu_p - #ifdef Rel14 - ,NULL - ,NULL - #endif - ); - } - - } + LOG_I(PDCP, "Sending F1AP_DL_RRC_MESSAGE with ITTI\n"); - switch (rlc_status) { - case RLC_OP_STATUS_OK: - LOG_D(PDCP, "Data sending request over RLC succeeded!\n"); - ret=TRUE; - break; + //It should never get here + if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)|| + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) ) { + // DL transfer + MessageDef *message_p; + // Note: the acyual task must be TASK_PDCP_ENB, but this task is not created + message_p = itti_alloc_new_message (TASK_PDCP_ENB, F1AP_DL_RRC_MESSAGE); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = &pdcp_pdu_p->data[0] ; + F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = pdcp_pdu_size; + F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_DL_RRC_MESSAGE (message_p).rnti = ctxt_pP->rnti; + F1AP_DL_RRC_MESSAGE (message_p).srb_id = rb_idP; + F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; + F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + //CU_send_DL_RRC_MESSAGE_TRANSFER(ctxt_pP->module_id, message_p); + LOG_I(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); + ret=TRUE; + + } else{ + rlc_status = rlc_data_req(ctxt_pP + , srb_flagP + , MBMS_FLAG_NO + , rb_idP + , muiP + , confirmP + , pdcp_pdu_size + , pdcp_pdu_p +#ifdef Rel14 + ,NULL + ,NULL +#endif + ); + switch (rlc_status) { + case RLC_OP_STATUS_OK: + LOG_D(PDCP, "Data sending request over RLC succeeded!\n"); + ret=TRUE; + break; - case RLC_OP_STATUS_BAD_PARAMETER: - LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_BAD_PARAMETER: + LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + ret= FALSE; + break; - case RLC_OP_STATUS_INTERNAL_ERROR: - LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_INTERNAL_ERROR: + LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + ret= FALSE; + break; - case RLC_OP_STATUS_OUT_OF_RESSOURCES: - LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_OUT_OF_RESSOURCES: + LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + ret= FALSE; + break; - default: - LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); - ret= FALSE; - break; + default: + LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + ret= FALSE; + break; + } // switch case + } + } } if (ctxt_pP->enb_flag == ENB_FLAG_YES) { @@ -978,6 +998,8 @@ void pdcp_update_stats(const protocol_ctxt_t* const ctxt_pP){ } } + + //----------------------------------------------------------------------------- void pdcp_run ( @@ -1020,6 +1042,7 @@ pdcp_run ( RRC_DCCH_DATA_REQ (msg_p).frame, 0, RRC_DCCH_DATA_REQ (msg_p).eNB_index); + LOG_I(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n", PROTOCOL_CTXT_ARGS(&ctxt), ITTI_MSG_NAME (msg_p), @@ -1030,6 +1053,8 @@ pdcp_run ( RRC_DCCH_DATA_REQ (msg_p).confirmp, RRC_DCCH_DATA_REQ (msg_p).mode); + log_dump(PDCP, RRC_DCCH_DATA_REQ (msg_p).sdu_p, RRC_DCCH_DATA_REQ (msg_p).sdu_size, LOG_DUMP_CHAR,"[MSG] pdcp run\n"); + result = pdcp_data_req (&ctxt, SRB_FLAG_YES, RRC_DCCH_DATA_REQ (msg_p).rb_id, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# b/openair2/LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# new file mode 100644 index 0000000000..e6a7929024 --- /dev/null +++ b/openair2/LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# @@ -0,0 +1,534 @@ +/* + * 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 + */ + +#define RLC_AM_MODULE 1 +#define RLC_AM_RECEIVER_C 1 +#include "platform_types.h" +//----------------------------------------------------------------------------- +#include "assertions.h" +#include "msc.h" +#include "rlc.h" +#include "rlc_am.h" +#include "list.h" +#include "LAYER2/MAC/mac_extern.h" +#include "common/utils/LOG/log.h" + + +//----------------------------------------------------------------------------- +signed int +rlc_am_get_data_pdu_infos( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + rlc_am_pdu_sn_10_t* header_pP, + int16_t total_sizeP, + rlc_am_pdu_info_t* pdu_info_pP) +{ + memset(pdu_info_pP, 0, sizeof (rlc_am_pdu_info_t)); + + int16_t sum_li = 0; + pdu_info_pP->d_c = header_pP->b1 >> 7; + pdu_info_pP->num_li = 0; + +//Assertion(eNB)_PRAN_DesignDocument_annex No.766 + if(pdu_info_pP->d_c == 0) + { + LOG_E(RLC, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id); + return -2; + } +/* + AssertFatal (pdu_info_pP->d_c != 0, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id); +*/ + pdu_info_pP->rf = (header_pP->b1 >> 6) & 0x01; + pdu_info_pP->p = (header_pP->b1 >> 5) & 0x01; + pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03; + pdu_info_pP->e = (header_pP->b1 >> 2) & 0x01; + pdu_info_pP->sn = header_pP->b2 + (((uint16_t)(header_pP->b1 & 0x03)) << 8); + + pdu_info_pP->header_size = 2; + + if (pdu_info_pP->rf) { + pdu_info_pP->lsf = (header_pP->data[0] >> 7) & 0x01; + pdu_info_pP->so = header_pP->data[1] + (((uint16_t)(header_pP->data[0] & 0x7F)) << 8); + pdu_info_pP->payload = &header_pP->data[2]; + pdu_info_pP->header_size += 2; + } else { + pdu_info_pP->payload = &header_pP->data[0]; + } + + if (pdu_info_pP->e) { + rlc_am_e_li_t *e_li; + unsigned int li_length_in_bytes = 1; + unsigned int li_to_read = 1; + + if (pdu_info_pP->rf) { + e_li = (rlc_am_e_li_t*)(&header_pP->data[2]); + } else { + e_li = (rlc_am_e_li_t*)(header_pP->data); + } + + while (li_to_read) { + li_length_in_bytes = li_length_in_bytes ^ 3; + + if (li_length_in_bytes == 2) { + pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li->b1 << 4)) & 0x07F0; + pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((uint8_t)(e_li->b2 >> 4)) & 0x000F); + li_to_read = e_li->b1 & 0x80; + pdu_info_pP->header_size += 2; + } else { + pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li->b2 << 8)) & 0x0700; + pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li->b3; + li_to_read = e_li->b2 & 0x08; + e_li++; + pdu_info_pP->header_size += 1; + } + + sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li]; + pdu_info_pP->num_li = pdu_info_pP->num_li + 1; + + if (pdu_info_pP->num_li > RLC_AM_MAX_SDU_IN_PDU) { + LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), + pdu_info_pP->sn); + return -2; + } + } + + if (li_length_in_bytes == 2) { + pdu_info_pP->payload = &e_li->b3; + } else { + pdu_info_pP->payload = &e_li->b1; + } + } + + pdu_info_pP->payload_size = total_sizeP - pdu_info_pP->header_size; + + if (pdu_info_pP->payload_size > sum_li) { + pdu_info_pP->hidden_size = pdu_info_pP->payload_size - sum_li; + } + + return 0; +} +//----------------------------------------------------------------------------- +void +rlc_am_display_data_pdu_infos( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + rlc_am_pdu_info_t* pdu_info_pP) +{ + int num_li; + + if (pdu_info_pP->d_c) { + if (pdu_info_pP->rf) { + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d SO %05d LSF %01d POLL %1d ", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), + pdu_info_pP->sn, + pdu_info_pP->fi, + pdu_info_pP->so, + pdu_info_pP->lsf, pdu_info_pP->p); + } else { + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d POLL %1d ", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), + pdu_info_pP->sn, + pdu_info_pP->fi, + pdu_info_pP->p); + } + + for (num_li = 0; num_li < pdu_info_pP->num_li; num_li++) { + LOG_D(RLC, "LI %05d ", pdu_info_pP->li_list[num_li]); + } + + if (pdu_info_pP->hidden_size > 0) { + LOG_D(RLC, "hidden size %05d ", pdu_info_pP->hidden_size); + } + + LOG_D(RLC, "\n"); + } else { + LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] ERROR RX CONTROL PDU\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); + } +} +// assumed the sn of the tb_p is equal to VR(MS) +//----------------------------------------------------------------------------- +void +rlc_am_rx_update_vr_ms( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + mem_block_t* tb_pP) +{ + //rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; + rlc_am_pdu_info_t* pdu_info_cursor_p = NULL; + mem_block_t* cursor_p; + + cursor_p = tb_pP; + + if (cursor_p) { + do { + pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info; + + if ((((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) || + (rlc_pP->vr_ms != pdu_info_cursor_p->sn)) { + +#if TRACE_RLC_AM_RX + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), + rlc_pP->vr_ms, pdu_info_cursor_p->sn); +#endif + + return; + } + + rlc_pP->vr_ms = RLC_AM_NEXT_SN(pdu_info_cursor_p->sn); + cursor_p = cursor_p->next; + } while ((cursor_p != NULL) && (rlc_pP->vr_ms != rlc_pP->vr_h)); + + } +} +// assumed the sn of the tb_p is equal to VR(R) +//----------------------------------------------------------------------------- +void +rlc_am_rx_update_vr_r( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + mem_block_t* tb_pP) +{ + rlc_am_pdu_info_t* pdu_info_cursor_p = NULL; + mem_block_t* cursor_p; + + cursor_p = tb_pP; + + if (cursor_p) { + do { + pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info; + + if ((((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) || + (rlc_pP->vr_r != pdu_info_cursor_p->sn)) { + return; + } + +#if TRACE_RLC_AM_RX + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[UPDATE VR(R)] UPDATED VR(R) %04d -> %04d\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), + rlc_pP->vr_r, + (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK); +#endif + + if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.rf == 1) { + if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.lsf == 1) { + rlc_pP->vr_r = (rlc_pP->vr_r + 1) & RLC_AM_SN_MASK; + } + } else { + rlc_pP->vr_r = (rlc_pP->vr_r + 1) & RLC_AM_SN_MASK; + } + + cursor_p = cursor_p->next; + } while (cursor_p != NULL); + + //rlc_pP->vr_r = (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK; + } +} +//----------------------------------------------------------------------------- +void +rlc_am_receive_routing ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + struct mac_data_ind data_indP) +{ + mem_block_t *tb_p = NULL; + uint8_t *first_byte_p = NULL; + sdu_size_t tb_size_in_bytes; + RLC_AM_MUTEX_LOCK(&rlc_pP->lock_input_sdus, ctxt_pP, rlc_pP); + + while ((tb_p = list_remove_head (&data_indP.data))) { + first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr; + tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size; + + if (tb_size_in_bytes > 0) { + if ((*first_byte_p & 0x80) == 0x80) { + rlc_pP->stat_rx_data_bytes += tb_size_in_bytes; + rlc_pP->stat_rx_data_pdu += 1; + rlc_am_receive_process_data_pdu (ctxt_pP, rlc_pP, tb_p, first_byte_p, tb_size_in_bytes); + } else { + rlc_pP->stat_rx_control_bytes += tb_size_in_bytes; + rlc_pP->stat_rx_control_pdu += 1; + rlc_am_receive_process_control_pdu (ctxt_pP, rlc_pP, tb_p, &first_byte_p, &tb_size_in_bytes); + // Test if remaining bytes not processed (up to know, highest probability is bug in MAC) +//Assertion(eNB)_PRAN_DesignDocument_annex No.767 + if(tb_size_in_bytes != 0) + { + LOG_E(RLC, "Remaining %d bytes following a control PDU\n", + tb_size_in_bytes); + } +/* + AssertFatal( tb_size_in_bytes == 0, + "Remaining %d bytes following a control PDU", + tb_size_in_bytes); +*/ + } + + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RX ROUTING] VR(R)=%03d VR(MR)=%03d\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), + rlc_pP->vr_r, + rlc_pP->vr_mr); + } + } // end while + RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus); +} +//----------------------------------------------------------------------------- +void +rlc_am_receive_process_data_pdu ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + mem_block_t* tb_pP, + uint8_t* first_byte_pP, + uint16_t tb_size_in_bytesP) +{ + // 5.1.3.2 Receive operations + // 5.1.3.2.1 General + // The receiving side of an AM RLC entity shall maintain a receiving window according to state variables VR(R) and + // VR(MR) as follows: + // - a SN falls within the receiving window if VR(R) <= SN < VR(MR); + // - a SN falls outside of the receiving window otherwise. + // + // When receiving a RLC data PDU from lower layer, the receiving side of an AM RLC entity shall: + // - either discard the received RLC data PDU or place it in the reception buffer (see sub clause 5.1.3.2.2); + // - if the received RLC data PDU was placed in the reception buffer: + // - update state variables, reassemble and deliver RLC SDUs to upper layer and start/stop t-Reordering as + // needed (see sub clause 5.1.3.2.3). + // When t-Reordering expires, the receiving side of an AM RLC entity shall: + // - update state variables and start t-Reordering as needed (see sub clause 5.1.3.2.4). + + + // 5.1.3.2.2 Actions when a RLC data PDU is received from lower layer + // When a RLC data PDU is received from lower layer, where the RLC data PDU contains byte segment numbers y to z of + // an AMD PDU with SN = x, the receiving side of an AM RLC entity shall: + // - if x falls outside of the receiving window; or + // - if byte segment numbers y to z of the AMD PDU with SN = x have been received before: + // - discard the received RLC data PDU; + // - else: + // - place the received RLC data PDU in the reception buffer; + // - if some byte segments of the AMD PDU contained in the RLC data PDU have been received before: + // - discard the duplicate byte segments. + rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; + rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)first_byte_pP; + rlc_am_rx_pdu_status_t pdu_status = RLC_AM_DATA_PDU_STATUS_OK; + boolean_t reassemble = false; + + if (rlc_am_get_data_pdu_infos(ctxt_pP,rlc_pP, rlc_am_pdu_sn_10_p, tb_size_in_bytesP, pdu_info_p) >= 0) { + + ((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received = 0; + + if (RLC_AM_SN_IN_WINDOW(pdu_info_p->sn, rlc_pP->vr_r)) { + + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SN=%04d] VR(R) %04d VR(H) %04d VR(MR) %04d VR(MS) %04d VR(X) %04d\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), + pdu_info_p->sn, + rlc_pP->vr_r, + rlc_pP->vr_h, + rlc_pP->vr_mr, + rlc_pP->vr_ms, + rlc_pP->vr_x); + + pdu_status = rlc_am_rx_list_check_duplicate_insert_pdu(ctxt_pP, rlc_pP,tb_pP); + if (pdu_status != RLC_AM_DATA_PDU_STATUS_OK) { + rlc_pP->stat_rx_data_pdu_dropped += 1; + rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP; + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED CAUSE=%d SN=%d\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_status,pdu_info_p->sn); +#if RLC_STOP_ON_LOST_PDU + AssertFatal( 0 == 1, + PROTOCOL_RLC_AM_CTXT_FMT" LOST PDU DETECTED\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); +#endif + } else { + // 5.1.3.2.3 + // Actions when a RLC data PDU is placed in the reception buffer + // + // When a RLC data PDU with SN = x is placed in the reception buffer, the receiving side of an AM RLC entity shall: + // - if x >= VR(H) + // - update VR(H) to x+ 1; + // + // - if all byte segments of the AMD PDU with SN = VR(MS) are received: + // - update VR(MS) to the SN of the first AMD PDU with SN > current VR(MS) for which not all byte segments + // have been received; + // + // - if x = VR(R): + // - if all byte segments of the AMD PDU with SN = VR(R) are received: + // - update VR(R) to the SN of the first AMD PDU with SN > current VR(R) for which not all byte segments + // have been received; + // - update VR(MR) to the updated VR(R) + AM_Window_Size; + // + // - reassemble RLC SDUs from any byte segments of AMD PDUs with SN that falls outside of the receiving + // window and in-sequence byte segments of the AMD PDU with SN = VR(R), remove RLC headers when + // doing so and deliver the reassembled RLC SDUs to upper layer in sequence if not delivered before; + // + // - if t-Reordering is running: + // - if VR(X) = VR(R); or + // - if VR(X) falls outside of the receiving window and VR(X) is not equal to VR(MR): + // - stop and reset t-Reordering; + // + // - if t-Reordering is not running (includes the case t-Reordering is stopped due to actions above): + // - if VR (H) > VR(R): + // - start t-Reordering; + // - set VR(X) to VR(H). + + +#if TRACE_RLC_AM_RX + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] RX LIST AFTER INSERTION:\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); + rlc_am_rx_list_display(rlc_pP, "rlc_am_receive_process_data_pdu AFTER INSERTION "); +#endif + + /* 1) Update vrH if sn >= vrH */ + if (RLC_AM_DIFF_SN(pdu_info_p->sn,rlc_pP->vr_r) >= RLC_AM_DIFF_SN(rlc_pP->vr_h,rlc_pP->vr_r)) + { + rlc_pP->vr_h = RLC_AM_NEXT_SN(pdu_info_p->sn); + } + + rlc_am_rx_check_all_byte_segments(ctxt_pP, rlc_pP, tb_pP); + + /* 2) Reordering Window Processing: Update vr_ms if sn = vr_ms and all bytes received for sn */ + if ((pdu_info_p->sn == rlc_pP->vr_ms) && (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received)) { + rlc_am_rx_update_vr_ms(ctxt_pP, rlc_pP, tb_pP); + } + + if (pdu_info_p->sn == rlc_pP->vr_r) { +mem_block_t* cursor_p = rlc_pP->receiver_buffer.head; +rlc_am_rx_pdu_management_t * pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data); +if( (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) == (pdu_cursor_mgnt_p->all_segments_received)){ + if (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) { + rlc_am_rx_update_vr_r(ctxt_pP, rlc_pP, tb_pP); + rlc_pP->vr_mr = (rlc_pP->vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK; + } + reassemble = rlc_am_rx_check_vr_reassemble(ctxt_pP, rlc_pP); + //TODO : optimization : check whether a reassembly is needed by looking at LI, FI, SO, etc... +}else{ + LOG_E(RLC, "BAD all_segments_received!!! discard buffer!!!\n"); + /* Discard received block if out of window, duplicate or header error */ + free_mem_block (tb_pP, __func__); +} + } + + //FNA: fix check VrX out of receiving window + if ((rlc_pP->t_reordering.running) || ((rlc_pP->t_reordering.ms_duration == 0) && (rlc_pP->vr_x != RLC_SN_UNDEFINED))) { + if ((rlc_pP->vr_x == rlc_pP->vr_r) || (!(RLC_AM_SN_IN_WINDOW(rlc_pP->vr_x, rlc_pP->vr_r)) && (rlc_pP->vr_x != rlc_pP->vr_mr))) { + rlc_am_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP); + rlc_pP->vr_x = RLC_SN_UNDEFINED; + } + } + + if (!(rlc_pP->t_reordering.running)) { + if (rlc_pP->vr_h != rlc_pP->vr_r) { // - if VR (H) > VR(R) translated to - if VR (H) != VR(R) + rlc_pP->vr_x = rlc_pP->vr_h; + if (rlc_pP->t_reordering.ms_duration != 0) { + rlc_am_start_timer_reordering(ctxt_pP, rlc_pP); + } + else { + /* specific case for no timer reordering configured */ + /* reordering window directly advances with vrH */ + rlc_pP->vr_ms = rlc_pP->vr_h; + + /* Trigger a Status and clear any existing Delay Flag */ + RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_T_REORDERING); + RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED); + rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED; + } + } + } + } + + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SN=%04d] NEW VR(R) %04d VR(H) %04d VR(MS) %04d VR(MR) %04d VR(X) %04d reassemble=%d\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), + pdu_info_p->sn, + rlc_pP->vr_r, + rlc_pP->vr_h, + rlc_pP->vr_ms, + rlc_pP->vr_mr, + rlc_pP->vr_x, + reassemble); + } else { + rlc_pP->stat_rx_data_pdu_out_of_window += 1; + rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP; + pdu_status = RLC_AM_DATA_PDU_STATUS_SN_OUTSIDE_WINDOW; + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, SN=%d\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_info_p->sn); + } + + /* 3) Check for triggering a Tx Status PDU if a poll is received or if a pending status was delayed */ + if ((pdu_info_p->p) && (pdu_status < RLC_AM_DATA_PDU_STATUS_BUFFER_FULL)) { + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] POLL BIT SET, STATUS REQUESTED:\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); + + /* Polling Info Saving for In and Out of Window PDU */ + /* avoid multi status trigger */ + if ((RLC_AM_GET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED)) || + !(RLC_AM_GET_STATUS(rlc_pP->status_requested,(RLC_AM_STATUS_TRIGGERED_POLL | RLC_AM_STATUS_TRIGGERED_T_REORDERING)))) + { + RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_POLL); + + if ((pdu_status != RLC_AM_DATA_PDU_STATUS_OK) || ((pdu_status == RLC_AM_DATA_PDU_STATUS_OK) && + (!(RLC_AM_SN_IN_WINDOW(pdu_info_p->sn,rlc_pP->vr_r)) || + (RLC_AM_DIFF_SN(pdu_info_p->sn,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r))) + ) + ) + { + /* Conditions are met for sending a Status Report */ + /* Then clear Delay Flag and reset its corresponding sn */ + RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED); + rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED; + } + else if (rlc_pP->sn_status_triggered_delayed == RLC_SN_UNDEFINED) + { + /* Delay status trigger if pdustatus OK and sn>= vr_ms */ + /* Note: vr_r and vr_ms have been updated */ + RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED); + rlc_pP->sn_status_triggered_delayed = pdu_info_p->sn; + } + } + } + + /* ReEnable a previously delayed Status Trigger if PDU discarded or */ + /* sn no more in RxWindow due to RxWindow advance or sn < vr_ms */ + if ((RLC_AM_GET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED)) && + (pdu_status == RLC_AM_DATA_PDU_STATUS_OK) && + (!(RLC_AM_SN_IN_WINDOW(rlc_pP->sn_status_triggered_delayed,rlc_pP->vr_r)) || + (RLC_AM_DIFF_SN(rlc_pP->sn_status_triggered_delayed,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r))) + ) + { + RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED); + rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED; + } + + + } else { + pdu_status = RLC_AM_DATA_PDU_STATUS_HEADER_ERROR; + LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED BAD HEADER FORMAT SN=%d\n", + PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_info_p->sn); + } + + if (pdu_status != RLC_AM_DATA_PDU_STATUS_OK) { + /* Discard received block if out of window, duplicate or header error */ + free_mem_block (tb_pP, __func__); + } + else if (reassemble) { + /* Reassemble SDUs */ + rlc_am_rx_list_reassemble_rlc_sdus(ctxt_pP, rlc_pP); + } +} diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index b3d8d36dc5..ac53afa40b 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -260,12 +260,12 @@ void mac_rlc_data_ind ( #ifdef DEBUG_MAC_INTERFACE if (num_tbP) { - LOG_I(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n", + LOG_I(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, tb_sizeP %d\n", PROTOCOL_CTXT_ARGS(&ctxt), channel_idP, RLC_MAX_LC, NB_RB_MAX, - num_tbP); + tb_sizeP); } #endif // DEBUG_MAC_INTERFACE diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index b03b36a557..e8aece9f29 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -94,6 +94,8 @@ rrc_data_req( RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP; RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP; RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer; + //memcpy (RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP); + RRC_DCCH_DATA_REQ (message_p).mode = modeP; RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id; RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti; @@ -103,6 +105,10 @@ rrc_data_req( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->instance, message_p); + LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n"); + // RS/BK: Fix ME + pdcp_run(ctxt_pP); + return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 4c54f75d29..0dbbd7d747 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1167,8 +1167,10 @@ rrc_eNB_generate_SecurityModeCommand( rrc_eNB_mui, size); - if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) || - (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB)) { + if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU)) { + LOG_I(RRC,"calling rrc_data_req :securityModeCommand\n"); + rrc_data_req( ctxt_pP, DCCH, diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 15ea141301..1f5a8772d4 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -923,7 +923,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer); LOG_DUMPMSG(RRC,DEBUG_RRC,buffer,length,"[MSG] RRC DL Information Transfer\n"); - /* * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. */ diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index aea5a5ab99..793eb90740 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -85,6 +85,10 @@ int create_tasks(uint32_t enb_nb) if (enb_nb > 0) { rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL); AssertFatal(rc >= 0, "Create task for CU F1AP failed\n"); + //RS/BK: Fix me! + rc = itti_create_task (TASK_L2L1, l2l1_task, NULL); + AssertFatal(rc >= 0, "Create task for L2L1 failed\n"); + } /* fall through */ case ngran_eNB: diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 2145e5d98c..34ac829f5c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1082,6 +1082,16 @@ int main( int argc, char **argv ) RCconfig_L1(); } + + if (RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU) { + protocol_ctxt_t ctxt; + ctxt.module_id = 0 ; + ctxt.instance = 0; + ctxt.rnti = 0; + ctxt.enb_flag = 1; + pdcp_run(&ctxt); + } + /* start threads if only L1 or not a CU */ if (RC.nb_inst == 0 || !(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { -- GitLab From 0372c9b2899cf028e11ac0464e7b13b1a30b34ea Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Thu, 20 Sep 2018 19:12:05 +0200 Subject: [PATCH 110/308] Generate the DCCH and send from pdcp --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 14 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 313 +++++++++++-------- openair2/F1AP/f1ap_du_task.c | 5 +- openair2/F1AP/f1ap_handlers.c | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 111 ++++--- openair2/LAYER2/RLC/rlc_mac.c | 4 +- openair2/RRC/LTE/L2_interface_common.c | 6 + openair2/RRC/LTE/rrc_eNB.c | 6 +- openair2/RRC/LTE/rrc_eNB_S1AP.c | 1 - targets/COMMON/create_tasks.c | 4 + targets/RT/USER/lte-softmodem.c | 10 + 11 files changed, 290 insertions(+), 186 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 1b30602cdf..5ddb6fb187 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -264,7 +264,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); @@ -365,15 +365,17 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, */ protocol_ctxt_t ctxt; ctxt.module_id = instance; + ctxt.instance = instance; ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id); ctxt.enb_flag = 1; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); + LOG_I(CU_F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %d (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); pdcp_data_ind (&ctxt, - 1, - 0, - srb_id, - ie->value.choice.RRCContainer.size, - mb); + 1, // srb_flag + 0, // embms_flag + srb_id, + ie->value.choice.RRCContainer.size, + mb); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 63066a4b8d..12d599bc39 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -175,153 +175,208 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); + protocol_ctxt_t ctxt; + ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id); + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; + if (srb_id == 0) { DL_CCCH_Message_t* dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; dec_rval = uper_decode(NULL, - &asn_DEF_DL_CCCH_Message, - (void**)&dl_ccch_msg, - ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len,0,0); + &asn_DEF_DL_CCCH_Message, + (void**)&dl_ccch_msg, + ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len,0,0); switch (dl_ccch_msg->message.choice.c1.present) { - - case DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, "Received PR_NOTHING on DL-CCCH-Message\n"); - break; - - case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n"); - break; - - case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n"); - break; - - case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); - break; - - case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: + + case DL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, "Received PR_NOTHING on DL-CCCH-Message\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); + break; + + case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: { - LOG_I(RRC, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); - // Get configuration - - RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; - // eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; - AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); - RadioResourceConfigDedicated_t* radioResourceConfigDedicated = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated; - - // get SRB logical channel information - SRB_ToAddModList_t *SRB_configList; - SRB_ToAddMod_t *SRB1_config; - LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; - SRB_configList = radioResourceConfigDedicated->srb_ToAddModList; - - AssertFatal(SRB_configList!=NULL,"SRB_configList is null\n"); - for (int cnt = 0; cnt < (SRB_configList)->list.count; cnt++) { - if ((SRB_configList)->list.array[cnt]->srb_Identity == 1) { - SRB1_config = (SRB_configList)->list.array[cnt]; - - if (SRB1_config->logicalChannelConfig) { - if (SRB1_config->logicalChannelConfig->present == - SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { - SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; - } else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - } else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - - - } - } - - protocol_ctxt_t ctxt; - ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id); - ctxt.module_id = instance; - ctxt.enb_flag = 1; - rrc_rlc_config_asn1_req(&ctxt, - SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL + LOG_I(RRC, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); + // Get configuration + + RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; + // eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); + RadioResourceConfigDedicated_t* radioResourceConfigDedicated = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated; + + // get SRB logical channel information + SRB_ToAddModList_t *SRB_configList; + SRB_ToAddMod_t *SRB1_config; + LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + SRB_configList = radioResourceConfigDedicated->srb_ToAddModList; + + AssertFatal(SRB_configList!=NULL,"SRB_configList is null\n"); + for (int cnt = 0; cnt < (SRB_configList)->list.count; cnt++) { + if ((SRB_configList)->list.array[cnt]->srb_Identity == 1) { + SRB1_config = (SRB_configList)->list.array[cnt]; + + if (SRB1_config->logicalChannelConfig) { + if (SRB1_config->logicalChannelConfig->present == + SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } + } // for + rrc_rlc_config_asn1_req(&ctxt, + SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL, - 0,0 + , (PMCH_InfoList_r9_t *) NULL, + 0,0 # endif - ); - - // This should be somewhere in the f1ap_cudu_ue_inst_t - int macrlc_instance = 0; - - rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id); - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); - - eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); - - memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, - (void*)ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len); - - ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; - - rrc_mac_config_req_eNB( - macrlc_instance, - 0, //primaryCC_id, - 0,0,0,0,0, + ); + + // This should be somewhere in the f1ap_cudu_ue_inst_t + int macrlc_instance = 0; + + rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); + + eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); + + memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, + (void*)ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len); + + ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; + + rrc_mac_config_req_eNB( + macrlc_instance, + 0, //primaryCC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0, #endif - rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - radioResourceConfigDedicated->physicalConfigDedicated, + radioResourceConfigDedicated->physicalConfigDedicated, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - radioResourceConfigDedicated->mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - NULL, // measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (MeasObjectToAddMod_t **) NULL, + radioResourceConfigDedicated->mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + NULL, // measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - break; - - default: - AssertFatal(1==0, - "Unknown message\n"); - break; - } - - } - } - else if (srb_id == 1){ + ); + break; + } // case - } - - else if (srb_id == 2){ + default: + AssertFatal(1==0, + "Unknown message\n"); + break; + }// switch case + } else if (srb_id == 1) { +// rrc_rlc_config_asn1_req(&ctxt, +// SRB_configList, +// (DRB_ToAddModList_t*) NULL, +// (DRB_ToReleaseList_t*) NULL +// #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +// , (PMCH_InfoList_r9_t *) NULL, +// 0,0 +// # endif +// ); + + LOG_I(DU_F1AP, "Received DL RRC Transfer on srb_id 1\n"); + rlc_op_status_t rlc_status; + boolean_t ret = TRUE; + mem_block_t *pdcp_pdu_p = NULL; + pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); + memset(&pdcp_pdu_p->data[0], 0, rrc_dl_sdu_len); + memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); + + if (pdcp_pdu_p != NULL) { + rlc_status = rlc_data_req(&ctxt + , 1 + , MBMS_FLAG_NO + , srb_id + , 0 + , 0 + , rrc_dl_sdu_len + , pdcp_pdu_p +#ifdef Rel14 + ,NULL + ,NULL +#endif + ); + switch (rlc_status) { + case RLC_OP_STATUS_OK: + LOG_D(PDCP, "Data sending request over RLC succeeded!\n"); + ret=TRUE; + break; + + case RLC_OP_STATUS_BAD_PARAMETER: + LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + ret= FALSE; + break; + + case RLC_OP_STATUS_INTERNAL_ERROR: + LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + ret= FALSE; + break; + + case RLC_OP_STATUS_OUT_OF_RESSOURCES: + LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + ret= FALSE; + break; + + default: + LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + ret= FALSE; + break; + } // switch case + return ret; + } // if pdcp_pdu_p + + } else if (srb_id == 2) { } #endif @@ -336,7 +391,6 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, ) { - rnti_t rnti = ctxt_pP->rnti; F1AP_F1AP_PDU_t pdu; @@ -402,6 +456,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } + LOG_W(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER on SRB %d for UE %x \n", rb_idP, rnti); du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); return 0; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index bcd14cfa36..64450a1ae7 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -175,8 +175,9 @@ void *F1AP_DU_task(void *arg) { case F1AP_UL_RRC_MESSAGE: // from rrc LOG_I(DU_F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); - DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &F1AP_UL_RRC_MESSAGE(received_msg)); + AssertFatal (1 == 0, "Should not be here!\n" ); + //DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // &F1AP_UL_RRC_MESSAGE(received_msg)); break; case TERMINATE_MESSAGE: diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 6d957e4ad6..b192cde0de 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -119,7 +119,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Calling the right handler */ - LOG_I(DU_F1AP, "Calling handler with instance %d\n",instance); + LOG_I(F1AP, "Calling handler with instance %d\n",instance); ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 3b4983a59d..bec37e1a29 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -49,9 +49,7 @@ #include "platform_constants.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "msc.h" - - - +#include "common/ngran_types.h" #if defined(ENABLE_SECURITY) # include "UTIL/OSA/osa_defs.h" @@ -411,53 +409,75 @@ boolean_t pdcp_data_req( free_mem_block(pdcp_pdu_p, __FUNCTION__); rlc_status = ack_result; } - - else + else // SRB #endif /*UETARGET*/ { - //It should never get here - rlc_status = rlc_data_req(ctxt_pP - , srb_flagP - , MBMS_FLAG_NO - , rb_idP - , muiP - , confirmP - , pdcp_pdu_size - , pdcp_pdu_p - #ifdef Rel14 - ,NULL - ,NULL - #endif - ); - } - - } + LOG_I(PDCP, "Sending F1AP_DL_RRC_MESSAGE with ITTI\n"); - switch (rlc_status) { - case RLC_OP_STATUS_OK: - LOG_D(PDCP, "Data sending request over RLC succeeded!\n"); - ret=TRUE; - break; + //It should never get here + if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)|| + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) ) { + // DL transfer + MessageDef *message_p; + // Note: the acyual task must be TASK_PDCP_ENB, but this task is not created + message_p = itti_alloc_new_message (TASK_PDCP_ENB, F1AP_DL_RRC_MESSAGE); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = &pdcp_pdu_p->data[0] ; + F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = pdcp_pdu_size; + F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; + F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_DL_RRC_MESSAGE (message_p).rnti = ctxt_pP->rnti; + F1AP_DL_RRC_MESSAGE (message_p).srb_id = rb_idP; + F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; + F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + //CU_send_DL_RRC_MESSAGE_TRANSFER(ctxt_pP->module_id, message_p); + LOG_I(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); + ret=TRUE; + + } else{ + rlc_status = rlc_data_req(ctxt_pP + , srb_flagP + , MBMS_FLAG_NO + , rb_idP + , muiP + , confirmP + , pdcp_pdu_size + , pdcp_pdu_p +#ifdef Rel14 + ,NULL + ,NULL +#endif + ); + switch (rlc_status) { + case RLC_OP_STATUS_OK: + LOG_D(PDCP, "Data sending request over RLC succeeded!\n"); + ret=TRUE; + break; - case RLC_OP_STATUS_BAD_PARAMETER: - LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_BAD_PARAMETER: + LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + ret= FALSE; + break; - case RLC_OP_STATUS_INTERNAL_ERROR: - LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_INTERNAL_ERROR: + LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + ret= FALSE; + break; - case RLC_OP_STATUS_OUT_OF_RESSOURCES: - LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_OUT_OF_RESSOURCES: + LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + ret= FALSE; + break; - default: - LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); - ret= FALSE; - break; + default: + LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + ret= FALSE; + break; + } // switch case + } + } } if (ctxt_pP->enb_flag == ENB_FLAG_YES) { @@ -978,6 +998,8 @@ void pdcp_update_stats(const protocol_ctxt_t* const ctxt_pP){ } } + + //----------------------------------------------------------------------------- void pdcp_run ( @@ -1020,6 +1042,7 @@ pdcp_run ( RRC_DCCH_DATA_REQ (msg_p).frame, 0, RRC_DCCH_DATA_REQ (msg_p).eNB_index); + LOG_I(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n", PROTOCOL_CTXT_ARGS(&ctxt), ITTI_MSG_NAME (msg_p), @@ -1030,6 +1053,8 @@ pdcp_run ( RRC_DCCH_DATA_REQ (msg_p).confirmp, RRC_DCCH_DATA_REQ (msg_p).mode); + log_dump(PDCP, RRC_DCCH_DATA_REQ (msg_p).sdu_p, RRC_DCCH_DATA_REQ (msg_p).sdu_size, LOG_DUMP_CHAR,"[MSG] pdcp run\n"); + result = pdcp_data_req (&ctxt, SRB_FLAG_YES, RRC_DCCH_DATA_REQ (msg_p).rb_id, diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index b3d8d36dc5..ac53afa40b 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -260,12 +260,12 @@ void mac_rlc_data_ind ( #ifdef DEBUG_MAC_INTERFACE if (num_tbP) { - LOG_I(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n", + LOG_I(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, tb_sizeP %d\n", PROTOCOL_CTXT_ARGS(&ctxt), channel_idP, RLC_MAX_LC, NB_RB_MAX, - num_tbP); + tb_sizeP); } #endif // DEBUG_MAC_INTERFACE diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index b03b36a557..e8aece9f29 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -94,6 +94,8 @@ rrc_data_req( RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP; RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP; RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer; + //memcpy (RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP); + RRC_DCCH_DATA_REQ (message_p).mode = modeP; RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id; RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti; @@ -103,6 +105,10 @@ rrc_data_req( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->instance, message_p); + LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n"); + // RS/BK: Fix ME + pdcp_run(ctxt_pP); + return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 4c54f75d29..0dbbd7d747 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1167,8 +1167,10 @@ rrc_eNB_generate_SecurityModeCommand( rrc_eNB_mui, size); - if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) || - (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB)) { + if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU)) { + LOG_I(RRC,"calling rrc_data_req :securityModeCommand\n"); + rrc_data_req( ctxt_pP, DCCH, diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 15ea141301..1f5a8772d4 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -923,7 +923,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer); LOG_DUMPMSG(RRC,DEBUG_RRC,buffer,length,"[MSG] RRC DL Information Transfer\n"); - /* * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. */ diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index aea5a5ab99..793eb90740 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -85,6 +85,10 @@ int create_tasks(uint32_t enb_nb) if (enb_nb > 0) { rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL); AssertFatal(rc >= 0, "Create task for CU F1AP failed\n"); + //RS/BK: Fix me! + rc = itti_create_task (TASK_L2L1, l2l1_task, NULL); + AssertFatal(rc >= 0, "Create task for L2L1 failed\n"); + } /* fall through */ case ngran_eNB: diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 2145e5d98c..34ac829f5c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1082,6 +1082,16 @@ int main( int argc, char **argv ) RCconfig_L1(); } + + if (RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU) { + protocol_ctxt_t ctxt; + ctxt.module_id = 0 ; + ctxt.instance = 0; + ctxt.rnti = 0; + ctxt.enb_flag = 1; + pdcp_run(&ctxt); + } + /* start threads if only L1 or not a CU */ if (RC.nb_inst == 0 || !(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { -- GitLab From a8bd9df3ebe45533a35b49b09d248f795f3321ff Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 20 Sep 2018 20:06:57 +0200 Subject: [PATCH 111/308] Remove local_interface from F1U/UDP parameters --- openair2/ENB_APP/enb_config.h | 1 - openair2/F1AP/f1ap_cu_task.c | 1 - openair2/F1AP/f1ap_du_task.c | 1 - openair2/LAYER2/PROTO_AGENT/cu_test.c | 1 - openair2/LAYER2/PROTO_AGENT/du_test.c | 1 - openair2/LAYER2/PROTO_AGENT/proto_agent.c | 1 - 6 files changed, 6 deletions(-) diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 2e17511213..f0f964feb0 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -80,7 +80,6 @@ typedef struct mme_ip_address_s { } mme_ip_address_t; typedef struct cu_params { - const char *local_interface; const char *local_ipv4_address; const uint16_t local_port; const char *remote_ipv4_address; diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 925a6327d0..e631362226 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -68,7 +68,6 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat /* setup parameters for F1U and start the server */ const cudu_params_t params = { - .local_interface = NULL, /* is not used */ .local_ipv4_address = RC.rrc[instance]->eth_params_s.my_addr, .local_port = RC.rrc[instance]->eth_params_s.my_portd, .remote_ipv4_address = RC.rrc[instance]->eth_params_s.remote_addr, diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 64450a1ae7..0c94fc283a 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -100,7 +100,6 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat /* setup parameters for F1U and start the server */ const cudu_params_t params = { - .local_interface = NULL, /* is not used */ .local_ipv4_address = RC.mac[instance]->eth_params_n.my_addr, .local_port = RC.mac[instance]->eth_params_n.my_portd, .remote_ipv4_address = RC.mac[instance]->eth_params_n.remote_addr, diff --git a/openair2/LAYER2/PROTO_AGENT/cu_test.c b/openair2/LAYER2/PROTO_AGENT/cu_test.c index ae9a2129e5..2abb85c941 100644 --- a/openair2/LAYER2/PROTO_AGENT/cu_test.c +++ b/openair2/LAYER2/PROTO_AGENT/cu_test.c @@ -51,7 +51,6 @@ void close_proto_agent(void) int main(int argc, char *argv[]) { const cudu_params_t params = { - .local_interface = "lo", .local_ipv4_address = "192.168.12.45", .local_port = 6464, .remote_ipv4_address = "192.168.12.45", diff --git a/openair2/LAYER2/PROTO_AGENT/du_test.c b/openair2/LAYER2/PROTO_AGENT/du_test.c index 04fac69f31..b455ba43d0 100644 --- a/openair2/LAYER2/PROTO_AGENT/du_test.c +++ b/openair2/LAYER2/PROTO_AGENT/du_test.c @@ -52,7 +52,6 @@ void close_proto_agent(void) int main(int argc, char *argv[]) { const cudu_params_t params = { - .local_interface = "lo", .local_ipv4_address = "192.168.12.45", .local_port = 6465, .remote_ipv4_address = "192.168.12.45", diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index a03ba2781b..44194255c6 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -59,7 +59,6 @@ int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) { int channel_id; - DevAssert(p->local_interface); DevAssert(p->local_ipv4_address); DevAssert(p->local_port > 1024); // "unprivileged" port DevAssert(p->remote_ipv4_address); -- GitLab From 5a8622960eaacfe39a5214fdcc53bf17f8e64365 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Thu, 20 Sep 2018 16:13:59 -0400 Subject: [PATCH 112/308] partial removal of warning --- cmake_targets/tools/build_helper | 9 +--- openair2/F1AP/f1ap_cu_interface_management.c | 11 ++--- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 18 +++----- openair2/F1AP/f1ap_cu_ue_context_management.c | 43 ++++++++++--------- openair2/F1AP/f1ap_du_interface_management.c | 8 ++-- .../CONF/du.lte.band7.10MHz.if4p5.conf | 24 +++++------ 6 files changed, 50 insertions(+), 63 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 55963e93b4..c4188ac088 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -102,6 +102,7 @@ check_supported_distribution() { "ubuntu14.04") return 0 ;; "fedora24") return 0 ;; "rhel7") return 0 ;; + "rhel7.5") return 0 ;; "centos7") return 0 ;; esac return 1 @@ -560,8 +561,6 @@ check_install_oai_software() { libidn2-0-dev \ libidn11-dev \ libmysqlclient-dev \ - liboctave-dev \ - libpgm-dev \ libpython2.7-dev \ libsctp1 \ libsctp-dev \ @@ -572,8 +571,6 @@ check_install_oai_software() { libxml2-dev \ libxslt1-dev \ mscgen \ - octave \ - octave-signal \ openssh-client \ openssh-server \ openssl \ @@ -633,8 +630,6 @@ check_install_oai_software() { libidn2-devel \ libidn-devel \ mariadb-devel \ - octave-devel \ - openpgm-devel \ lksctp-tools \ lksctp-tools-devel \ openssl-devel \ @@ -644,8 +639,6 @@ check_install_oai_software() { libxml2 \ libxml2-devel \ libxslt-devel \ - octave \ - octave-signal \ openssh-clients \ openssh-server \ openssl \ diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 75f59c837a..a81b722910 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -150,10 +150,10 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // NR cellID BIT_STRING_TO_NR_CELL_IDENTITY(&served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity, F1AP_SETUP_REQ(message_p).nr_cellid[i]); - LOG_D(CU_F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, + LOG_D(CU_F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], - F1AP_SETUP_REQ(message_p).nr_cellid[i]); + (long long unsigned int)F1AP_SETUP_REQ(message_p).nr_cellid[i]); LOG_D(CU_F1AP, "nr_cellId : %x %x %x %x %x\n", served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], @@ -335,11 +335,12 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - LOG_D(CU_F1AP, "SI %d: "); + LOG_D(CU_F1AP, "SI %d: ",i); for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) LOG_D(CU_F1AP, "%2x ",f1ap_setup_resp->SI_container[i][0][n]); LOG_D(CU_F1AP, "\n"); OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, - f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); + (const char*)f1ap_setup_resp->SI_container[i][0], + f1ap_setup_resp->SI_container_length[i][0]); LOG_D(CU_F1AP, "f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; @@ -350,7 +351,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, ASN_SEQUENCE_ADD(&p_160P9_t.list, cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_item.iE_Extensions = &p_160P9_t; + cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_160P9_t; } /* ADD */ diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 1b30602cdf..cf96541be2 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -73,7 +73,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_InitialULRRCMessageTransferIEs_t *ie; rnti_t rnti; - uint8_t *ccch_sdu; sdu_size_t ccch_sdu_len; int CC_id =0; @@ -135,7 +134,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, break; } } - AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %ll\n",nr_cellid); + AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %llu\n",(unsigned long long int)nr_cellid); int f1ap_uid = f1ap_add_ue(&f1ap_cu_ue[rrc_inst], rrc_inst, CC_id, 0, rnti); if (f1ap_uid < 0 ) { @@ -193,8 +192,8 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - LOG_I(CU_F1AP, "Setting GNB_CU_UE_F1AP_ID %d associated with UE RNTI %x (instance %d)\n", - ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); + LOG_I(CU_F1AP, "Setting GNB_CU_UE_F1AP_ID %llu associated with UE RNTI %x (instance %d)\n", + (unsigned long long int)ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); /* mandatory */ @@ -205,7 +204,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); //f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - LOG_I(CU_F1AP, "GNB_DU_UE_F1AP_ID %d associated with UE RNTI %x \n", ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti); + LOG_I(CU_F1AP, "GNB_DU_UE_F1AP_ID %llu associated with UE RNTI %x \n", (unsigned long long int)ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti); /* optional */ /* c3. oldgNB_DU_UE_F1AP_ID */ @@ -245,7 +244,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ @@ -287,20 +286,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_D(CU_F1AP, "CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); - MessageDef *message_p; F1AP_ULRRCMessageTransfer_t *container; F1AP_ULRRCMessageTransferIEs_t *ie; - uint8_t *buffer; - uint32_t len; uint64_t cu_ue_f1ap_id; uint64_t du_ue_f1ap_id; uint64_t srb_id; - int executeDuplication; - sdu_size_t ccch_sdu_len; - uint64_t subscriberProfileIDforRFP; - uint64_t rAT_FrequencySelectionPriority; DevAssert(pdu != NULL); diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index da04a80578..9db464dcd3 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -35,6 +35,7 @@ #include "f1ap_decoder.h" #include "f1ap_itti_messaging.h" #include "f1ap_cu_ue_context_management.h" +#include <string.h> extern f1ap_setup_req_t *f1ap_du_data_from_du; @@ -217,7 +218,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->value.choice.ResourceCoordinationTransferContainer.buf = malloc(4); ie->value.choice.ResourceCoordinationTransferContainer.size = 4; - strncpy(ie->value.choice.ResourceCoordinationTransferContainer.buf, "123", 3); + strncpy((char *)ie->value.choice.ResourceCoordinationTransferContainer.buf, "123", 3); OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", @@ -264,7 +265,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 10.1.3 sCellULConfigured*/ if (0) { scell_toBeSetup_item.sCellULConfigured = (F1AP_CellULConfigured_t *)calloc(1, sizeof(F1AP_CellULConfigured_t)); - scell_toBeSetup_item.sCellULConfigured = F1AP_CellULConfigured_ul_and_sul; // enum + *scell_toBeSetup_item.sCellULConfigured = F1AP_CellULConfigured_ul_and_sul; // enum } /* ADD */ @@ -390,21 +391,21 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* qoSPriorityLevel */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; } } else { @@ -424,21 +425,21 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* delayCritical */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; } } // if some_decide_qoS_characteristics @@ -465,14 +466,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* maxPacketLossRateDownlink */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; } } @@ -481,7 +482,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* reflective_QoS_Attribute */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; } } // dRB_QoS @@ -503,7 +504,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.2.3 notificationControl */ if (0) { drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = (F1AP_NotificationControl_t *)calloc(1, sizeof(F1AP_NotificationControl_t)); - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = F1AP_NotificationControl_active; // enum + *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = F1AP_NotificationControl_active; // enum } /* 12.1.2.4 flows_Mapped_To_DRB_List */ // BK: need verifiy @@ -532,21 +533,21 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* qoSPriorityLevel */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; } } else { @@ -566,21 +567,21 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* delayCritical */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; } } // if some_decide_qoS_characteristics @@ -607,14 +608,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* maxPacketLossRateDownlink */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; } } @@ -623,7 +624,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* reflective_QoS_Attribute */ if (0) { flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = 1L; + *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = 1L; } } // qoSFlowLevelQoSParameters diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 58bdabe265..189831c064 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -174,7 +174,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); - LOG_D(DU_F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",f1ap_du_data->nr_cellid[i], + LOG_D(DU_F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",(long long unsigned int)f1ap_du_data->nr_cellid[i], nRCGI.nRCellIdentity.buf[0], nRCGI.nRCellIdentity.buf[1], nRCGI.nRCellIdentity.buf[2], @@ -188,7 +188,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - &f1ap_du_data->tac[i], + (const char*)&f1ap_du_data->tac[i], 3); /* - Configured_EPS_TAC */ @@ -379,11 +379,11 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - f1ap_du_data->mib[i],//f1ap_du_data->mib, + (const char*)f1ap_du_data->mib[i],//f1ap_du_data->mib, f1ap_du_data->mib_length[i]); OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - f1ap_du_data->sib1[i], + (const char*)f1ap_du_data->sib1[i], f1ap_du_data->sib1_length[i]); gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; // diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf index 36a4bfde9e..32d9436f12 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf @@ -13,9 +13,9 @@ eNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = "1"; - mobile_country_code = "208"; + mobile_country_code = "001"; - mobile_network_code = "93"; + mobile_network_code = "01"; nr_cellid = 12345678L @@ -60,9 +60,9 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "f1"; - local_n_if_name = "lo"; - remote_n_address = "127.0.0.2"; - local_n_address = "127.0.0.1"; + local_n_if_name = "vlan203"; + remote_n_address = "192.168.203.16"; + local_n_address = "192.168.203.242"; local_n_portc = 60000; remote_n_portc = 60001; local_n_portd = 60010; @@ -79,13 +79,13 @@ L1s = ( RUs = ( { - local_if_name = "lo"; - remote_address = "127.0.0.2"; - local_address = "127.0.0.1"; - local_portc = 50000; - remote_portc = 50000; - local_portd = 50001; - remote_portd = 50001; + local_if_name = "enp4s0f1"; + local_address = "192.168.41.3"; + remote_address = "192.168.41.1"; + local_portc = 50000; + remote_portc = 50000; + local_portd = 50001; + remote_portd = 50001; local_rf = "no" tr_preference = "udp_if4p5" nb_tx = 1 -- GitLab From 05c7681b5a7ea201832eb9f234ad792fc6c72c3c Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Thu, 20 Sep 2018 16:23:35 -0400 Subject: [PATCH 113/308] cu machine @ RH --- cmake_targets/tools/build_helper | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 55963e93b4..e2589e7c7e 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -102,6 +102,7 @@ check_supported_distribution() { "ubuntu14.04") return 0 ;; "fedora24") return 0 ;; "rhel7") return 0 ;; + "rhel7.5") return 0 ;; "centos7") return 0 ;; esac return 1 @@ -560,8 +561,6 @@ check_install_oai_software() { libidn2-0-dev \ libidn11-dev \ libmysqlclient-dev \ - liboctave-dev \ - libpgm-dev \ libpython2.7-dev \ libsctp1 \ libsctp-dev \ @@ -572,7 +571,6 @@ check_install_oai_software() { libxml2-dev \ libxslt1-dev \ mscgen \ - octave \ octave-signal \ openssh-client \ openssh-server \ @@ -633,8 +631,6 @@ check_install_oai_software() { libidn2-devel \ libidn-devel \ mariadb-devel \ - octave-devel \ - openpgm-devel \ lksctp-tools \ lksctp-tools-devel \ openssl-devel \ @@ -644,8 +640,6 @@ check_install_oai_software() { libxml2 \ libxml2-devel \ libxslt-devel \ - octave \ - octave-signal \ openssh-clients \ openssh-server \ openssl \ -- GitLab From 8a11e8dd52e03e7491f5f1a6fd3a11b191898b46 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 21 Sep 2018 07:58:25 +0200 Subject: [PATCH 114/308] protection of RLC configuration in case of CU --- openair2/RRC/LTE/rrc_eNB.c | 501 ++++++++++++++++++++----------------- 1 file changed, 269 insertions(+), 232 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 4c54f75d29..c2dc1c761a 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -507,6 +507,8 @@ init_MCCH( int sync_area = 0; // initialize RRC_eNB_INST MCCH entry + eNB_RRC_INST *rrc = RC.rrc[enb_mod_idP]; + RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE = malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*)); @@ -551,43 +553,44 @@ init_MCCH( // LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); // LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); - rrc_mac_config_req_eNB(enb_mod_idP, CC_id, - 0,0,0,0,0, + if (rrc->node_type == ngran_eNB) { + rrc_mac_config_req_eNB(enb_mod_idP, CC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0, #endif - 0,//rnti - (BCCH_BCH_Message_t *)NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + 0,//rnti + (BCCH_BCH_Message_t *)NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (struct PhysicalConfigDedicated *)NULL, + (struct PhysicalConfigDedicated *)NULL, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - (MAC_MainConfig_t *) NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *) NULL, - (TDD_Config_t *) NULL, - (MobilityControlInfo_t *)NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + (MobilityControlInfo_t *)NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , - 0, - (MBSFN_AreaInfoList_r9_t *) NULL, - (PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - + ); + } //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); } @@ -621,18 +624,21 @@ static void init_MBMS( , &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) #endif ,NULL); - - rrc_rlc_config_asn1_req(&ctxt, - NULL, // SRB_ToAddModList - NULL, // DRB_ToAddModList - NULL, // DRB_ToReleaseList - &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) + + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + rrc_rlc_config_asn1_req(&ctxt, + NULL, // SRB_ToAddModList + NULL, // DRB_ToAddModList + NULL, // DRB_ToReleaseList + &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0, 0 + ,0, 0 #endif - ); - + ); + } //rrc_mac_config_req(); } } @@ -1330,39 +1336,41 @@ rrc_eNB_generate_RRCConnectionReestablishment( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_mac_config_req_eNB(ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, + if (rrc->node_type == ngran_eNB) { + rrc_mac_config_req_eNB(ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0, #endif - ctxt_pP->rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ctxt_pP->rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (struct PhysicalConfigDedicated* ) ue_context_pP->ue_context.physicalConfigDedicated, + (struct PhysicalConfigDedicated* ) ue_context_pP->ue_context.physicalConfigDedicated, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - ,(SystemInformationBlockType1_v1310_IEs_t *)NULL + ,(SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); + ); + } break; } } @@ -4772,45 +4780,46 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( LOG_D(RRC, "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id); - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, + if (rrc->node_type == ngran_eNB) { + rrc_mac_config_req_eNB( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) -0, + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t*) NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t*) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t*) NULL, + (RadioResourceConfigCommonSIB_t*) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, + ue_context_pP->ue_context.physicalConfigDedicated, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t*) NULL, - (MobilityControlInfo_t*) NULL, - (SchedulingInfoList_t*) NULL, - 0, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t*) NULL, + (MobilityControlInfo_t*) NULL, + (SchedulingInfoList_t*) NULL, + 0, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - + ); + } // Configure target eNB SRB2 /// SRB2 SRB2_config = CALLOC(1, sizeof(*SRB2_config)); @@ -5290,16 +5299,18 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( , (PMCH_InfoList_r9_t *) NULL #endif ,NULL); - - rrc_rlc_config_asn1_req(&ctxt, - ue_context_pP->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + rrc_rlc_config_asn1_req(&ctxt, + ue_context_pP->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL - , 0, 0 + , (PMCH_InfoList_r9_t *) NULL + , 0, 0 #endif - ); - + ); + } /* Initialize NAS list */ dedicatedInfoNASList = NULL; @@ -5360,41 +5371,42 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( //rrc_rlc_data_req(ctxt_pP->module_id,frameP, 1,(ue_mod_idP*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); //pdcp_data_req (ctxt_pP->module_id, frameP, 1, (ue_mod_idP * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1); - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, + if (rrc->node_type == ngran_eNB) { + rrc_mac_config_req_eNB( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, + ue_context_pP->ue_context.physicalConfigDedicated, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - (MobilityControlInfo_t *) mobilityInfo, - (SchedulingInfoList_t *) NULL, 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + (MobilityControlInfo_t *) mobilityInfo, + (SchedulingInfoList_t *) NULL, 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - + ); + } /* handoverCommand.criticalExtensions.present = HandoverCommand__criticalExtensions_PR_c1; handoverCommand.criticalExtensions.choice.c1.present = HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8; @@ -5518,19 +5530,22 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( , (PMCH_InfoList_r9_t *) NULL #endif ,NULL); - // Refresh SRBs/DRBs - rrc_rlc_config_asn1_req( - ctxt_pP, - SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, - DRB_configList, -// (DRB_ToReleaseList_t *) NULL - DRB_Release_configList2 + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + // Refresh SRBs/DRBs + rrc_rlc_config_asn1_req( + ctxt_pP, + SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, + // (DRB_ToReleaseList_t *) NULL + DRB_Release_configList2 #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL - , 0, 0 + , (PMCH_InfoList_r9_t *) NULL + , 0, 0 #endif - ); - + ); + } // set the SRB active in Ue context if (SRB_configList != NULL) { for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { @@ -5632,100 +5647,107 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; } - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, + if (rrc->node_type == ngran_eNB) { + rrc_mac_config_req_eNB( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, + ue_context_pP->ue_context.physicalConfigDedicated, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - DRB2LCHAN[i], - DRB_configList->list.array[i]->logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + DRB_configList->list.array[i]->logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - - } else { // remove LCHAN from MAC/PHY + ); + } + } else { // remove LCHAN from MAC/PHY if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { // DRB has just been removed so remove RLC + PDCP for DRB /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); */ - rrc_rlc_config_req( - ctxt_pP, - SRB_FLAG_NO, - MBMS_FLAG_NO, - CONFIG_ACTION_REMOVE, - DRB2LCHAN[i], - Rlc_info_um); + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + rrc_rlc_config_req( + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_NO, + CONFIG_ACTION_REMOVE, + DRB2LCHAN[i], + Rlc_info_um); + } } ue_context_pP->ue_context.DRB_active[drb_id] = 0; LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_mac_config_req_eNB(ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, + if (rrc->node_type == ngran_eNB) { + rrc_mac_config_req_eNB(ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, + ue_context_pP->ue_context.physicalConfigDedicated, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - DRB2LCHAN[i], - (LogicalChannelConfig_t *) NULL, - (MeasGapConfig_t *) NULL, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + (LogicalChannelConfig_t *) NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); + ); + } } } } - free(DRB_configList); + free(DRB_configList); ue_context_pP->ue_context.DRB_configList2[xid] = NULL; } @@ -5830,41 +5852,43 @@ rrc_eNB_generate_RRCConnectionSetup( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, + if (rrc->node_type == ngran_eNB) { + rrc_mac_config_req_eNB( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, + ue_context_pP->ue_context.physicalConfigDedicated, #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); + ); + } } } } @@ -6343,16 +6367,20 @@ rrc_eNB_decode_ccch( #endif ,NULL); - - rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL, - 0,0 + , (PMCH_InfoList_r9_t *) NULL, + 0,0 # endif - ); + ); + } + #endif //NO_RRM } break; @@ -6415,7 +6443,16 @@ rrc_eNB_decode_ccch( random_value = (((uint64_t)mme_code) << 32) | m_tmsi; if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); - rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); + + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); + } + else { + // send message to DU to remove context + AssertFatal(1==0,"Need to added context removal\n"); + } stmsi_received=1; /* replace rnti in the context */ /* for that, remove the context from the RB tree */ -- GitLab From 1e5f95cd95f7697ea6591a19450644b5c7ce1786 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 21 Sep 2018 17:23:08 +0200 Subject: [PATCH 115/308] fixes for monolithic case. Still doesn't work to RRCConnectionSetup, context allocation problem. --- openair2/ENB_APP/enb_config.c | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 102 ++++++++++++++++-- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 3 +- openair2/RRC/LTE/L2_interface.c | 26 ++++- openair2/RRC/LTE/rrc_eNB.c | 28 ++--- .../PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf | 12 +-- .../CONF/du.lte.band7.10MHz.if4p5.conf | 22 ++-- 7 files changed, 151 insertions(+), 44 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index c9e67a7ece..9c12d4b1d1 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -822,7 +822,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = nb_antenna_ports; } - else {//this is CU, SIB2-20 in CU + if (rrc->node_type != ngran_eNB_DU) {//this is CU or eNB, SIB2-20 in CU #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (!pbch_repetition) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 12d599bc39..6d9099d6bc 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -314,6 +314,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, "Unknown message\n"); break; }// switch case + return(0); } else if (srb_id == 1) { // rrc_rlc_config_asn1_req(&ctxt, // SRB_configList, @@ -325,13 +326,96 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // # endif // ); - LOG_I(DU_F1AP, "Received DL RRC Transfer on srb_id 1\n"); - rlc_op_status_t rlc_status; - boolean_t ret = TRUE; - mem_block_t *pdcp_pdu_p = NULL; - pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); - memset(&pdcp_pdu_p->data[0], 0, rrc_dl_sdu_len); - memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); + DL_DCCH_Message_t* dl_dcch_msg=NULL; + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_DL_DCCH_Message, + (void**)&dl_dcch_msg, + ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len,0,0); + + if (dl_dcch_msg->message.present == DL_DCCH_MessageType_PR_c1) { + + switch (dl_dcch_msg->message.choice.c1.present) { + + case DL_DCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, "Received PR_NOTHING on DL-DCCH-Message\n"); + return; + + case DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: + case DL_DCCH_MessageType__c1_PR_dlInformationTransfer: + case DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: + case DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: + break; + case DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: + // handle RRCConnectionReconfiguration + LOG_I(RRC, + "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %x/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); + + RRCConnectionReconfiguration_t* rrcConnectionReconfiguration = &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration; + + if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) { + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == + RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { + RRCConnectionReconfiguration_r8_IEs_t* rrcConnectionReconfiguration_r8 = + &rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8; + + if (rrcConnectionReconfiguration_r8->mobilityControlInfo) { + LOG_I(RRC,"Mobility Control Information is present\n"); + AssertFatal(1==0,"Can't handle this yet in DU\n"); + } + if (rrcConnectionReconfiguration_r8->measConfig != NULL) { + LOG_I(RRC,"Measurement Configuration is present\n"); + + } + + if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated) { + LOG_I(RRC,"Radio Resource Configuration is present\n"); + RadioResourceConfigDedicated_t* radioResourceConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated; + long SRB_id,DRB_id; + int i,cnt; + LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig; + + // radioResourceConfigDedicated->physicalConfigDedicated; + + } + break; + case DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: + // handle RRCConnectionRelease + break; + case DL_DCCH_MessageType__c1_PR_securityModeCommand: + case DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + case DL_DCCH_MessageType__c1_PR_counterCheck: +#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + case DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: + case DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: +#endif + case DL_DCCH_MessageType__c1_PR_spare1: + case DL_DCCH_MessageType__c1_PR_spare2: + case DL_DCCH_MessageType__c1_PR_spare3: +#if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) + case DL_DCCH_MessageType__c1_PR_spare4: +#endif + break; + } + + } + } + } + } + else if (srb_id == 2) { + + } + + LOG_I(DU_F1AP, "Received DL RRC Transfer on srb_id %d\n",srb_id); + rlc_op_status_t rlc_status; + boolean_t ret = TRUE; + mem_block_t *pdcp_pdu_p = NULL; + pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); + memset(&pdcp_pdu_p->data[0], 0, rrc_dl_sdu_len); + memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); if (pdcp_pdu_p != NULL) { rlc_status = rlc_data_req(&ctxt @@ -376,9 +460,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return ret; } // if pdcp_pdu_p - } else if (srb_id == 2) { - } #endif return 0; @@ -567,7 +649,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, return 0; } - + void init_f1ap_du_ue_inst (void) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 44194255c6..394ba25814 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -59,11 +59,12 @@ int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) { int channel_id; +/* DevAssert(p->local_ipv4_address); DevAssert(p->local_port > 1024); // "unprivileged" port DevAssert(p->remote_ipv4_address); DevAssert(p->remote_port > 1024); // "unprivileged" port - + */ proto_agent[mod_id].mod_id = mod_id; /* Initialize the channel container */ diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 6b66349116..ecf60dc32d 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -150,7 +150,7 @@ mac_rrc_data_req( LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d, rnti %x)\n",Mod_idP,frameP, Srb_id,rnti); if(ue_p->Srb0.Active==0) { - LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP); + LOG_E(RRC,"[eNB %d] CCCH Not active (%p, rnti %x)\n",Mod_idP,ue_p,ue_p->rnti); return(0); } @@ -304,7 +304,29 @@ mac_rrc_data_ind( PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0); if((srb_idP & RAB_OFFSET) == CCCH) { - LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB 0\n",module_idP); + LOG_I(RRC,"[eNB %d] Received SDU for CCCH on SRB 0 (%d,%x)\n",module_idP, + ctxt.module_id,ctxt.rnti); + + + // create a ue_context with rnti as random value, will be updated when Attach Request is received + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_next_free_ue_context(&ctxt, + rntiP + ); + + eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + SRB_INFO *srb_info_p = &ue_p->Srb0; + + LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ue_context %p (rnti %x), sib_info_p->Rx_buffer.payload_size %d\n", + module_idP,CC_id,ue_p, ue_p->rnti,sdu_lenP); + AssertFatal(sdu_lenP <= RRC_BUFFER_SIZE_MAX, + "CCCH message has size %d > %d\n",sdu_lenP,RRC_BUFFER_SIZE_MAX); + + + memcpy(srb_info_p->Rx_buffer.Payload, + sduP, + sdu_lenP); + srb_info_p->Rx_buffer.payload_size = sdu_lenP; + srb_info_p->Active = 1; // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); if (sdu_lenP > 0) rrc_eNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index e99f8e64b9..199546f525 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -204,7 +204,7 @@ init_SI( AssertFatal(carrier->sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); } - else if (rrc->node_type != ngran_eNB_DU) { + if (rrc->node_type != ngran_eNB_DU) { carrier->SIB23 = (uint8_t*) malloc16(64); AssertFatal(carrier->SIB23!=NULL,"cannot allocate memory for SIB"); @@ -625,9 +625,9 @@ static void init_MBMS( #endif ,NULL); - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + if ( (RC.rrc[enb_mod_idP]->node_type != ngran_eNB_CU) || + (RC.rrc[enb_mod_idP]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[enb_mod_idP]->node_type != ngran_gNB_CU) ) { rrc_rlc_config_asn1_req(&ctxt, NULL, // SRB_ToAddModList NULL, // DRB_ToAddModList @@ -737,7 +737,7 @@ rrc_eNB_ue_context_stmsi_exist( //----------------------------------------------------------------------------- // return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection -static struct rrc_eNB_ue_context_s* +struct rrc_eNB_ue_context_s* rrc_eNB_get_next_free_ue_context( const protocol_ctxt_t* const ctxt_pP, const uint64_t ue_identityP @@ -775,6 +775,7 @@ rrc_eNB_get_next_free_ue_context( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); return NULL; } + return(ue_context_p); } //----------------------------------------------------------------------------- @@ -1338,7 +1339,7 @@ rrc_eNB_generate_RRCConnectionReestablishment( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - if (rrc->node_type == ngran_eNB) { + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { rrc_mac_config_req_eNB(ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, 0,0,0,0,0, @@ -4782,7 +4783,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( LOG_D(RRC, "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id); - if (rrc->node_type == ngran_eNB) { + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { rrc_mac_config_req_eNB( ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, @@ -5373,7 +5374,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( //rrc_rlc_data_req(ctxt_pP->module_id,frameP, 1,(ue_mod_idP*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); //pdcp_data_req (ctxt_pP->module_id, frameP, 1, (ue_mod_idP * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1); - if (rrc->node_type == ngran_eNB) { + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { rrc_mac_config_req_eNB( ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, @@ -5649,7 +5650,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; } - if (rrc->node_type == ngran_eNB) { + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { rrc_mac_config_req_eNB( ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, @@ -5710,7 +5711,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - if (rrc->node_type == ngran_eNB) { + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { rrc_mac_config_req_eNB(ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, 0,0,0,0,0, @@ -5854,7 +5855,7 @@ rrc_eNB_generate_RRCConnectionSetup( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - if (rrc->node_type == ngran_eNB) { + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { rrc_mac_config_req_eNB( ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, @@ -7558,8 +7559,8 @@ rrc_enb_task( eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; srb_info_p = &ue_p->Srb0; - LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - rrc_inst,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ue_context %p (rnti %x), sib_info_p->Rx_buffer.payload_size %d\n", + rrc_inst,CC_id,ue_p, ue_p->rnti,RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) { LOG_I(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); break; @@ -7568,6 +7569,7 @@ rrc_enb_task( RRC_MAC_CCCH_DATA_IND(msg_p).sdu, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; + srb_info_p->Active = 1; rrc_eNB_decode_ccch(&ctxt, srb_info_p->Rx_buffer.Payload,srb_info_p->Rx_buffer.payload_size, CC_id); break; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf index 8d42fcb761..035add8b31 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf @@ -24,12 +24,12 @@ eNBs = tr_s_preference = "f1" local_s_if_name = "lo"; - remote_s_address = "127.0.0.1"; - local_s_address = "127.0.0.2"; - local_s_portc = 60001; - remote_s_portc = 60000; - local_s_portd = 60011; - remote_s_portd = 60010; + remote_s_address = "127.0.0.3"; + local_s_address = "127.0.0.4"; + local_s_portc = 501; + remote_s_portc = 500; + local_s_portd = 601; + remote_s_portd = 600; ////////// Physical parameters: diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf index 32d9436f12..1956259fdc 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf @@ -13,9 +13,9 @@ eNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = "1"; - mobile_country_code = "001"; + mobile_country_code = "208"; - mobile_network_code = "01"; + mobile_network_code = "93"; nr_cellid = 12345678L @@ -60,13 +60,13 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "f1"; - local_n_if_name = "vlan203"; - remote_n_address = "192.168.203.16"; - local_n_address = "192.168.203.242"; - local_n_portc = 60000; - remote_n_portc = 60001; - local_n_portd = 60010; - remote_n_portd = 60011; + local_n_if_name = "lo"; + remote_n_address = "127.0.0.4"; + local_n_address = "127.0.0.3"; + local_n_portc = 500; + remote_n_portc = 501; + local_n_portd = 600; + remote_n_portd = 601; } ); @@ -80,8 +80,8 @@ L1s = ( RUs = ( { local_if_name = "enp4s0f1"; - local_address = "192.168.41.3"; - remote_address = "192.168.41.1"; + local_address = "127.0.0.1"; + remote_address = "127.0.0.2"; local_portc = 50000; remote_portc = 50000; local_portd = 50001; -- GitLab From 360e2e77a9f5782ed5c4155f36ef10a7f815599a Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 21 Sep 2018 18:07:47 +0200 Subject: [PATCH 116/308] monolithic ok (RRCConnectionSetupComplete) --- openair2/RRC/LTE/L2_interface.c | 6 +++--- openair2/RRC/LTE/rrc_eNB.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index ecf60dc32d..dafc24d9df 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -307,7 +307,7 @@ mac_rrc_data_ind( LOG_I(RRC,"[eNB %d] Received SDU for CCCH on SRB 0 (%d,%x)\n",module_idP, ctxt.module_id,ctxt.rnti); - + /* // create a ue_context with rnti as random value, will be updated when Attach Request is received struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_next_free_ue_context(&ctxt, rntiP @@ -327,8 +327,8 @@ mac_rrc_data_ind( sdu_lenP); srb_info_p->Rx_buffer.payload_size = sdu_lenP; srb_info_p->Active = 1; - - // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); + */ + if (sdu_lenP > 0) rrc_eNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id); } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 199546f525..811e2ce40f 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6438,6 +6438,7 @@ rrc_eNB_decode_ccch( ue_context_p->ue_context.ul_failure_timer = 20000; } ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); + ue_context_p->ue_context.Srb0.Active=1; } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { /* Save s-TMSI */ S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; -- GitLab From a1b60957a1496651fcc0cdb76e0a0ba637457f90 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 21 Sep 2018 21:19:27 +0200 Subject: [PATCH 117/308] reworking logic for selection of configuration parameters as a function of node (CU/DU/eNB) --- openair2/ENB_APP/enb_config.c | 20 +++++++++----------- openair2/ENB_APP/enb_config.h | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 9c12d4b1d1..334299b3c2 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -416,7 +416,7 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) { } -int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { +int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { int num_enbs = 0; @@ -637,10 +637,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { LOG_I(RRC,"Instance %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr)); - if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { - rrc->node_type = ngran_eNB; - } - else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) { + if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) { paramdef_t SCTPParams[] = SCTPPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; @@ -675,9 +672,11 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { } - else { // no F1 - // set to ngran_eNB for now, it will get set to ngran_DU if macrlc entity which uses F1 is present - rrc->node_type = ngran_eNB; + else { + // set to ngran_eNB for now, it will get set to ngran_eNB_DU if macrlc entity which uses F1 is present + // Note: we will have to handle the case of ngran_ng_eNB_DU + if (macrlc_has_f1 == 0) rrc->node_type = ngran_eNB; + else rrc->node_type = ngran_eNB_DU; } // MCC and MNC @@ -1825,7 +1824,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[j] = discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused; - } + } // node_type!=ngran_eNB_DU } if (rrc->node_type == ngran_eNB_CU || rrc->node_type == ngran_ng_eNB_CU) { char srb1path[MAX_OPTNAME_SIZE*2 + 8]; @@ -3010,8 +3009,7 @@ void read_config_and_init() RC.rrc[enb_id] = malloc(sizeof(eNB_RRC_INST)); AssertFatal(RC.rrc[enb_id], "RRC context for eNB %d not allocated\n", enb_id); memset((void *)RC.rrc[enb_id], 0, sizeof(eNB_RRC_INST)); - RCconfig_RRC(enb_id, RC.rrc[enb_id]); - if (macrlc_has_f1[enb_id]) RC.rrc[enb_id]->node_type = ngran_eNB_DU; + RCconfig_RRC(enb_id, RC.rrc[enb_id],macrlc_has_f1[enb_id]); } if (RC.nb_macrlc_inst == 0) diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index f0f964feb0..eead6e54e5 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -115,7 +115,7 @@ extern void RCConfig(void); void enb_config_display(void); void ru_config_display(void); -int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc); +int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1); int RCconfig_S1(MessageDef *msg_p, uint32_t i); void read_config_and_init(void); -- GitLab From 1181790b866d0a54faf0e550cf1f0222ec3a2b19 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 21 Sep 2018 22:03:27 +0200 Subject: [PATCH 118/308] Partially update the node_type check --- openair2/ENB_APP/enb_config.c | 6 ++++-- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 13 +++++++------ openair2/RRC/LTE/rrc_eNB.c | 11 ++++++++--- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 334299b3c2..16fa62404c 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -743,7 +743,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { nb_cc++; - if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU) { + if ( (rrc->node_type != ngran_eNB_CU) || (rrc->node_type != ngran_ng_eNB_CU) || (rrc->node_type != ngran_gNB_CU) ) { // Cell params, MIB/SIB1 in DU RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config; @@ -1826,7 +1826,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { } // node_type!=ngran_eNB_DU } - if (rrc->node_type == ngran_eNB_CU || rrc->node_type == ngran_ng_eNB_CU) { + if ( (rrc->node_type == ngran_eNB_CU) || (rrc->node_type == ngran_ng_eNB_CU) || (rrc->node_type == ngran_gNB_CU) ) { char srb1path[MAX_OPTNAME_SIZE*2 + 8]; sprintf(srb1path,"%s.%s",enbpath,ENB_CONFIG_STRING_SRB1); int npar = config_get( SRB1Params,sizeof(SRB1Params)/sizeof(paramdef_t), srb1path); @@ -2178,6 +2178,8 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { #endif } + LOG_I(RRC,"Node type %d \n ", rrc->node_type); + return 0; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 394ba25814..de8af0fb33 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -59,12 +59,13 @@ int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) { int channel_id; -/* - DevAssert(p->local_ipv4_address); - DevAssert(p->local_port > 1024); // "unprivileged" port - DevAssert(p->remote_ipv4_address); - DevAssert(p->remote_port > 1024); // "unprivileged" port - */ + // RS: CUDU does not work! + //DevAssert(p->local_interface); + //DevAssert(p->local_ipv4_address); + //DevAssert(p->local_port > 1024); // "unprivileged" port + //DevAssert(p->remote_ipv4_address); + //DevAssert(p->remote_port > 1024); // "unprivileged" port + proto_agent[mod_id].mod_id = mod_id; /* Initialize the channel container */ diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 811e2ce40f..cacb8dee6a 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -168,7 +168,10 @@ init_SI( AssertFatal(carrier->SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU) { + LOG_I(RRC,"[eNB %d] Node type %d \n ", ctxt_pP->module_id, rrc->node_type); + if ((rrc->node_type != ngran_eNB_CU) || + (rrc->node_type != ngran_ng_eNB_CU) || + (rrc->node_type != ngran_gNB_CU) ) { // copy basic Cell parameters carrier->physCellId = configuration->Nid_cell[CC_id]; carrier->p_eNB = configuration->nb_antenna_ports[CC_id]; @@ -204,8 +207,8 @@ init_SI( AssertFatal(carrier->sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); } - if (rrc->node_type != ngran_eNB_DU) { - + if ((rrc->node_type != ngran_eNB_DU) || + (rrc->node_type != ngran_gNB_DU)) { carrier->SIB23 = (uint8_t*) malloc16(64); AssertFatal(carrier->SIB23!=NULL,"cannot allocate memory for SIB"); carrier->sizeof_SIB23 = do_SIB23( @@ -217,6 +220,8 @@ init_SI( #endif ); + LOG_I(RRC,"do_SIB23, size %d \n ", carrier->sizeof_SIB23); + AssertFatal(carrier->sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); -- GitLab From 5de7f61fd5f39711027ffb99859ad5c6f71e9524 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 21 Sep 2018 16:38:06 -0400 Subject: [PATCH 119/308] monolithic is functional with EPC and COTS UE (full connection) --- openair2/ENB_APP/enb_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 334299b3c2..ea447f72d7 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -3012,6 +3012,6 @@ void read_config_and_init() RCconfig_RRC(enb_id, RC.rrc[enb_id],macrlc_has_f1[enb_id]); } - if (RC.nb_macrlc_inst == 0) + if (RC.rrc[0]->node_type != ngran_eNB_DU) pdcp_layer_init(); } -- GitLab From ac1496c2124445aab3289017722290f21edb5715 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sat, 22 Sep 2018 04:26:05 -0400 Subject: [PATCH 120/308] conditions for rlc_config_asn in CU --- openair2/RRC/LTE/rrc_eNB.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index cacb8dee6a..a6e3ebf781 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -630,9 +630,8 @@ static void init_MBMS( #endif ,NULL); - if ( (RC.rrc[enb_mod_idP]->node_type != ngran_eNB_CU) || - (RC.rrc[enb_mod_idP]->node_type != ngran_ng_eNB_CU) || - (RC.rrc[enb_mod_idP]->node_type != ngran_gNB_CU) ) { + if ((RC.rrc[enb_mod_idP]->node_type != ngran_eNB_CU) && + (RC.rrc[enb_mod_idP]->node_type != ngran_ng_eNB_CU)) { rrc_rlc_config_asn1_req(&ctxt, NULL, // SRB_ToAddModList NULL, // DRB_ToAddModList @@ -5307,8 +5306,8 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( , (PMCH_InfoList_r9_t *) NULL #endif ,NULL); - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { rrc_rlc_config_asn1_req(&ctxt, ue_context_pP->ue_context.SRB_configList, @@ -5538,8 +5537,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( , (PMCH_InfoList_r9_t *) NULL #endif ,NULL); - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { // Refresh SRBs/DRBs rrc_rlc_config_asn1_req( @@ -6375,8 +6374,8 @@ rrc_eNB_decode_ccch( #endif ,NULL); - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { rrc_rlc_config_asn1_req(ctxt_pP, ue_context_p->ue_context.SRB_configList, @@ -6619,8 +6618,8 @@ rrc_eNB_decode_ccch( #endif ,NULL); - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { rrc_rlc_config_asn1_req(ctxt_pP, -- GitLab From 45eda99583c5b462082271f4d7866ae8e53ba353 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sat, 22 Sep 2018 04:28:29 -0400 Subject: [PATCH 121/308] conditions for configuration in DU --- openair2/ENB_APP/enb_config.c | 10 ++++++++-- openair2/RRC/LTE/rrc_eNB.c | 10 +++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 57d4c67d55..a843ec6033 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -675,8 +675,14 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { else { // set to ngran_eNB for now, it will get set to ngran_eNB_DU if macrlc entity which uses F1 is present // Note: we will have to handle the case of ngran_ng_eNB_DU - if (macrlc_has_f1 == 0) rrc->node_type = ngran_eNB; - else rrc->node_type = ngran_eNB_DU; + if (macrlc_has_f1 == 0) { + rrc->node_type = ngran_eNB; + LOG_I(RRC,"Setting node_type to ngran_eNB\n"); + } + else { + rrc->node_type = ngran_eNB_DU; + LOG_I(RRC,"Setting node_type to ngran_eNB_DU\n"); + } } // MCC and MNC diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index cacb8dee6a..b84cb20f39 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -169,9 +169,8 @@ init_SI( PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); LOG_I(RRC,"[eNB %d] Node type %d \n ", ctxt_pP->module_id, rrc->node_type); - if ((rrc->node_type != ngran_eNB_CU) || - (rrc->node_type != ngran_ng_eNB_CU) || - (rrc->node_type != ngran_gNB_CU) ) { + if ((rrc->node_type == ngran_eNB_DU) || + (rrc->node_type == ngran_eNB) ) { // copy basic Cell parameters carrier->physCellId = configuration->Nid_cell[CC_id]; carrier->p_eNB = configuration->nb_antenna_ports[CC_id]; @@ -207,8 +206,9 @@ init_SI( AssertFatal(carrier->sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); } - if ((rrc->node_type != ngran_eNB_DU) || - (rrc->node_type != ngran_gNB_DU)) { + if ((rrc->node_type == ngran_eNB_CU) || + (rrc->node_type == ngran_ng_eNB_CU) || + (rrc->node_type == ngran_eNB)) { carrier->SIB23 = (uint8_t*) malloc16(64); AssertFatal(carrier->SIB23!=NULL,"cannot allocate memory for SIB"); carrier->sizeof_SIB23 = do_SIB23( -- GitLab From f6c28fad627b38b8ff4bc3235bf7ec08119bb541 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sat, 22 Sep 2018 04:55:57 -0400 Subject: [PATCH 122/308] extra log in F1AP receiver for DL_RRC_MESSAGE_TRANSFER to identify RRC message type --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 6d9099d6bc..16793dedf9 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -341,9 +341,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, case DL_DCCH_MessageType__c1_PR_NOTHING: LOG_I(RRC, "Received PR_NOTHING on DL-DCCH-Message\n"); return; - - case DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: + break; case DL_DCCH_MessageType__c1_PR_dlInformationTransfer: + LOG_I(RRC,"Received DL Information Transfer\n"); + break; + case DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: case DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: case DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: break; -- GitLab From ba609ca94faff88243b506e14c64469cbf61aa68 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Sat, 22 Sep 2018 16:01:31 +0200 Subject: [PATCH 123/308] Set the RRC status in DU, Reconfigure SRB2, Manage RRC/NAS UL message in DU --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 348 +++++++++++++++---- openair2/RRC/LTE/rrc_eNB.c | 11 +- 2 files changed, 283 insertions(+), 76 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 16793dedf9..7aa28c0ce6 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -40,6 +40,7 @@ #include "DL-CCCH-Message.h" #include "DL-DCCH-Message.h" +#include "UL-DCCH-Message.h" // for SRB1_logicalChannelConfig_defaultValue #include "rrc_extern.h" @@ -181,6 +182,10 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ctxt.instance = instance; ctxt.enb_flag = 1; + struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt.module_id], + ctxt.rnti); + if (srb_id == 0) { DL_CCCH_Message_t* dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; @@ -219,7 +224,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // Get configuration RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; - // eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); RadioResourceConfigDedicated_t* radioResourceConfigDedicated = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated; @@ -257,28 +261,28 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ); // This should be somewhere in the f1ap_cudu_ue_inst_t - int macrlc_instance = 0; + /*int macrlc_instance = 0; rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id); struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); - + */ eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, (void*)ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len); + rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; rrc_mac_config_req_eNB( - macrlc_instance, + ctxt.module_id, 0, //primaryCC_id, 0,0,0,0,0, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) 0, #endif - rnti, + ctxt.rnti, (BCCH_BCH_Message_t *) NULL, (RadioResourceConfigCommonSIB_t *) NULL, #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) @@ -316,96 +320,189 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, }// switch case return(0); } else if (srb_id == 1) { -// rrc_rlc_config_asn1_req(&ctxt, -// SRB_configList, -// (DRB_ToAddModList_t*) NULL, -// (DRB_ToReleaseList_t*) NULL -// #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -// , (PMCH_InfoList_r9_t *) NULL, -// 0,0 -// # endif -// ); DL_DCCH_Message_t* dl_dcch_msg=NULL; asn_dec_rval_t dec_rval; dec_rval = uper_decode(NULL, &asn_DEF_DL_DCCH_Message, (void**)&dl_dcch_msg, - ie->value.choice.RRCContainer.buf, + &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header rrc_dl_sdu_len,0,0); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + LOG_E(DU_F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed); + else + LOG_D(DU_F1AP, "Received message: present %d and c1 present %d\n", + dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1.present); if (dl_dcch_msg->message.present == DL_DCCH_MessageType_PR_c1) { switch (dl_dcch_msg->message.choice.c1.present) { case DL_DCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, "Received PR_NOTHING on DL-DCCH-Message\n"); + LOG_I(DU_F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); return; - break; case DL_DCCH_MessageType__c1_PR_dlInformationTransfer: - LOG_I(RRC,"Received DL Information Transfer\n"); + LOG_I(DU_F1AP,"Received NAS DL Information Transfer\n"); break; case DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: + LOG_I(DU_F1AP,"Received NAS sfbParametersResponseCDMA2000\n"); + break; case DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: + LOG_I(DU_F1AP,"Received NAS andoverFromEUTRAPreparationRequest\n"); + break; case DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: + LOG_I(DU_F1AP,"Received NAS mobilityFromEUTRACommand\n"); break; case DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: - // handle RRCConnectionReconfiguration - LOG_I(RRC, - "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %x/RNTI %x\n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); + // handle RRCConnectionReconfiguration + LOG_I(DU_F1AP, + "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %x/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); RRCConnectionReconfiguration_t* rrcConnectionReconfiguration = &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration; - - if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) { - if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == - RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { - RRCConnectionReconfiguration_r8_IEs_t* rrcConnectionReconfiguration_r8 = - &rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8; + + if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) { + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == + RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { + RRCConnectionReconfiguration_r8_IEs_t* rrcConnectionReconfiguration_r8 = + &rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8; - if (rrcConnectionReconfiguration_r8->mobilityControlInfo) { - LOG_I(RRC,"Mobility Control Information is present\n"); - AssertFatal(1==0,"Can't handle this yet in DU\n"); - } - if (rrcConnectionReconfiguration_r8->measConfig != NULL) { - LOG_I(RRC,"Measurement Configuration is present\n"); - - } + if (rrcConnectionReconfiguration_r8->mobilityControlInfo) { + LOG_I(DU_F1AP,"Mobility Control Information is present\n"); + AssertFatal(1==0,"Can't handle this yet in DU\n"); + } + if (rrcConnectionReconfiguration_r8->measConfig != NULL) { + LOG_I(DU_F1AP,"Measurement Configuration is present\n"); + } - if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated) { - LOG_I(RRC,"Radio Resource Configuration is present\n"); - RadioResourceConfigDedicated_t* radioResourceConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated; - long SRB_id,DRB_id; - int i,cnt; - LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig; - - // radioResourceConfigDedicated->physicalConfigDedicated; - - } - break; - case DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: - // handle RRCConnectionRelease - break; - case DL_DCCH_MessageType__c1_PR_securityModeCommand: - case DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - case DL_DCCH_MessageType__c1_PR_counterCheck: -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - case DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: - case DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: -#endif - case DL_DCCH_MessageType__c1_PR_spare1: - case DL_DCCH_MessageType__c1_PR_spare2: - case DL_DCCH_MessageType__c1_PR_spare3: -#if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) - case DL_DCCH_MessageType__c1_PR_spare4: -#endif + if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated) { + LOG_I(DU_F1AP,"Radio Resource Configuration is present\n"); + RadioResourceConfigDedicated_t* radioResourceConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated; + uint8_t DRB2LCHAN[8]; + long SRB_id,drb_id; + int i,cnt; + LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig; + DRB_ToAddModList_t* DRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToAddModList; + SRB_ToAddModList_t* SRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->srb_ToAddModList; + DRB_ToReleaseList_t* DRB_ReleaseList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToReleaseList; + MAC_MainConfig_t *mac_MainConfig = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig; + MeasGapConfig_t *measGapConfig = NULL; + struct PhysicalConfigDedicated** physicalConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->physicalConfigDedicated; + rrc_rlc_config_asn1_req( + &ctxt, + SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, + DRB_ReleaseList + #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (PMCH_InfoList_r9_t *) NULL + , 0, 0 + #endif + ); + + if (SRB_configList != NULL) { + for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { + if (SRB_configList->list.array[i]->srb_Identity == 1 ){ + ue_context_p->ue_context.Srb1.Active=1; + } + else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { + ue_context_p->ue_context.Srb2.Active=1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; + LOG_I(RRC,"[DU %d] SRB2 is now active\n",ctxt.module_id); + } else { + LOG_W(RRC,"[DU %d] invalide SRB identity %ld\n",ctxt.module_id, + SRB_configList->list.array[i]->srb_Identity); + } + } + } + + if (DRB_configList != NULL) { + for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) + if (DRB_configList->list.array[i]) { + drb_id = (int)DRB_configList->list.array[i]->drb_Identity; + LOG_I(RRC, + "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", + ctxt.module_id, + ctxt.rnti, + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + + if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { + ue_context_p->ue_context.DRB_active[drb_id] = 1; + + if (DRB_configList->list.array[i]->logicalChannelIdentity) { + DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; + } + + rrc_mac_config_req_eNB( + ctxt.module_id, + 0,0,0,0,0,0, + #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, + #endif + ue_context_p->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, + #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (RadioResourceConfigCommonSIB_t *) NULL, + #endif + physicalConfigDedicated, + #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + #endif + (MeasObjectToAddMod_t **) NULL, + mac_MainConfig, + DRB2LCHAN[i], + DRB_configList->list.array[i]->logicalChannelConfig, + measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + #if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + #endif + #if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL + #endif + ); + } + + } else { // remove LCHAN from MAC/PHY + AssertFatal(1==0,"Can't handle this yet in DU\n"); + } + } + } + } + } + } break; - } - - } - } - } + case DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: + // handle RRCConnectionRelease + break; + case DL_DCCH_MessageType__c1_PR_securityModeCommand: + LOG_I(DU_F1AP,"Received securityModeCommand\n"); + break; + case DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + LOG_I(DU_F1AP,"Received sueCapabilityEnquiry\n"); + break; + case DL_DCCH_MessageType__c1_PR_counterCheck: + #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + case DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: + case DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: + #endif + case DL_DCCH_MessageType__c1_PR_spare1: + case DL_DCCH_MessageType__c1_PR_spare2: + case DL_DCCH_MessageType__c1_PR_spare3: + #if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) + case DL_DCCH_MessageType__c1_PR_spare4: + #endif + break; + } + } } else if (srb_id == 2) { @@ -416,8 +513,17 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, boolean_t ret = TRUE; mem_block_t *pdcp_pdu_p = NULL; pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); - memset(&pdcp_pdu_p->data[0], 0, rrc_dl_sdu_len); + memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); +#ifdef DEBUG_MSG + printf ("PRRCContainer size %d:", ie->value.choice.RRCContainer.size); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",ie->value.choice.RRCContainer.buf[i]); + printf("\n"); + + printf ("PDCP PDU size %d:", rrc_dl_sdu_len); + for (int i=0;i<rrc_dl_sdu_len;i++) printf("%2x ",pdcp_pdu_p->data[i]); + printf("\n"); +#endif if (pdcp_pdu_p != NULL) { rlc_status = rlc_data_req(&ctxt @@ -462,7 +568,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return ret; } // if pdcp_pdu_p - #endif return 0; @@ -484,6 +589,14 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, uint8_t *buffer; uint32_t len; + + LOG_I(RRC,"[DU %d] Received UL_RRC_MESSAGE_TRANSFER : size %d UE RNTI %x in SRB %d\n", + ctxt_pP->module_id, sdu_sizeP, rnti, rb_idP); + + struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + rnti); + /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -535,6 +648,97 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sdu_pP, sdu_sizeP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + if (rb_idP == 1 || rb_idP == 2) { + struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + rnti); + + + UL_DCCH_Message_t* ul_dcch_msg=NULL; + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_UL_DCCH_Message, + (void**)&ul_dcch_msg, + &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header + sdu_sizeP,0,0); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + LOG_E(DU_F1AP," Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); + else + LOG_D(RRC, "Received message: present %d and c1 present %d\n", + ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1.present); + + if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) { + + switch (ul_dcch_msg->message.choice.c1.present) { + case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ + break; + + case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: + break; + + case UL_DCCH_MessageType__c1_PR_measurementReport: + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: + LOG_I(RRC,"[MSG] RRC UL rrcConnectionSetupComplete \n"); + if(!ue_context_p){ + LOG_E(DU_F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", ctxt_pP->rnti); + }else { + LOG_I(DU_F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti); + ue_context_p->ue_context.Status = RRC_CONNECTED; + } + + break; + case UL_DCCH_MessageType__c1_PR_securityModeComplete: + LOG_I(RRC,"[MSG] RRC securityModeComplete \n"); + break; + + case UL_DCCH_MessageType__c1_PR_securityModeFailure: + break; + + case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + LOG_I(RRC,"[MSG] RRC ueCapabilityInformation \n"); + break; + + case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: + break; + + case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + LOG_I(RRC,"[MSG] RRC UL Information Transfer \n"); + break; + + case UL_DCCH_MessageType__c1_PR_counterCheckResponse: + break; + +#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + + case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: + break; + case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: + break; +#endif + +#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: + break; + + case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: + break; + + case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: + break; +#endif + + } + } + } /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 0863e0f103..a482ba01f4 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -206,9 +206,11 @@ init_SI( AssertFatal(carrier->sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); } - if ((rrc->node_type == ngran_eNB_CU) || + if (rrc->node_type != ngran_eNB_DU) { + + /*if ((rrc->node_type == ngran_eNB_CU) || (rrc->node_type == ngran_ng_eNB_CU) || - (rrc->node_type == ngran_eNB)) { + (rrc->node_type == ngran_eNB)) { */ carrier->SIB23 = (uint8_t*) malloc16(64); AssertFatal(carrier->SIB23!=NULL,"cannot allocate memory for SIB"); carrier->sizeof_SIB23 = do_SIB23( @@ -630,8 +632,9 @@ static void init_MBMS( #endif ,NULL); - if ((RC.rrc[enb_mod_idP]->node_type != ngran_eNB_CU) && - (RC.rrc[enb_mod_idP]->node_type != ngran_ng_eNB_CU)) { + if ( (RC.rrc[enb_mod_idP]->node_type != ngran_eNB_CU) || + (RC.rrc[enb_mod_idP]->node_type != ngran_ng_eNB_CU) || + (RC.rrc[enb_mod_idP]->node_type != ngran_gNB_CU) ) { rrc_rlc_config_asn1_req(&ctxt, NULL, // SRB_ToAddModList NULL, // DRB_ToAddModList -- GitLab From 57755e27737cfe9a12a10adee27e50fb1fa1381c Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Sat, 22 Sep 2018 16:44:45 +0200 Subject: [PATCH 124/308] Check node type for the MAC API calls (find_UE) --- openair2/RRC/LTE/rrc_eNB.c | 143 ++++++++++++++++++++++--------------- 1 file changed, 84 insertions(+), 59 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index a482ba01f4..ff78051aaf 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -646,7 +646,7 @@ static void init_MBMS( #endif ); } - //rrc_mac_config_req(); + //rrc_mac_config_req(); } } #endif @@ -1399,18 +1399,21 @@ rrc_eNB_generate_RRCConnectionReestablishment( PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishment (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ue_p->Srb0.Tx_buffer.payload_size); - - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - if(UE_id != -1){ - // activate release timer, if RRCComplete not received after 100 frames, remove UE - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; - // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000; - }else{ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Generating RRCConnectionReestablishment without UE_id(MAC) rnti %x\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); - } + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + if(UE_id != -1){ + // activate release timer, if RRCComplete not received after 100 frames, remove UE + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; + // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000; + }else{ + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Generating RRCConnectionReestablishment without UE_id(MAC) rnti %x\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + } + } // activate release timer, if RRCComplete not received after 100 frames, remove UE ue_context_pP->ue_context.ue_reestablishment_timer = 1; // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered @@ -2055,6 +2058,9 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( ) //----------------------------------------------------------------------------- { + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); if(UE_id != -1){ RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; @@ -2064,7 +2070,7 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( PROTOCOL_RRC_CTXT_UE_FMT" Generating RRCConnectionReestablishmentReject without UE_id(MAC) rnti %x\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); } - + } T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); @@ -6248,24 +6254,26 @@ rrc_eNB_decode_ccch( rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); break; } - int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti); - if(UE_id == -1){ + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti); + if(UE_id == -1){ LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE_id(MAC) rnti %x, let's reject the UE\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti); rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); break; - } - - if((RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0) && - (RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres > 20)){ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RCConnectionReestablishmentComplete(Previous) don't receive, delete the Previous UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1000; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - } - + } + if((RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0) && + (RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres > 20)){ + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RCConnectionReestablishmentComplete(Previous) don't receive, delete the Previous UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1000; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + } + } if(ue_context_p->ue_context.ue_reestablishment_timer > 0){ LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRRCConnectionReconfigurationComplete(Previous) don't receive, delete the Previous UE\n", @@ -6790,28 +6798,40 @@ rrc_eNB_decode_dcch( PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); //clear - int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - if(UE_id == -1){ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReconfigurationComplete without rnti %x, fault\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); - break; - } - if(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag == 1){ - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld) C-RNTI Complete\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - dedicated_DRB = 2; - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; - } - } else { - dedicated_DRB = 0; - ue_context_p->ue_context.Status = RRC_RECONFIGURED; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - } - ue_context_p->ue_context.reestablishment_xid = -1; + // FIX ME: MAC context does not exist in CU + if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + if(UE_id == -1){ + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReconfigurationComplete without rnti %x, fault\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + break; + } + + if(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag == 1){ + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld) C-RNTI Complete\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + dedicated_DRB = 2; + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; + } + else { + dedicated_DRB = 0; + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } + } else{ + dedicated_DRB = 0; + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } + ue_context_p->ue_context.reestablishment_xid = -1; } else { dedicated_DRB = 1; ue_context_p->ue_context.Status = RRC_RECONFIGURED; @@ -6819,6 +6839,7 @@ rrc_eNB_decode_dcch( PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); } + } rrc_eNB_process_RRCConnectionReconfigurationComplete( ctxt_pP, @@ -6955,16 +6976,20 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { break; } //clear - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - if(UE_id == -1){ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE_id(MAC) rnti %x, fault\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); - break; - } - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - + if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + if(UE_id == -1){ + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE_id(MAC) rnti %x, fault\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + break; + } + + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + } if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present == RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) { rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, -- GitLab From d27e6f21b0c62d0041ccadd0bd86a5f8e881ee78 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sun, 23 Sep 2018 03:11:39 -0400 Subject: [PATCH 125/308] bugfix in F1 module_id handling for transaction idntifiers --- openair2/F1AP/f1ap_cu_interface_management.c | 10 ++++++---- openair2/F1AP/f1ap_du_interface_management.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index a81b722910..075bdd6418 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -244,8 +244,9 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, module_id_t enb_mod_idP; module_id_t cu_mod_idP; - enb_mod_idP = (module_id_t)12; - cu_mod_idP = (module_id_t)34; + // This should be fixed + enb_mod_idP = (module_id_t)0; + cu_mod_idP = (module_id_t)0; F1AP_F1AP_PDU_t pdu; F1AP_F1SetupResponse_t *out; @@ -378,8 +379,9 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { module_id_t enb_mod_idP; module_id_t cu_mod_idP; - enb_mod_idP = (module_id_t)12; - cu_mod_idP = (module_id_t)34; + // This should be fixed + enb_mod_idP = (module_id_t)0; + cu_mod_idP = (module_id_t)0; F1AP_F1AP_PDU_t pdu; F1AP_F1SetupFailure_t *out; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 189831c064..c3f139296d 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -85,8 +85,8 @@ int DU_handle_ERROR_INDICATION(instance_t instance, // SETUP REQUEST int DU_send_F1_SETUP_REQUEST(instance_t instance) { - module_id_t enb_mod_idP; - module_id_t du_mod_idP; + module_id_t enb_mod_idP=0; + module_id_t du_mod_idP=0; F1AP_F1AP_PDU_t pdu; F1AP_F1SetupRequest_t *out; -- GitLab From f2c5c0f7537c03a775091694a400030bad58994c Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sun, 23 Sep 2018 09:06:39 -0400 Subject: [PATCH 126/308] warning removal in rrc_eNB.c --- openair2/RRC/LTE/rrc_eNB.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index ff78051aaf..af85397030 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1912,6 +1912,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( /* TODO should test if e RAB are Ok before! */ ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + ue_context_pP->ue_context.e_rab[i].xid = xid; LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); } @@ -5512,6 +5513,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ue_context_pP->ue_context.kenb, &kUPenc); } + LOG_I(RRC,"Deriving keys for UE RNTI %x\n",ctxt_pP->rnti); derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm, ue_context_pP->ue_context.kenb, &kRRCenc); derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, @@ -5827,7 +5829,7 @@ rrc_eNB_generate_RRCConnectionSetup( // create an ITTI message /* TODO: F1 IDs ar missing in RRC */ message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_DL_RRC_MESSAGE); - F1AP_DL_RRC_MESSAGE (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload; + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t*)ue_p->Srb0.Tx_buffer.Payload; F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; @@ -7044,16 +7046,17 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU) || (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU) ) { +/* MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UL_RRC_MESSAGE); - F1AP_UL_RRC_MESSAGE (message_p).rrc_container = &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8; + F1AP_UL_RRC_MESSAGE (message_p).rrc_container = (uint8_t*)&ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8; F1AP_UL_RRC_MESSAGE (message_p).rrc_container_length = strlen(&ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); F1AP_UL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; F1AP_UL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; F1AP_UL_RRC_MESSAGE (message_p).rnti = ue_context_p->ue_context.rnti; F1AP_UL_RRC_MESSAGE (message_p).srb_id = DCCH; itti_send_msg_to_task (TASK_DU_F1, ctxt_pP->module_id, message_p); - LOG_D(RRC, "Send F1AP_UL_RRC_MESSAGE with ITTI\n"); + LOG_D(RRC, "Send F1AP_UL_RRC_MESSAGE with ITTI\n");*/ } else { // eNB or CU node type rrc_eNB_process_RRCConnectionSetupComplete( ctxt_pP, @@ -7412,7 +7415,7 @@ void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { - LOG_I(RRC,"Received F1 Setup Request from gNB_DU %d (%s)\n",f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name); + LOG_I(RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name); //uint16_t num_cells_to_activate = 0; @@ -7604,7 +7607,7 @@ rrc_enb_task( srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; srb_info_p->Active = 1; - rrc_eNB_decode_ccch(&ctxt, srb_info_p->Rx_buffer.Payload,srb_info_p->Rx_buffer.payload_size, CC_id); + rrc_eNB_decode_ccch(&ctxt, (uint8_t*)srb_info_p->Rx_buffer.Payload,srb_info_p->Rx_buffer.payload_size, CC_id); break; /* Messages from PDCP */ -- GitLab From 31fe819c7d26f0912c8e37085663e19759f03d51 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sun, 23 Sep 2018 14:30:37 -0400 Subject: [PATCH 127/308] extra logging --- openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c | 4 +- .../PDCP_v10.1.0/pdcp_sequence_manager.c | 2 +- openair3/S1AP/s1ap_eNB_encoder.c | 65 +++++++++++-------- 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c index 95a6c28ae6..ca8ead768a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c @@ -235,8 +235,8 @@ pdcp_validate_security( " Security: failed MAC-I Algo %X UE %"PRIx16" ", pdcp_pP->integrityProtAlgorithm, ctxt_pP->rnti); - LOG_E(PDCP, "[OSA][RB %d] %s failed to validate MAC-I of incoming PDU\n", - rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB"); + LOG_E(PDCP, "[OSA][RB %d] %s failed to validate MAC-I (key %llx) of incoming PDU\n", + rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB",((long long unsigned int*)decrypt_params.key)[0]); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT); return -1; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c index c6deb49441..8f56ac3d31 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c @@ -188,7 +188,7 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_ pdcp_entity->next_pdcp_rx_sn_before_integrity = pdcp_entity->next_pdcp_rx_sn; if (seq_num != pdcp_entity->next_pdcp_rx_sn) { - LOG_D(PDCP,"Re-adjusting the sequence number to %d\n", seq_num); + LOG_D(PDCP,"Re-adjusting the sequence number to %d from %d\n", seq_num,pdcp_entity->next_pdcp_rx_sn); } //set Next_PDCP_RX_SN to the received PDCP SN +1 ; diff --git a/openair3/S1AP/s1ap_eNB_encoder.c b/openair3/S1AP/s1ap_eNB_encoder.c index bc0c69792d..39deb4999a 100644 --- a/openair3/S1AP/s1ap_eNB_encoder.c +++ b/openair3/S1AP/s1ap_eNB_encoder.c @@ -176,26 +176,33 @@ int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu, switch(pdu->choice.successfulOutcome.procedureCode) { case S1AP_ProcedureCode_id_InitialContextSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); - message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded; - memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(res.buffer); + if (res.result.encoded<=0) LOG_E(RRC,"S1AP_ProcedureCode_id_InitialContextSetup: res.result.encoded<=0\n"); + else { + message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + } break; case S1AP_ProcedureCode_id_UEContextRelease: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); - message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = res.result.encoded; - memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, res.buffer, res.result.encoded); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(res.buffer); + if (res.result.encoded<=0) LOG_E(RRC,"S1AP_ProcedureCode_id_UEContextRelease: res.result.encoded<=0\n"); + else { + message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + } break; case S1AP_ProcedureCode_id_E_RABSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + AssertFatal(res.result.encoded>0,"res.result.encoded<=0\n"); message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG; message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = res.result.encoded; @@ -207,24 +214,30 @@ int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu, case S1AP_ProcedureCode_id_E_RABModify: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); - message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = res.result.encoded; - memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, res.buffer, res.result.encoded); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(res.buffer); - S1AP_INFO("E_RABModify successful message\n"); + if (res.result.encoded<=0) LOG_E(RRC,"S1AP_ProcedureCode_id_E_RABModify: res.result.encoded<=0\n"); + else { + message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + S1AP_INFO("E_RABModify successful message\n"); + } break; case S1AP_ProcedureCode_id_E_RABRelease: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); - message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_e_rab_release_response_log.size = res.result.encoded; - memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, res.buffer, res.result.encoded); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(res.buffer); - S1AP_INFO("E_RAB Release successful message\n"); + if (res.result.encoded<=0) LOG_E(RRC,"S1AP_ProcedureCode_id_E_RABRelease: res.result.encoded<=0\n"); + else { + message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_e_rab_release_response_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + S1AP_INFO("E_RAB Release successful message\n"); + } break; default: -- GitLab From 6bbc81694bb7c33ad53e7d06155f8a472680c5d4 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sun, 23 Sep 2018 16:06:40 -0400 Subject: [PATCH 128/308] Control plane is functional. Still need to handle RRCConnectionRelease in DU --- openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c | 2 +- openair2/LAYER2/RLC/rlc.c | 9 +++++---- openair2/RRC/LTE/L2_interface.c | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c index 8f56ac3d31..d24a935a00 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c @@ -150,7 +150,7 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_ uint16_t reordering_window = 0; - LOG_D(PDCP, "Incoming RX Sequence number is %04d\n", seq_num); + LOG_D(PDCP, "Incoming RX Sequence number is %04d (next %04d\n", seq_num, pdcp_entity->next_pdcp_rx_sn); if (pdcp_is_seq_num_size_valid(pdcp_entity) == FALSE || pdcp_is_seq_num_valid(seq_num, pdcp_entity->seq_num_size) == FALSE) { return FALSE; diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index d54938d400..152820bd87 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -635,10 +635,11 @@ void rlc_data_ind ( break; case ngran_eNB_DU : case ngran_gNB_DU : - DU_send_UL_RRC_MESSAGE_TRANSFER(ctxt_pP, - rb_idP, - sdu_sizeP, - sdu_pP->data); + if (srb_flagP == 1) + DU_send_UL_RRC_MESSAGE_TRANSFER(ctxt_pP, + rb_idP, + sdu_sizeP, + sdu_pP->data); break; default: diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index dafc24d9df..27712073b9 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -132,7 +132,7 @@ mac_rrc_data_req( (void*)mib, carrier->MIB, 24); - LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded); +// LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded); buffer_pP[0]=carrier->MIB[0]; buffer_pP[1]=carrier->MIB[1]; buffer_pP[2]=carrier->MIB[2]; @@ -149,10 +149,10 @@ mac_rrc_data_req( eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d, rnti %x)\n",Mod_idP,frameP, Srb_id,rnti); - if(ue_p->Srb0.Active==0) { +/* if(ue_p->Srb0.Active==0) { LOG_E(RRC,"[eNB %d] CCCH Not active (%p, rnti %x)\n",Mod_idP,ue_p,ue_p->rnti); return(0); - } + } */ Srb_info=&ue_p->Srb0; -- GitLab From ddb238b808bf04518f63470f8d29e6e280c0b1ed Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sun, 23 Sep 2018 18:05:57 -0400 Subject: [PATCH 129/308] removal of logging preparation for UE CONTEXT Release from CU --- openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 3 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/RLC/rlc.c | 6 +- openair2/LAYER2/RLC/rlc_mac.c | 4 +- openair2/RRC/LTE/rrc_eNB.c | 97 +++++++++++--------- 6 files changed, 65 insertions(+), 49 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index e2a28118ff..a8a73f1425 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1843,7 +1843,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; int SNRtimes10 = dB_fixed_times10(uci->stat) - 300;//(10*eNB->measurements.n0_power_dB[0]); - if (SNRtimes10 < -100) LOG_I(PHY,"uci->stat %d \n",uci->stat); + if (SNRtimes10 < -100) LOG_D(PHY,"uci->stat %d \n",uci->stat); if (SNRtimes10 < -640) pdu->ul_cqi_information.ul_cqi=0; else if (SNRtimes10 > 635) pdu->ul_cqi_information.ul_cqi=255; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 7aa28c0ce6..7feaa4d0fe 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -482,12 +482,13 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, break; case DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: // handle RRCConnectionRelease + LOG_I(DU_F1AP,"Received RRCConnectionRelease\n"); break; case DL_DCCH_MessageType__c1_PR_securityModeCommand: LOG_I(DU_F1AP,"Received securityModeCommand\n"); break; case DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - LOG_I(DU_F1AP,"Received sueCapabilityEnquiry\n"); + LOG_I(DU_F1AP,"Received ueCapabilityEnquiry\n"); break; case DL_DCCH_MessageType__c1_PR_counterCheck: #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 69a6ff4612..e1fce9c5f2 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -686,7 +686,7 @@ rx_sdu(const module_id_t enb_mod_idP, //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4; } - LOG_I(MAC, + LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n", enb_mod_idP, CC_idP, frameP, rx_lengths[i], UE_id, rx_lcids[i]); diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 152820bd87..2d2ac9f1e6 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -604,15 +604,15 @@ void rlc_data_ind ( //----------------------------------------------------------------------------- - //#if defined(TRACE_RLC_PAYLOAD) - LOG_I(RLC, PROTOCOL_CTXT_FMT"[%s %u] Display of rlc_data_ind: size %u\n", +#if defined(TRACE_RLC_PAYLOAD) + LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] Display of rlc_data_ind: size %u\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, sdu_sizeP); // rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP); - //#endif +#endif #if T_TRACER if (ctxt_pP->enb_flag) diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index ac53afa40b..9d540a18e8 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -38,7 +38,7 @@ #include "assertions.h" #include "common/utils/LOG/vcd_signal_dumper.h" -#define DEBUG_MAC_INTERFACE 1 +//#define DEBUG_MAC_INTERFACE 1 //----------------------------------------------------------------------------- struct mac_data_ind mac_rlc_deserialize_tb ( @@ -260,7 +260,7 @@ void mac_rlc_data_ind ( #ifdef DEBUG_MAC_INTERFACE if (num_tbP) { - LOG_I(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, tb_sizeP %d\n", + LOG_D(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, tb_sizeP %d\n", PROTOCOL_CTXT_ARGS(&ctxt), channel_idP, RLC_MAX_LC, diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index af85397030..f88d870aae 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1063,8 +1063,14 @@ void release_UE_in_freeList(module_id_t mod_id) } } } - rrc_mac_remove_ue(mod_id,rnti); - rrc_rlc_remove_ue(&ctxt); + if (RC.rrc[mod_id]->node_type == ngran_eNB) { + rrc_mac_remove_ue(mod_id,rnti); + rrc_rlc_remove_ue(&ctxt); + } + else if (RC.rrc[mod_id]->node_type == ngran_eNB_CU || RC.rrc[mod_id]->node_type == ngran_ng_eNB_CU) { + // send UE_CONTEXT_RELEASE + AssertFatal(1==0,"Need to added context removal\n"); + } pdcp_remove_UE(&ctxt); if(remove_UEContext){ @@ -6571,7 +6577,13 @@ rrc_eNB_decode_ccch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), random_value); - rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); + + if (RC.rrc[ctxt_pP->module_id] == ngran_eNB) + rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); + else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || + RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) + AssertFatal(1==0,"Need to added context removal\n"); + return -1; } } @@ -8107,7 +8119,8 @@ rrc_rx_tx( // ue_context_p->ue_context.ue_release_timer_s1 = 0; #if defined(ENABLE_USE_MME) #if defined(ENABLE_ITTI) - rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p); + if (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) + rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p); #endif #else ue_to_be_removed = ue_context_p; @@ -8141,44 +8154,46 @@ rrc_rx_tx( ue_context_p->ue_context.ue_release_timer_thres_rrc = 100; #if defined(ENABLE_USE_MME) #if defined(ENABLE_ITTI) - int e_rab; - MessageDef *msg_complete_p = NULL; - MessageDef *msg_delete_tunnels_p = NULL; - uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id; - if(rrc_release_info.RRC_release_ctrl[release_num].flag == 4){ - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); - msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); - S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_complete_p); - } - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id); - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); + if (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) { + int e_rab; + MessageDef *msg_complete_p = NULL; + MessageDef *msg_delete_tunnels_p = NULL; + uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id; + if(rrc_release_info.RRC_release_ctrl[release_num].flag == 4){ + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_S1AP_ENB, + NULL,0, + "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", + eNB_ue_s1ap_id); + msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); + S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; + itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_complete_p); + } + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id); + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); // do not wait response - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = - ue_context_p->ue_context.enb_gtp_ebi[e_rab]; - // erase data - ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); - ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; - } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); - struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; - rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids( - RC.rrc[ctxt_pP->module_id], - 0, - eNB_ue_s1ap_id); - if (NULL != rrc_ue_s1ap_ids) { - rrc_eNB_S1AP_remove_ue_ids( - RC.rrc[ctxt_pP->module_id], - rrc_ue_s1ap_ids); + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; + for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = + ue_context_p->ue_context.enb_gtp_ebi[e_rab]; + // erase data + ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; + } + itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); + struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; + rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids( + RC.rrc[ctxt_pP->module_id], + 0, + eNB_ue_s1ap_id); + if (NULL != rrc_ue_s1ap_ids) { + rrc_eNB_S1AP_remove_ue_ids( + RC.rrc[ctxt_pP->module_id], + rrc_ue_s1ap_ids); + } } #endif #endif -- GitLab From e4ac90238eb2935c141c15a4845bda0bd6e91293 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Mon, 24 Sep 2018 09:28:57 +0200 Subject: [PATCH 130/308] Fix F1-U srb and drb function calls (not tested). --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 34 ++++++++++++++++++++++++++++- openair2/LAYER2/RLC/rlc.c | 25 +++++++++++---------- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index bec37e1a29..6194f9394d 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -395,7 +395,13 @@ boolean_t pdcp_data_req( confirmP, pdcp_pdu_size, pdcp_pdu_p); /* assume good status */ rlc_status = RLC_OP_STATUS_OK; - } else { + ret = TRUE; + } else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU + || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU){ + LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type); + ret=FALSE; + } + else { rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p @@ -404,6 +410,32 @@ boolean_t pdcp_data_req( ,destinationL2Id #endif ); + switch (rlc_status) { + case RLC_OP_STATUS_OK: + LOG_D(PDCP, "Data sending request over RLC succeeded!\n"); + ret=TRUE; + break; + + case RLC_OP_STATUS_BAD_PARAMETER: + LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + ret= FALSE; + break; + + case RLC_OP_STATUS_INTERNAL_ERROR: + LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + ret= FALSE; + break; + + case RLC_OP_STATUS_OUT_OF_RESSOURCES: + LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + ret= FALSE; + break; + + default: + LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + ret= FALSE; + break; + } // switch case } /* end if node_type is CU */ free_mem_block(pdcp_pdu_p, __FUNCTION__); diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 2d2ac9f1e6..8ffe80c9f9 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -625,22 +625,25 @@ void rlc_data_ind ( case ngran_eNB_CU : case ngran_ng_eNB_CU : case ngran_gNB_CU : - proto_agent_send_pdcp_data_ind ( - ctxt_pP, - 1, // srb_flagP, - 0, // MBMS_flagP, - rb_idP, - sdu_sizeP, - sdu_pP); - break; + LOG_E(RLC, "Can't be CU, Bad Node type %d\n",RC.rrc[ctxt_pP->module_id]->node_type); + break ; case ngran_eNB_DU : case ngran_gNB_DU : if (srb_flagP == 1) DU_send_UL_RRC_MESSAGE_TRANSFER(ctxt_pP, rb_idP, - sdu_sizeP, - sdu_pP->data); - break; + sdu_sizeP, + sdu_pP->data); + else + proto_agent_send_pdcp_data_ind ( + ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, + sdu_sizeP, + sdu_pP); + + break; default: pdcp_data_ind ( -- GitLab From 6d16bf5243743a28673e1f04a72df31e2b6af74b Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Mon, 24 Sep 2018 12:32:41 +0200 Subject: [PATCH 131/308] Add log to trace proto_agent pdcp_data_ind operation --- openair2/LAYER2/PROTO_AGENT/proto_agent_common.c | 1 + openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 9fee6ad812..d6204fdfa1 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -619,6 +619,7 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto // if (xid == 1) // pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); // else if (xid == 0) // FIXME: USE a preprocessed definition + LOG_I(PROTO_AGETN, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP->instance, pdcp_pdu_size,ctxt_pP->rnti,rb_idP); result = pdcp_data_ind(ctxt_pP, srb_flagP, flag_MBMS, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index 7c0cc6b372..5b38278704 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -45,7 +45,7 @@ proto_agent_message_decoded_callback proto_agent_messages_callback[][3] = { {0, just_print, 0}, /* just print */ {proto_agent_pdcp_data_req_process, 0, 0}, /* PDCP data REQ */ {0, proto_agent_get_ack_result, 0}, /* get ACK result */ - {proto_agent_pdcp_data_ind_process, 0, 0}, /* PDCP data IND */ + {proto_agent_pdcp_data_ind_process, proto_agent_pdcp_data_ind_process, 0}, /* PDCP data IND */ {0, just_print, 0}, /* just print */ }; @@ -96,6 +96,7 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, LOG_D(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); goto error; } + err_code = ((*proto_agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); -- GitLab From 7f70860c24f3a0adf50c12459f707eba8d8e4a18 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Mon, 24 Sep 2018 17:48:57 +0200 Subject: [PATCH 132/308] Fix tag typo of PROTO_AGENT --- common/utils/LOG/log.c | 1 + openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 22 ++++++++++++++++++- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 2 +- .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 2 +- targets/COMMON/create_tasks.c | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 6d602d7027..989f77ee9a 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -396,6 +396,7 @@ int logInit (void) register_log_component("mRAL","",RAL_UE); register_log_component("ENB_APP","log",ENB_APP); register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT); + register_log_component("PROTO_AGENT","log",PROTO_AGENT); register_log_component("TMR","",TMR); register_log_component("USIM","txt",USIM); register_log_component("SIM","txt",SIM); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 6194f9394d..8ea37cc5ff 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -126,6 +126,12 @@ boolean_t pdcp_data_req( CHECK_CTXT_ARGS(ctxt_pP); + if (srb_flagP == 0) + LOG_I(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", + rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); + + + #if T_TRACER if (ctxt_pP->enb_flag != ENB_FLAG_NO) T(T_ENB_PDCP_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_buffer_sizeP)); @@ -385,8 +391,14 @@ boolean_t pdcp_data_req( LOG_F(PDCP,"\n"); #ifndef UETARGET + + if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) { + + LOG_I(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", + rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { @@ -396,6 +408,9 @@ boolean_t pdcp_data_req( /* assume good status */ rlc_status = RLC_OP_STATUS_OK; ret = TRUE; + LOG_I(PDCP, "proto_agent_send_rlc_data_req for UE RNTI %x, rb %d, pdu size %d \n", + ctxt_pP->rnti, rb_idP, pdcp_pdu_size); + } else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU){ LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type); @@ -838,11 +853,16 @@ pdcp_data_ind( #if defined(LINK_ENB_PDCP_TO_GTPV1U) if ((TRUE == ctxt_pP->enb_flag) && (FALSE == srb_flagP)) { + LOG_I(PDCP, "Sending packet to GTP, Calling GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u\n", + ctxt_pP->rnti, + rb_id + 4, + sdu_buffer_sizeP - payload_offset ); + MSC_LOG_TX_MESSAGE( MSC_PDCP_ENB, MSC_GTPU_ENB, NULL,0, - "0 GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u", + "0 GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u\n", ctxt_pP->rnti, rb_id + 4, sdu_buffer_sizeP - payload_offset); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index d6204fdfa1..800592c259 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -619,7 +619,7 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto // if (xid == 1) // pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); // else if (xid == 0) // FIXME: USE a preprocessed definition - LOG_I(PROTO_AGETN, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP->instance, pdcp_pdu_size,ctxt_pP->rnti,rb_idP); + LOG_I(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP->instance, pdcp_pdu_size,ctxt_pP->rnti,rb_idP); result = pdcp_data_ind(ctxt_pP, srb_flagP, flag_MBMS, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index 5b38278704..cb65da2803 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -43,7 +43,7 @@ proto_agent_message_decoded_callback proto_agent_messages_callback[][3] = { {proto_agent_hello, 0, 0}, /* agent hello */ {proto_agent_echo_reply, 0, 0}, /* echo */ {0, just_print, 0}, /* just print */ - {proto_agent_pdcp_data_req_process, 0, 0}, /* PDCP data REQ */ + {proto_agent_pdcp_data_req_process, proto_agent_pdcp_data_req_process, 0}, /* PDCP data REQ */ {0, proto_agent_get_ack_result, 0}, /* get ACK result */ {proto_agent_pdcp_data_ind_process, proto_agent_pdcp_data_ind_process, 0}, /* PDCP data IND */ {0, just_print, 0}, /* just print */ diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 793eb90740..fcc5eea4f8 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -102,7 +102,7 @@ int create_tasks(uint32_t enb_nb) rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); AssertFatal(rc >= 0, "Create task for UDP failed\n"); } - rc = itti_create_task(TASK_GTPV1_U, >pv1u_eNB_task, NULL); + rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); } #endif -- GitLab From 8ab24646f2b1d485b2eecc99883f1fe5c49485c4 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Tue, 25 Sep 2018 07:12:35 +0200 Subject: [PATCH 133/308] Proper setting for dedicated_DRB flag so as to sent the S1AP InitialContextSetupRequest --- openair2/RRC/LTE/rrc_eNB.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index f88d870aae..b94492dcfe 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6807,7 +6807,7 @@ rrc_eNB_decode_dcch( /*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/ if (EPC_MODE_ENABLED) { if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){ - dedicated_DRB = 1; + //dedicated_DRB = 1; LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); @@ -6847,7 +6847,7 @@ rrc_eNB_decode_dcch( } ue_context_p->ue_context.reestablishment_xid = -1; } else { - dedicated_DRB = 1; + //dedicated_DRB = 1; ue_context_p->ue_context.Status = RRC_RECONFIGURED; LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", @@ -6912,6 +6912,7 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { } }else if(dedicated_DRB == 0){ if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){ + LOG_I(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP\n"); rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p); } else { -- GitLab From 345989a975c1488649cd126f2564e34480bd9716 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Tue, 25 Sep 2018 04:07:52 -0400 Subject: [PATCH 134/308] remove info traces in PDCP, one still remains --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 8ea37cc5ff..97acbba612 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -127,7 +127,7 @@ boolean_t pdcp_data_req( if (srb_flagP == 0) - LOG_I(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", + LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); @@ -396,7 +396,7 @@ boolean_t pdcp_data_req( if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) { - LOG_I(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", + LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU @@ -408,7 +408,7 @@ boolean_t pdcp_data_req( /* assume good status */ rlc_status = RLC_OP_STATUS_OK; ret = TRUE; - LOG_I(PDCP, "proto_agent_send_rlc_data_req for UE RNTI %x, rb %d, pdu size %d \n", + LOG_D(PDCP, "proto_agent_send_rlc_data_req for UE RNTI %x, rb %d, pdu size %d \n", ctxt_pP->rnti, rb_idP, pdcp_pdu_size); } else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU @@ -853,7 +853,7 @@ pdcp_data_ind( #if defined(LINK_ENB_PDCP_TO_GTPV1U) if ((TRUE == ctxt_pP->enb_flag) && (FALSE == srb_flagP)) { - LOG_I(PDCP, "Sending packet to GTP, Calling GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u\n", + LOG_D(PDCP, "Sending packet to GTP, Calling GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u\n", ctxt_pP->rnti, rb_id + 4, sdu_buffer_sizeP - payload_offset ); -- GitLab From d4f0e50d4f5c960be052694ca7975f83755bcd30 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Tue, 25 Sep 2018 10:26:40 +0200 Subject: [PATCH 135/308] send the S1SP initial context response if it is not sent with the attach complete message --- openair2/RRC/LTE/rrc_eNB_S1AP.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 1f5a8772d4..59e0d3f06d 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1058,6 +1058,14 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char rrc_eNB_generate_UECapabilityEnquiry (&ctxt, ue_context_p); } } + + // in case, we did not send the response with the attach complete message + if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) { + LOG_I(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause); + //if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){} + + rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p); + } /* if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) || (RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) || -- GitLab From 374c1087a1715244060778ea5a914b93949f2dd9 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Tue, 25 Sep 2018 11:36:23 +0200 Subject: [PATCH 136/308] Add some comments --- openair2/RRC/LTE/rrc_eNB_S1AP.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 59e0d3f06d..a631c8df42 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1059,11 +1059,10 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char } } - // in case, we did not send the response with the attach complete message + // in case, send the S1SP initial context response if it is not sent with the attach complete message if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) { LOG_I(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause); - //if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){} - + //if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){} rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p); } /* -- GitLab From 5d8f17f392d7d8ee3444dfe0ceb4c7566667c929 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 25 Sep 2018 15:36:00 +0200 Subject: [PATCH 137/308] Add send UE CONTEXT RELEASE message procedure --- openair2/F1AP/f1ap_cu_ue_context_management.c | 89 ++++++++- openair2/F1AP/f1ap_cu_ue_context_management.h | 4 +- openair2/F1AP/f1ap_du_ue_context_management.c | 186 +++++++++++++++++- openair2/F1AP/f1ap_du_ue_context_management.h | 14 +- 4 files changed, 283 insertions(+), 10 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 9db464dcd3..85a7b528a9 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -775,8 +775,93 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, - F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand) { - AssertFatal(1==0,"Not implemented yet\n"); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextReleaseCommand_t *out; + F1AP_UEContextReleaseCommandIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + //int i = 0, j = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand; + out = &pdu.choice.initiatingMessage->value.choice.UEContextReleaseCommand; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextReleaseCommandIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCommandIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextReleaseCommandIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCommandIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. Cause */ + ie = (F1AP_UEContextReleaseCommandIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCommandIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cause; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_Cause; + + // dummy value + ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + + switch(ie->value.choice.Cause.present) + { + case F1AP_Cause_PR_radioNetwork: + ie->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; + case F1AP_Cause_PR_transport: + ie->value.choice.Cause.choice.transport = F1AP_CauseTransport_unspecified; + break; + case F1AP_Cause_PR_protocol: + ie->value.choice.Cause.choice.protocol = F1AP_CauseProtocol_unspecified; + break; + case F1AP_Cause_PR_misc: + ie->value.choice.Cause.choice.misc = F1AP_CauseMisc_unspecified; + break; + case F1AP_Cause_PR_NOTHING: + default: + break; + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c4. RRCContainer */ + ie = (F1AP_UEContextReleaseCommandIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCommandIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer; + + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + LOG_E(DU_F1AP, "Failed to encode F1 context release command\n"); + return -1; + } + + // send + + return 0; } diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h index 9e25309aa9..77c3abea72 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.h +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -61,8 +61,10 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* * UE Context Release (gNB-CU initiated) */ +// note: is temporary with f1ap_ue_context_setup_req_t int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, - F1AP_UEContextReleaseCommand_t *UEContextReleaseCommand); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req); + int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, uint32_t assoc_id, uint32_t stream, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 7d8a8026c0..4da6babee0 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -424,8 +424,84 @@ int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance) { } -int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance) { - AssertFatal(1==0,"Not implemented yet\n"); +// note: is temporary with f1ap_ue_context_setup_req_t +int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextReleaseRequest_t *out; + F1AP_UEContextReleaseRequestIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + //int i = 0, j = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; + pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; + pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest; + out = &pdu.choice.initiatingMessage->value.choice.UEContextReleaseRequest; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextReleaseRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextReleaseRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c3. Cause */ + ie = (F1AP_UEContextReleaseRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cause; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_Cause; + + // dummy value + ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + + switch(ie->value.choice.Cause.present) + { + case F1AP_Cause_PR_radioNetwork: + ie->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; + case F1AP_Cause_PR_transport: + ie->value.choice.Cause.choice.transport = F1AP_CauseTransport_unspecified; + break; + case F1AP_Cause_PR_protocol: + ie->value.choice.Cause.choice.protocol = F1AP_CauseProtocol_unspecified; + break; + case F1AP_Cause_PR_misc: + ie->value.choice.Cause.choice.misc = F1AP_CauseMisc_unspecified; + break; + case F1AP_Cause_PR_NOTHING: + default: + break; + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + LOG_E(DU_F1AP, "Failed to encode F1 context release request\n"); + return -1; + } + + // send + + return 0; } @@ -437,8 +513,110 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, } -int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance) { - AssertFatal(1==0,"Not implemented yet\n"); +// note: is temporary with f1ap_ue_context_setup_req_t +int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { + F1AP_F1AP_PDU_t pdu; + F1AP_UEContextReleaseComplete_t *out; + F1AP_UEContextReleaseCompleteIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + int i = 0;//, j = 0; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); + pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; + pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete; + out = &pdu.choice.successfulOutcome->value.choice.UEContextReleaseComplete; + + /* mandatory */ + /* c1. GNB_CU_UE_F1AP_ID */ + ie = (F1AP_UEContextReleaseCompleteIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCompleteIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. GNB_DU_UE_F1AP_ID */ + ie = (F1AP_UEContextReleaseCompleteIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCompleteIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. CriticalityDiagnostics */ + if (0) { + ie = (F1AP_UEContextReleaseCompleteIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCompleteIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_CriticalityDiagnostics; + + // dummy value + /* optional */ + /* procedureCode */ + if (0) { + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + ie->value.choice.CriticalityDiagnostics.procedureCode = 0L; + } + + /* optional */ + /* triggeringMessage */ + if (0) { + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)F1AP_TriggeringMessage_successful_outcome; + } + + /* optional */ + /* procedureCriticality */ + if (0) { + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + } + + /* optional */ + /* transactionID */ + if (0) { + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + ie->value.choice.CriticalityDiagnostics.transactionID = 0L; + } + + /* optional */ + /* F1AP_CriticalityDiagnostics_IE_List */ + if (0) { + for (i=0; + i<0; + i++) { + + F1AP_CriticalityDiagnostics_IE_Item_t *criticalityDiagnostics_ie_item = (F1AP_CriticalityDiagnostics_IE_Item_t *)calloc(1, sizeof(F1AP_CriticalityDiagnostics_IE_Item_t));; + criticalityDiagnostics_ie_item->iECriticality = F1AP_Criticality_reject; + criticalityDiagnostics_ie_item->iE_ID = 0L; + criticalityDiagnostics_ie_item->typeOfError = F1AP_TypeOfError_not_understood; + + ASN_SEQUENCE_ADD(&ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics->list, + criticalityDiagnostics_ie_item); + } + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + LOG_E(DU_F1AP, "Failed to encode F1 context release complete\n"); + return -1; + } + + // send + + return 0; } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index 15e987209b..4035f2da64 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -47,17 +47,25 @@ int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance); /* * UE Context Release Request (gNB-DU initiated) */ -int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance); +// note: is temporary with f1ap_ue_context_setup_req_t +int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req); /* - * UE Context Release (gNB-CU initiated) + * UE Context Release Command (gNB-CU initiated) */ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance); + +/* + * UE Context Release Complete (gNB-DU initiated) + */ +// note: is temporary with f1ap_ue_context_setup_req_t +int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req); /* -- GitLab From ecd6d673ea566fbd8e28710e9e2bc0bb96e666c7 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 25 Sep 2018 16:21:01 +0200 Subject: [PATCH 138/308] Update complete elements with ue context setup response --- openair2/F1AP/f1ap_cu_ue_context_management.c | 2 +- openair2/F1AP/f1ap_du_ue_context_management.c | 393 +++++++++++++----- 2 files changed, 281 insertions(+), 114 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 85a7b528a9..04fcabfe76 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -819,7 +819,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_Cause; - // dummy value + // dummy value ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; switch(ie->value.choice.Cause.present) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 4da6babee0..c34179cafe 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -36,6 +36,13 @@ #include "f1ap_itti_messaging.h" #include "f1ap_du_ue_context_management.h" +// undefine C_RNTI from +// openair1/PHY/LTE_TRANSPORT/transport_common.h which +// replaces in ie->value.choice.C_RNTI, causing +// a compile error + +#undef C_RNTI + extern f1ap_setup_req_t *f1ap_du_data; int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, @@ -167,7 +174,9 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { uint8_t *buffer; uint32_t len; - int i = 0; + int i = 0, j = 0; + + rnti_t rntiP; // note: need get value /* Create */ /* 0. Message Type */ @@ -203,19 +212,42 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; + { + /* cellGroupConfig */ + OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", + strlen("asdsa")); + /* OPTIONAL */ + /* measGapConfig */ + if (0) { + ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); + OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa", + strlen("asdsa")); + } + + /* OPTIONAL */ + /* requestedP_MaxFR1 */ + if (0) { + ie->value.choice.DUtoCURRCInformation.requestedP_MaxFR1 = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, "asdsa", + strlen("asdsa")); + } + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } - OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", - strlen("asdsa")); - /* OPTIONAL */ + /* optional */ + /* c4. C_RNTI */ if (0) { - ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); - OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa", - strlen("asdsa")); + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_C_RNTI; + C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ - /* c4. ResourceCoordinationTransferContainer */ + /* c5. ResourceCoordinationTransferContainer */ if (0) { ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; @@ -226,8 +258,19 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - // /* */ - /* c5. DRBs_Setup_List */ + /* optional */ + /* c6. FullConfiguration */ + if (0) { + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_FullConfiguration; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_FullConfiguration; + ie->value.choice.FullConfiguration = F1AP_FullConfiguration_full; //enum + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + /* c7. DRBs_Setup_List */ ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; ie->criticality = F1AP_Criticality_ignore; @@ -243,13 +286,18 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { drbs_setup_item_ies->criticality = F1AP_Criticality_ignore; drbs_setup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; - /* 5.1 DRBs_Setup_Item */ + /* 7.1 DRBs_Setup_Item */ F1AP_DRBs_Setup_Item_t drbs_setup_item; memset((void *)&drbs_setup_item, 0, sizeof(F1AP_DRBs_Setup_Item_t)); + /* dRBID */ drbs_setup_item.dRBID = 12; - int j; + /* OPTIONAL */ + /* lCID */ + drbs_setup_item.lCID = (F1AP_LCID_t *)calloc(1, sizeof(F1AP_LCID_t)); + drbs_setup_item.lCID = 0L; + for (j=0; j<1; j++) { @@ -258,35 +306,31 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + /* gTPTunnel */ F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - - // F1AP_TransportLayerAddress_t transportLayerAddress; - // transportLayerAddress.buf = malloc((36+7)/8); - // transportLayerAddress.size = (36+7)/8; - // transportLayerAddress.bits_unused = 4; - // *transportLayerAddress.buf = 123; - // dLUPTNLInformation_ToBeSetup_Item.dL_GTP_Tunnel_EndPoint.transportLayerAddress = transportLayerAddress; - - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); - - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - + { + /* transportLayerAddress */ + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + + /* gTP_TEID */ + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); + dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; + } + /* ADD */ ASN_SEQUENCE_ADD(&drbs_setup_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); - } + } // for j - // /* ADD */ + /* ADD */ drbs_setup_item_ies->value.choice.DRBs_Setup_Item = drbs_setup_item; ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Setup_List.list, drbs_setup_item_ies); - } + } // for i ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - // /* */ - /* c6. SRBs_FailedToBeSetup_List */ + /* mandatory */ + /* c8. SRBs_FailedToBeSetup_List */ ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; ie->criticality = F1AP_Criticality_ignore; @@ -295,31 +339,54 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { for (i=0; i<1; i++) { - // - F1AP_SRBs_FailedToBeSetup_ItemIEs_t *srbs_failedToBeSetup_item_ies; - srbs_failedToBeSetup_item_ies = (F1AP_SRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetup_ItemIEs_t)); - srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; - srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; - - /* 6.1 SRBs_Setup_Item */ - F1AP_SRBs_FailedToBeSetup_Item_t srbs_failedToBeSetup_item; - memset((void *)&srbs_failedToBeSetup_item, 0, sizeof(F1AP_SRBs_FailedToBeSetup_Item_t)); - - srbs_failedToBeSetup_item.sRBID = 13; - srbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - srbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; - srbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; - - // /* ADD */ - srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item = srbs_failedToBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetup_List.list, - srbs_failedToBeSetup_item_ies); - } + // + F1AP_SRBs_FailedToBeSetup_ItemIEs_t *srbs_failedToBeSetup_item_ies; + srbs_failedToBeSetup_item_ies = (F1AP_SRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetup_ItemIEs_t)); + srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; + srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; + + /* 8.1 SRBs_Setup_Item */ + F1AP_SRBs_FailedToBeSetup_Item_t srbs_failedToBeSetup_item; + memset((void *)&srbs_failedToBeSetup_item, 0, sizeof(F1AP_SRBs_FailedToBeSetup_Item_t)); + + /* sRBID */ + srbs_failedToBeSetup_item.sRBID = 13L; + + /* cause */ + srbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + + // dummy value + srbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + + switch(srbs_failedToBeSetup_item.cause->present) + { + case F1AP_Cause_PR_radioNetwork: + srbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; + case F1AP_Cause_PR_transport: + srbs_failedToBeSetup_item.cause->choice.transport = F1AP_CauseTransport_unspecified; + break; + case F1AP_Cause_PR_protocol: + srbs_failedToBeSetup_item.cause->choice.protocol = F1AP_CauseProtocol_unspecified; + break; + case F1AP_Cause_PR_misc: + srbs_failedToBeSetup_item.cause->choice.misc = F1AP_CauseMisc_unspecified; + break; + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + + /* ADD */ + srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item = srbs_failedToBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetup_List.list, + srbs_failedToBeSetup_item_ies); + } // for i ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - // /* */ - /* c7. DRBs_FailedToBeSetup_List */ + /* */ + /* c9. DRBs_FailedToBeSetup_List */ ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; ie->criticality = F1AP_Criticality_ignore; @@ -328,31 +395,54 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { for (i=0; i<1; i++) { - // - F1AP_DRBs_FailedToBeSetup_ItemIEs_t *drbs_failedToBeSetup_item_ies; - drbs_failedToBeSetup_item_ies = (F1AP_DRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetup_ItemIEs_t)); - drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; - drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; - - /* 7.1 DRBs_Setup_Item */ - F1AP_DRBs_FailedToBeSetup_Item_t drbs_failedToBeSetup_item; - memset((void *)&drbs_failedToBeSetup_item, 0, sizeof(F1AP_DRBs_FailedToBeSetup_Item_t)); - - drbs_failedToBeSetup_item.dRBID = 14; - drbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - drbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; - - // /* ADD */ - drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item = drbs_failedToBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetup_List.list, + // + F1AP_DRBs_FailedToBeSetup_ItemIEs_t *drbs_failedToBeSetup_item_ies; + drbs_failedToBeSetup_item_ies = (F1AP_DRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetup_ItemIEs_t)); + drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; + drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; + + /* 9.1 DRBs_Setup_Item */ + F1AP_DRBs_FailedToBeSetup_Item_t drbs_failedToBeSetup_item; + memset((void *)&drbs_failedToBeSetup_item, 0, sizeof(F1AP_DRBs_FailedToBeSetup_Item_t)); + + /* dRBID */ + drbs_failedToBeSetup_item.dRBID = 14; + + /* cause */ + drbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + + // dummy value + drbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + + switch(drbs_failedToBeSetup_item.cause->present) + { + case F1AP_Cause_PR_radioNetwork: + drbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; + case F1AP_Cause_PR_transport: + drbs_failedToBeSetup_item.cause->choice.transport = F1AP_CauseTransport_unspecified; + break; + case F1AP_Cause_PR_protocol: + drbs_failedToBeSetup_item.cause->choice.protocol = F1AP_CauseProtocol_unspecified; + break; + case F1AP_Cause_PR_misc: + drbs_failedToBeSetup_item.cause->choice.misc = F1AP_CauseMisc_unspecified; + break; + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + + /* ADD */ + drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item = drbs_failedToBeSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetup_List.list, drbs_failedToBeSetup_item_ies); - } + } // for i ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); // /* */ - /* c8. SCell_FailedtoSetup_List */ + /* c10. SCell_FailedtoSetup_List */ ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; ie->criticality = F1AP_Criticality_ignore; @@ -361,51 +451,90 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { for (i=0; i<1; i++) { - // - F1AP_SCell_FailedtoSetup_ItemIEs_t *sCell_FailedtoSetup_item_ies; - sCell_FailedtoSetup_item_ies = (F1AP_SCell_FailedtoSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetup_ItemIEs_t)); - sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; - sCell_FailedtoSetup_item_ies->criticality = F1AP_Criticality_ignore; - sCell_FailedtoSetup_item_ies->value.present = F1AP_SCell_FailedtoSetup_ItemIEs__value_PR_SCell_FailedtoSetup_Item; - - /* 8.1 DRBs_Setup_Item */ - F1AP_SCell_FailedtoSetup_Item_t sCell_FailedtoSetup_item; - memset((void *)&sCell_FailedtoSetup_item, 0, sizeof(F1AP_SCell_FailedtoSetup_Item_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; // issue here - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); - - sCell_FailedtoSetup_item.sCell_ID = nRCGI; - - sCell_FailedtoSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - sCell_FailedtoSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; - sCell_FailedtoSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_cu_ue_f1ap_id; - - // /* ADD */ - sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item = sCell_FailedtoSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetup_List.list, + // + F1AP_SCell_FailedtoSetup_ItemIEs_t *sCell_FailedtoSetup_item_ies; + sCell_FailedtoSetup_item_ies = (F1AP_SCell_FailedtoSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetup_ItemIEs_t)); + sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; + sCell_FailedtoSetup_item_ies->criticality = F1AP_Criticality_ignore; + sCell_FailedtoSetup_item_ies->value.present = F1AP_SCell_FailedtoSetup_ItemIEs__value_PR_SCell_FailedtoSetup_Item; + + /* 10.1 DRBs_Setup_Item */ + F1AP_SCell_FailedtoSetup_Item_t sCell_FailedtoSetup_item; + memset((void *)&sCell_FailedtoSetup_item, 0, sizeof(F1AP_SCell_FailedtoSetup_Item_t)); + + /* sCell_ID */ + F1AP_NRCGI_t nRCGI; // issue here + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); + + sCell_FailedtoSetup_item.sCell_ID = nRCGI; + + /* cause */ + sCell_FailedtoSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + + // dummy value + sCell_FailedtoSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + + switch(sCell_FailedtoSetup_item.cause->present) + { + case F1AP_Cause_PR_radioNetwork: + sCell_FailedtoSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; + case F1AP_Cause_PR_transport: + sCell_FailedtoSetup_item.cause->choice.transport = F1AP_CauseTransport_unspecified; + break; + case F1AP_Cause_PR_protocol: + sCell_FailedtoSetup_item.cause->choice.protocol = F1AP_CauseProtocol_unspecified; + break; + case F1AP_Cause_PR_misc: + sCell_FailedtoSetup_item.cause->choice.misc = F1AP_CauseMisc_unspecified; + break; + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + + /* ADD */ + sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item = sCell_FailedtoSetup_item; + ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetup_List.list, sCell_FailedtoSetup_item_ies); - } + } // for i ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - // /* */ - /* c9. CriticalityDiagnostics */ + + /* Optional */ + /* c11. InactivityMonitoringResponse */ + if (0) { + ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringResponse; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_InactivityMonitoringResponse; + ie->value.choice.InactivityMonitoringResponse = F1AP_InactivityMonitoringResponse_not_supported; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + + /* Optional */ + /* c12. CriticalityDiagnostics */ if (0) { ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_CriticalityDiagnostics; + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); *ie->value.choice.CriticalityDiagnostics.transactionID = 0; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -960,14 +1089,52 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_CriticalityDiagnostics; - ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextModification; - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); - *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; - ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; - ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - *ie->value.choice.CriticalityDiagnostics.transactionID = 0; + + // dummy value + /* optional */ + /* procedureCode */ + if (0) { + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + ie->value.choice.CriticalityDiagnostics.procedureCode = 0L; + } + + /* optional */ + /* triggeringMessage */ + if (0) { + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)F1AP_TriggeringMessage_successful_outcome; + } + + /* optional */ + /* procedureCriticality */ + if (0) { + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + } + + /* optional */ + /* transactionID */ + if (0) { + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + ie->value.choice.CriticalityDiagnostics.transactionID = 0L; + } + + /* optional */ + /* F1AP_CriticalityDiagnostics_IE_List */ + if (0) { + for (i=0; + i<0; + i++) { + + F1AP_CriticalityDiagnostics_IE_Item_t *criticalityDiagnostics_ie_item = (F1AP_CriticalityDiagnostics_IE_Item_t *)calloc(1, sizeof(F1AP_CriticalityDiagnostics_IE_Item_t));; + criticalityDiagnostics_ie_item->iECriticality = F1AP_Criticality_reject; + criticalityDiagnostics_ie_item->iE_ID = 0L; + criticalityDiagnostics_ie_item->typeOfError = F1AP_TypeOfError_not_understood; + + ASN_SEQUENCE_ADD(&ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics->list, + criticalityDiagnostics_ie_item); + } + } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } -- GitLab From c017b8b4896b027223a49480e20a541a98628d52 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Tue, 25 Sep 2018 17:27:43 +0200 Subject: [PATCH 139/308] Add handle UE CONTEXT RELEASE message procedure --- openair2/F1AP/f1ap_cu_ue_context_management.c | 90 ++++++++++++++++++- openair2/F1AP/f1ap_du_ue_context_management.c | 65 +++++++++++++- 2 files changed, 151 insertions(+), 4 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 04fcabfe76..06b4c471ab 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -766,11 +766,59 @@ int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, } +// note: is temporary with F1AP_UE_CONTEXT_SETUP_REQ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + MessageDef *msg_p; // message to RRC + F1AP_UEContextReleaseRequest_t *container; + F1AP_UEContextReleaseRequestIEs_t *ie; + //int i; + + DevAssert(pdu); + + msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; + f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); + + container = &pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest; + + /* GNB_CU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + + /* GNB_DU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + + /* Cause */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_Cause, true); + + switch(ie->value.choice.Cause.present) + { + case F1AP_Cause_PR_radioNetwork: + //ie->value.choice.Cause.choice.radioNetwork + break; + case F1AP_Cause_PR_transport: + //ie->value.choice.Cause.choice.transport + break; + case F1AP_Cause_PR_protocol: + //ie->value.choice.Cause.choice.protocol + break; + case F1AP_Cause_PR_misc: + //ie->value.choice.Cause.choice.misc + break; + case F1AP_Cause_PR_NOTHING: + default: + break; + } + + AssertFatal(0, "check configuration, send to appropriate handler\n"); + } @@ -864,12 +912,48 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, return 0; } - +// note: is temporary with F1AP_UE_CONTEXT_SETUP_REQ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + MessageDef *msg_p; // message to RRC + F1AP_UEContextReleaseComplete_t *container; + F1AP_UEContextReleaseCompleteIEs_t *ie; + //int i; + + DevAssert(pdu); + + msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; + f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); + + container = &pdu->choice.successfulOutcome->value.choice.UEContextReleaseComplete; + + /* GNB_CU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + + /* GNB_DU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + + /* Optional*/ + /* CriticalityDiagnostics */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_CriticalityDiagnostics, false); + if (ie) { + // ie->value.choice.CriticalityDiagnostics.procedureCode + // ie->value.choice.CriticalityDiagnostics.triggeringMessage + // ie->value.choice.CriticalityDiagnostics.procedureCriticality + // ie->value.choice.CriticalityDiagnostics.transactionID + + // F1AP_CriticalityDiagnostics_IE_List + } + + AssertFatal(0, "check configuration, send to appropriate handler\n"); } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index c34179cafe..3cdafe4308 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -634,11 +634,74 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, } +// note: is temporary with F1AP_UE_CONTEXT_SETUP_REQ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); + + MessageDef *msg_p; // message to RRC + F1AP_UEContextReleaseRequest_t *container; + F1AP_UEContextReleaseRequestIEs_t *ie; + int i; + + DevAssert(pdu); + + msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; + f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); + + container = &pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest; + + /* GNB_CU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + + /* GNB_DU_UE_F1AP_ID */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + + /* Cause */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_Cause, true); + + switch(ie->value.choice.Cause.present) + { + case F1AP_Cause_PR_radioNetwork: + //ie->value.choice.Cause.choice.radioNetwork + break; + case F1AP_Cause_PR_transport: + //ie->value.choice.Cause.choice.transport + break; + case F1AP_Cause_PR_protocol: + //ie->value.choice.Cause.choice.protocol + break; + case F1AP_Cause_PR_misc: + //ie->value.choice.Cause.choice.misc + break; + case F1AP_Cause_PR_NOTHING: + default: + break; + } + + /* Optional */ + /* RRC Container */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_RRCContainer, false); + if (ie) { + // message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + // ccch_sdu_len = ie->value.choice.RRCContainer.size; + // memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, + // ccch_sdu_len); + // LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); + // for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + } + + AssertFatal(0, "check configuration, send to appropriate handler\n"); + } -- GitLab From 3d41f5cb03ba7fb89db739e28591d806a7fcf987 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 28 Sep 2018 11:51:11 +0200 Subject: [PATCH 140/308] add msc trace for F1AP --- common/utils/msc/msc.c | 14 ++++++++++++++ common/utils/msc/msc.h | 2 ++ openair2/F1AP/f1ap_cu_interface_management.c | 10 ++++++++++ openair2/F1AP/f1ap_du_interface_management.c | 19 ++++++++++++++++++- 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c index 8ff8846b70..4e02cd00d2 100644 --- a/common/utils/msc/msc.c +++ b/common/utils/msc/msc.c @@ -333,6 +333,20 @@ int msc_init(const msc_env_t envP, const int max_threadsP) msc_log_declare_proto(i); } break; + case MSC_F1AP_CU: + rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_CU"); + if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} + //if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) { + msc_log_declare_proto(i); + //} + break; + case MSC_F1AP_DU: + rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_DU"); + if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} + //if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) { + msc_log_declare_proto(i); + //} + break; default: rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN"); if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h index 78eb6cdb08..58a0d2c804 100644 --- a/common/utils/msc/msc.h +++ b/common/utils/msc/msc.h @@ -62,6 +62,8 @@ typedef enum { MSC_S11_MME, MSC_S6A_MME, MSC_HSS, + MSC_F1AP_CU, + MSC_F1AP_DU, MAX_MSC_PROTOS, } msc_proto_t; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 075bdd6418..894bc79268 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -229,6 +229,16 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; + + MSC_LOG_TX_MESSAGE( + MSC_F1AP_CU, + MSC_RRC_ENB, + 0, + 0, + MSC_AS_TIME_FMT" CU_handle_F1_SETUP_REQUEST", + 0,0//MSC_AS_TIME_ARGS(ctxt_pP), + ); + if (num_cells_available > 0) { itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); } else { diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index c3f139296d..c088c72aa9 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -403,6 +403,15 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { return -1; } + MSC_LOG_TX_MESSAGE( + MSC_F1AP_DU, + MSC_F1AP_CU, + (const char *)buffer, + len, + MSC_AS_TIME_FMT" F1_SETUP_REQUEST initiatingMessage gNB_DU_name %s", + 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), + f1ap_du_data->gNB_DU_name); + du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); return 0; @@ -518,7 +527,15 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, for (int i=0;i<num_cells_to_activate;i++) AssertFatal(F1AP_SETUP_RESP (msg_p).num_SI[i] > 0, "System Information %d is missing",i); - + MSC_LOG_RX_MESSAGE( + MSC_F1AP_DU, + MSC_F1AP_CU, + 0, + 0, + MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d", + 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), + assoc_id); + LOG_D(DU_F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); -- GitLab From be661cce1a40913ece7b7250b75fb3ca1e644517 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong <Bing-Kai.Hong@eurecom.fr> Date: Fri, 28 Sep 2018 16:44:14 +0200 Subject: [PATCH 141/308] turn off debug print with F1AP --- openair2/F1AP/f1ap_decoder.c | 2 +- openair2/F1AP/f1ap_encoder.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 1de0495ce5..5fad54cf77 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -33,7 +33,7 @@ #include "f1ap_common.h" #include "f1ap_decoder.h" -int asn1_decoder_xer_print = 1; +int asn1_decoder_xer_print = 0; static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) { diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index 248c61fcf5..f0624ef4d8 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -33,7 +33,7 @@ #include "f1ap_common.h" #include "f1ap_encoder.h" -int asn1_encoder_xer_print = 1; +int asn1_encoder_xer_print = 0; /* static inline int f1ap_encode_initiating(f1ap_message *message, -- GitLab From 403db5b544c0a2943a5825f298b4c69fd3ad600a Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Fri, 5 Oct 2018 17:03:24 +0200 Subject: [PATCH 142/308] Fix the issue in sending UE Initial Context Setup Response --- openair2/F1AP/f1ap_cu_interface_management.c | 5 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 8 +-- openair2/F1AP/f1ap_decoder.c | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 38 +++++++------- openair2/F1AP/f1ap_encoder.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 52 +++++++++++++------- openair2/RRC/LTE/rrc_eNB_S1AP.c | 1 + 7 files changed, 65 insertions(+), 43 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 894bc79268..9039b967c4 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -345,10 +345,11 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - +#ifdef F1AP_DEBUG LOG_D(CU_F1AP, "SI %d: ",i); - for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) LOG_D(CU_F1AP, "%2x ",f1ap_setup_resp->SI_container[i][0][n]); + for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) printf("%2x ",f1ap_setup_resp->SI_container[i][0][n]); LOG_D(CU_F1AP, "\n"); +#endif OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, (const char*)f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 69df45350f..7e62f2235d 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -121,9 +121,11 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); - LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - LOG_D(CU_F1AP, "\n"); + #ifdef F1AP_DEBUG + LOG_I(CU_F1AP, "RRCContainer(CCCH) :"); + for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_I(CU_F1AP, "\n"); +#endif // Find instance from nr_cellid int rrc_inst = -1; for (int i=0;i<RC.nb_inst;i++) { diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 1de0495ce5..5fad54cf77 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -33,7 +33,7 @@ #include "f1ap_common.h" #include "f1ap_decoder.h" -int asn1_decoder_xer_print = 1; +int asn1_decoder_xer_print = 0; static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) { diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 7feaa4d0fe..4ba8d291d4 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -197,27 +197,27 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, switch (dl_ccch_msg->message.choice.c1.present) { case DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, "Received PR_NOTHING on DL-CCCH-Message\n"); + LOG_I(DU_F1AP, "Received PR_NOTHING on DL-CCCH-Message\n"); break; case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: - LOG_I(RRC, + LOG_I(DU_F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n"); break; case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: - LOG_I(RRC, + LOG_I(DU_F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n"); break; case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: - LOG_I(RRC, + LOG_I(DU_F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); break; case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: { - LOG_I(RRC, + LOG_I(DU_F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n", du_ue_f1ap_id, f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); @@ -409,9 +409,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { ue_context_p->ue_context.Srb2.Active=1; ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(RRC,"[DU %d] SRB2 is now active\n",ctxt.module_id); + LOG_I(DU_F1AP,"[DU %d] SRB2 is now active\n",ctxt.module_id); } else { - LOG_W(RRC,"[DU %d] invalide SRB identity %ld\n",ctxt.module_id, + LOG_W(DU_F1AP,"[DU %d] invalide SRB identity %ld\n",ctxt.module_id, SRB_configList->list.array[i]->srb_Identity); } } @@ -421,7 +421,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) if (DRB_configList->list.array[i]) { drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(RRC, + LOG_I(DU_F1AP, "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", ctxt.module_id, ctxt.rnti, @@ -542,27 +542,27 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ); switch (rlc_status) { case RLC_OP_STATUS_OK: - LOG_D(PDCP, "Data sending request over RLC succeeded!\n"); + LOG_I(DU_F1AP, "Data sending request over RLC succeeded!\n"); ret=TRUE; break; case RLC_OP_STATUS_BAD_PARAMETER: - LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); ret= FALSE; break; case RLC_OP_STATUS_INTERNAL_ERROR: - LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); ret= FALSE; break; case RLC_OP_STATUS_OUT_OF_RESSOURCES: - LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); ret= FALSE; break; default: - LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + LOG_W(DU_F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); ret= FALSE; break; } // switch case @@ -591,7 +591,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, uint32_t len; - LOG_I(RRC,"[DU %d] Received UL_RRC_MESSAGE_TRANSFER : size %d UE RNTI %x in SRB %d\n", + LOG_I(DU_F1AP,"[DU %d] Received UL_RRC_MESSAGE_TRANSFER : size %d UE RNTI %x in SRB %d\n", ctxt_pP->module_id, sdu_sizeP, rnti, rb_idP); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context( @@ -666,7 +666,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) LOG_E(DU_F1AP," Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); else - LOG_D(RRC, "Received message: present %d and c1 present %d\n", + LOG_I(DU_F1AP, "Received message: present %d and c1 present %d\n", ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1.present); if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) { @@ -688,7 +688,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, break; case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: - LOG_I(RRC,"[MSG] RRC UL rrcConnectionSetupComplete \n"); + LOG_I(DU_F1AP,"[MSG] RRC UL rrcConnectionSetupComplete \n"); if(!ue_context_p){ LOG_E(DU_F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", ctxt_pP->rnti); }else { @@ -698,21 +698,21 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, break; case UL_DCCH_MessageType__c1_PR_securityModeComplete: - LOG_I(RRC,"[MSG] RRC securityModeComplete \n"); + LOG_I(DU_F1AP,"[MSG] RRC securityModeComplete \n"); break; case UL_DCCH_MessageType__c1_PR_securityModeFailure: break; case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - LOG_I(RRC,"[MSG] RRC ueCapabilityInformation \n"); + LOG_I(DU_F1AP,"[MSG] RRC ueCapabilityInformation \n"); break; case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: break; case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: - LOG_I(RRC,"[MSG] RRC UL Information Transfer \n"); + LOG_I(DU_F1AP,"[MSG] RRC UL Information Transfer \n"); break; case UL_DCCH_MessageType__c1_PR_counterCheckResponse: diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index 248c61fcf5..f0624ef4d8 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -33,7 +33,7 @@ #include "f1ap_common.h" #include "f1ap_encoder.h" -int asn1_encoder_xer_print = 1; +int asn1_encoder_xer_print = 0; /* static inline int f1ap_encode_initiating(f1ap_message *message, diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index b94492dcfe..b1c66f156c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5570,6 +5570,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( #endif ); } + // set the SRB active in Ue context if (SRB_configList != NULL) { for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { @@ -5626,7 +5627,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( RADIO_ACCESS_BEARER,Rlc_info_um); */ ue_context_pP->ue_context.DRB_active[drb_id] = 1; - LOG_D(RRC, "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n", ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity); @@ -5710,7 +5710,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( } } else { // remove LCHAN from MAC/PHY - if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { + if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { // DRB has just been removed so remove RLC + PDCP for DRB /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); @@ -6297,7 +6297,9 @@ rrc_eNB_decode_ccch( rrc_eNB_process_RRCConnectionReconfigurationComplete(&ctxt_old_p, ue_context_p, ue_context_p->ue_context.reestablishment_xid); + LOG_E(RRC, "RRRCConnectionReconfigurationComplete: ue_context_p->ue_context.nb_of_e_rabs = %d \n", ue_context_p->ue_context.nb_of_e_rabs); for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + LOG_E(RRC, "RRRCConnectionReconfigurationComplete: ue_context_p->ue_context.e_rab[e_rab].status = %d \n", ue_context_p->ue_context.e_rab[e_rab].status); if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; } else { @@ -6427,6 +6429,7 @@ rrc_eNB_decode_ccch( ctxt_pP->rnti); if (ue_context_p != NULL) { + LOG_D(RRC,"ue_context_p already exist %p %d %x \n", ue_context_p, ctxt_pP->module_id, ctxt_pP->rnti); // erase content rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); @@ -6461,7 +6464,14 @@ rrc_eNB_decode_ccch( ue_context_p->ue_context.ul_failure_timer = 20000; } ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); - ue_context_p->ue_context.Srb0.Active=1; + ue_context_p->ue_context.Srb0.Srb_id=0; + ue_context_p->ue_context.Srb0.Active=1; + memcpy(ue_context_p->ue_context.Srb0.Rx_buffer.Payload, + buffer, + buffer_length); + + ue_context_p->ue_context.Srb0.Rx_buffer.payload_size=buffer_length; + } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { /* Save s-TMSI */ S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; @@ -6542,7 +6552,6 @@ rrc_eNB_decode_ccch( if (ue_context_p != NULL) { - #if defined(ENABLE_ITTI) ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; @@ -6807,9 +6816,9 @@ rrc_eNB_decode_dcch( /*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/ if (EPC_MODE_ENABLED) { if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){ - //dedicated_DRB = 1; + dedicated_DRB = 1; LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (reconfigure default DRB /dedicated DRB, xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); //clear // FIX ME: MAC context does not exist in CU @@ -6847,10 +6856,9 @@ rrc_eNB_decode_dcch( } ue_context_p->ue_context.reestablishment_xid = -1; } else { - //dedicated_DRB = 1; ue_context_p->ue_context.Status = RRC_RECONFIGURED; LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); } } @@ -6911,11 +6919,14 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); } }else if(dedicated_DRB == 0){ - if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){ - LOG_I(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP\n"); - rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, + LOG_D(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP, establishment cause %d\n", + ue_context_p->ue_context.reestablishment_cause ); + // NN: not sure what we need to send S1AP_INITIAL_CONTEXT_SETUP_RESP only with this cause? + //if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){ + rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p); - } else { + // } else + { ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { @@ -7593,6 +7604,8 @@ rrc_enb_task( PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), msg_name_p); + // this part will be done in rrc_eNB_decode_ccch + /* struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[rrc_inst], RRC_MAC_CCCH_DATA_IND(msg_p).rnti); @@ -7604,16 +7617,13 @@ rrc_enb_task( ); } - CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; srb_info_p = &ue_p->Srb0; LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ue_context %p (rnti %x), sib_info_p->Rx_buffer.payload_size %d\n", rrc_inst,CC_id,ue_p, ue_p->rnti,RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); - if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) { - LOG_I(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); - break; - } + + CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; memcpy(srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND(msg_p).sdu, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); @@ -7621,6 +7631,14 @@ rrc_enb_task( srb_info_p->Active = 1; rrc_eNB_decode_ccch(&ctxt, (uint8_t*)srb_info_p->Rx_buffer.Payload,srb_info_p->Rx_buffer.payload_size, CC_id); + */ + if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) { + LOG_W(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); + } + rrc_eNB_decode_ccch(&ctxt, + (uint8_t*)RRC_MAC_CCCH_DATA_IND(msg_p).sdu, + RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size, + RRC_MAC_CCCH_DATA_IND(msg_p).CC_id); break; /* Messages from PDCP */ diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index a631c8df42..c5cf2f2fed 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -983,6 +983,7 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); ue_context_p->ue_context.nb_of_e_rabs = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs; + LOG_E(RRC, "rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ: ue_context_p->ue_context.nb_of_e_rabs = %d \n", ue_context_p->ue_context.nb_of_e_rabs); for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++) { ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.e_rab[i].param = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i]; -- GitLab From 5862a102749f03440bba60162bbe6b004cfb793c Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 17 Oct 2018 16:16:05 +0200 Subject: [PATCH 143/308] Don't spam with some PROTO_AGENT and PDCP messages, correct two other --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 1 - openair2/LAYER2/PROTO_AGENT/proto_agent_async.c | 2 +- openair2/LAYER2/PROTO_AGENT/proto_agent_common.c | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 97acbba612..2f98ee6c7a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -389,7 +389,6 @@ boolean_t pdcp_data_req( LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)pdcp_pdu_p->data,pdcp_pdu_size, "[MSG] PDCP DL %s PDU on rb_id %d\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP); - LOG_F(PDCP,"\n"); #ifndef UETARGET diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index d4386fba7a..080491e5ee 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -70,7 +70,7 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bi error: if (channel) free(channel); - fprintf(stderr, "error creating proto_agent_async_channel_t\n"); + LOG_E(PROTO_AGENT, "error creating proto_agent_async_channel_t\n"); return NULL; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 800592c259..0bfe6ae397 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -443,7 +443,7 @@ int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Proto free(ctxt_pP); if (pdcp_pdu_p) free_mem_block(pdcp_pdu_p, __func__); - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -619,7 +619,7 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto // if (xid == 1) // pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); // else if (xid == 0) // FIXME: USE a preprocessed definition - LOG_I(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP->instance, pdcp_pdu_size,ctxt_pP->rnti,rb_idP); + LOG_D(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP->instance, pdcp_pdu_size,ctxt_pP->rnti,rb_idP); result = pdcp_data_ind(ctxt_pP, srb_flagP, flag_MBMS, -- GitLab From 86fcea8dd59967cca3dc7d500ec055b2ad9563b4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 18 Oct 2018 09:50:16 +0200 Subject: [PATCH 144/308] Call free_mem_block() after sending F1U packet --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index de8af0fb33..38c7c32b52 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -191,6 +191,8 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, if (!msg) goto error; proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info); + + free_mem_block(sdu_pP, __func__); return; error: @@ -229,6 +231,8 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info); + free_mem_block(sdu_pP, __func__); + return; error: -- GitLab From 0a4ffade774981013534f4279b20ac1074f306cb Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 18 Oct 2018 17:05:04 +0200 Subject: [PATCH 145/308] Don't malloc() context_t in F1U, stack is sufficient --- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 54 ++++++++----------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 0bfe6ae397..0efeabf7aa 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -392,7 +392,7 @@ int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Proto rlc_data = data_req->pdcp_data; ctxt = rlc_data->fsp_ctxt; - protocol_ctxt_t *ctxt_pP; + protocol_ctxt_t ctxt_pP; srb_flag_t srb_flagP = 0; rb_id_t rb_idP = 0; mui_t muiP = 0; @@ -402,15 +402,13 @@ int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Proto mem_block_t *pdcp_pdu_p = NULL; // Create a new protocol context for handling the packet - ctxt_pP = malloc(sizeof(protocol_ctxt_t)); - if (!ctxt_pP) goto error; - ctxt_pP->module_id = ctxt->fsp_mod_id; - ctxt_pP->enb_flag = ctxt->fsp_enb_flag; - ctxt_pP->instance = ctxt->fsp_instance; - ctxt_pP->rnti = ctxt->fsp_rnti; - ctxt_pP->frame = ctxt->fsp_frame; - ctxt_pP->subframe = ctxt->fsp_subframe; - ctxt_pP->eNB_index = ctxt->fsp_enb_index; + ctxt_pP.module_id = ctxt->fsp_mod_id; + ctxt_pP.enb_flag = ctxt->fsp_enb_flag; + ctxt_pP.instance = ctxt->fsp_instance; + ctxt_pP.rnti = ctxt->fsp_rnti; + ctxt_pP.frame = ctxt->fsp_frame; + ctxt_pP.subframe = ctxt->fsp_subframe; + ctxt_pP.eNB_index = ctxt->fsp_enb_index; srb_flagP = rlc_data->fsp_srb_flag; flag_MBMS = rlc_data->fsp_mbms_flag; @@ -422,11 +420,11 @@ int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Proto if (!pdcp_pdu_p) goto error; memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); - result = rlc_data_req((const protocol_ctxt_t*) ctxt_pP - ,(const srb_flag_t) srb_flagP - ,(const MBMS_flag_t) flag_MBMS - ,(const rb_id_t) rb_idP - ,(const mui_t) muiP + result = rlc_data_req(&ctxt_pP + ,srb_flagP + ,flag_MBMS + ,rb_idP + ,muiP ,confirmP ,pdcp_pdu_size ,pdcp_pdu_p @@ -439,8 +437,6 @@ int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Proto return result; error: - if (ctxt_pP) - free(ctxt_pP); if (pdcp_pdu_p) free_mem_block(pdcp_pdu_p, __func__); LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); @@ -589,7 +585,7 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto rlc_data = data_ind->rlc_data; ctxt = rlc_data->fsp_ctxt; - protocol_ctxt_t *ctxt_pP; + protocol_ctxt_t ctxt_pP; srb_flag_t srb_flagP = 0; rb_id_t rb_idP = 0; sdu_size_t pdcp_pdu_size = 0; @@ -597,15 +593,13 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto mem_block_t *pdcp_pdu_p = NULL; // Create a new protocol context for handling the packet - ctxt_pP = malloc(sizeof(protocol_ctxt_t)); - if (!ctxt_pP) goto error; - ctxt_pP->module_id = ctxt->fsp_mod_id; - ctxt_pP->enb_flag = ctxt->fsp_enb_flag; - ctxt_pP->instance = ctxt->fsp_instance; - ctxt_pP->rnti = ctxt->fsp_rnti; - ctxt_pP->frame = ctxt->fsp_frame; - ctxt_pP->subframe = ctxt->fsp_subframe; - ctxt_pP->eNB_index = ctxt->fsp_enb_index; + ctxt_pP.module_id = ctxt->fsp_mod_id; + ctxt_pP.enb_flag = ctxt->fsp_enb_flag; + ctxt_pP.instance = ctxt->fsp_instance; + ctxt_pP.rnti = ctxt->fsp_rnti; + ctxt_pP.frame = ctxt->fsp_frame; + ctxt_pP.subframe = ctxt->fsp_subframe; + ctxt_pP.eNB_index = ctxt->fsp_enb_index; srb_flagP = rlc_data->fsp_srb_flag; flag_MBMS = rlc_data->fsp_mbms_flag; @@ -619,8 +613,8 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto // if (xid == 1) // pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); // else if (xid == 0) // FIXME: USE a preprocessed definition - LOG_D(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP->instance, pdcp_pdu_size,ctxt_pP->rnti,rb_idP); - result = pdcp_data_ind(ctxt_pP, + LOG_D(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP.instance, pdcp_pdu_size,ctxt_pP.rnti,rb_idP); + result = pdcp_data_ind(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, @@ -630,8 +624,6 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto return result; error: - if (ctxt_pP) - free(ctxt_pP); if (pdcp_pdu_p) free_mem_block(pdcp_pdu_p, __func__); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); -- GitLab From 5e1f3441995da2310017562c3ce1b75c6e968b8b Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 23 Oct 2018 14:58:19 +0200 Subject: [PATCH 146/308] Add Disconnect protobuf message description in FlexRAN --- openair2/ENB_APP/MESSAGES/V2/flexran.proto | 5 ++++- openair2/ENB_APP/MESSAGES/V2/header.proto | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto index 9255372340..a4e3ed406d 100644 --- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -31,6 +31,7 @@ message flexran_message { flex_agent_reconfiguration agent_reconfiguration_msg = 17; flex_rrc_triggering rrc_triggering = 18; flex_ul_mac_config ul_mac_config_msg = 19; + flex_disconnect disconnect_msg = 20; } } @@ -223,4 +224,6 @@ message flex_echo_reply_latency { } } - +message flex_disconnect { + optional flex_header header = 1; +} diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 8900b93492..c91d2e2c09 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -12,6 +12,7 @@ enum flex_type { FLPT_HELLO = 0; FLPT_ECHO_REQUEST = 1; FLPT_ECHO_REPLY = 2; + FLPT_DISCONNECT = 20; // Statistics and measurement messages FLPT_STATS_REQUEST = 3; -- GitLab From 9d2637557c4161c10cfe1a86f4159c30799ae825 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 23 Oct 2018 14:59:19 +0200 Subject: [PATCH 147/308] Add BS capability protobuf message in FlexRAN --- openair2/ENB_APP/MESSAGES/V2/flexran.proto | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto index a4e3ed406d..b1702f949e 100644 --- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -65,9 +65,21 @@ enum flexran_err { // // Maintenance and discovery messages // +enum flex_bs_capability { + LOPHY = 0; + HIPHY = 1; + LOMAC = 2; + HIMAC = 3; + RLC = 4; + PDCP = 5; + SDAP = 6; + RRC = 7; +} message flex_hello { - optional flex_header header = 1; + optional flex_header header = 1; + optional uint64 bs_id = 2; // Unique id to distinguish the eNB + repeated flex_bs_capability capabilities = 3; } message flex_echo_request { @@ -132,7 +144,6 @@ message flex_enb_config_request { message flex_enb_config_reply { optional flex_header header = 1; - optional uint64 eNB_id = 2; // Unique id to distinguish the eNB repeated flex_cell_config cell_config = 3; optional uint32 device_spec = 4; } -- GitLab From 1114efad1c3484c477731fb02833c3e78b74dc2b Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 23 Oct 2018 17:15:56 +0200 Subject: [PATCH 148/308] Remove capabilities+agent_id from FlexRAN conf/RCconfig_flexran() --- openair2/ENB_APP/enb_config.c | 134 +------------------------- openair2/ENB_APP/flexran_agent_defs.h | 2 - 2 files changed, 3 insertions(+), 133 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index a843ec6033..49ed7f3d26 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -68,109 +68,10 @@ extern uint16_t sf_ahead; void RCconfig_flexran() { - uint16_t i; - uint16_t num_enbs; - char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - /* this will possibly truncate the cell id (RRC assumes int32_t). - * Both Nid_cell and enb_id are signed in RRC case, but we use unsigned for - * the bitshifting to work properly */ - int32_t Nid_cell = 0; - uint16_t Nid_cell_tr = 0; - uint32_t enb_id = 0; - - /* - * the only reason for all these variables is, that they are "hard-encoded" - * into the CCPARAMS_DESC macro and we need it for the Nid_cell variable ... - */ - char *frame_type, *prefix_type, *pbch_repetition, *prach_high_speed, - *pusch_hoppingMode, *pusch_enable64QAM, *pusch_groupHoppingEnabled, - *pusch_sequenceHoppingEnabled, *phich_duration, *phich_resource, - *srs_enable, *srs_ackNackST, *srs_MaxUpPts, *pusch_alpha, - *pucch_deltaF_Format1, *pucch_deltaF_Format1b, *pucch_deltaF_Format2, - *pucch_deltaF_Format2a, *pucch_deltaF_Format2b, - *rach_preamblesGroupAConfig, *rach_messagePowerOffsetGroupB, *pcch_nB; - long long int downlink_frequency; - int32_t tdd_config, tdd_config_s, eutra_band, uplink_frequency_offset, - Nid_cell_mbsfn, N_RB_DL, nb_antenna_ports, prach_root, prach_config_index, - prach_zero_correlation, prach_freq_offset, pucch_delta_shift, - pucch_nRB_CQI, pucch_nCS_AN, pucch_n1_AN, pdsch_referenceSignalPower, - pdsch_p_b, pusch_n_SB, pusch_hoppingOffset, pusch_groupAssignment, - pusch_nDMRS1, srs_BandwidthConfig, srs_SubframeConfig, pusch_p0_Nominal, - pucch_p0_Nominal, msg3_delta_Preamble, rach_numberOfRA_Preambles, - rach_sizeOfRA_PreamblesGroupA, rach_messageSizeGroupA, - rach_powerRampingStep, rach_preambleInitialReceivedTargetPower, - rach_preambleTransMax, rach_raResponseWindowSize, - rach_macContentionResolutionTimer, rach_maxHARQ_Msg3Tx, - pcch_defaultPagingCycle, bcch_modificationPeriodCoeff, - ue_TimersAndConstants_t300, ue_TimersAndConstants_t301, - ue_TimersAndConstants_t310, ue_TimersAndConstants_t311, - ue_TimersAndConstants_n310, ue_TimersAndConstants_n311, - ue_TransmissionMode; - - int32_t ue_multiple_max = 0; - - e_SL_CP_Len_r12 rxPool_sc_CP_Len; - e_SL_PeriodComm_r12 rxPool_sc_Period; - e_SL_CP_Len_r12 rxPool_data_CP_Len; - long rxPool_ResourceConfig_prb_Num; - long rxPool_ResourceConfig_prb_Start; - long rxPool_ResourceConfig_prb_End; - SL_OffsetIndicator_r12_PR rxPool_ResourceConfig_offsetIndicator_present; - long rxPool_ResourceConfig_offsetIndicator_choice; - SubframeBitmapSL_r12_PR rxPool_ResourceConfig_subframeBitmap_present; - char* rxPool_ResourceConfig_subframeBitmap_choice_bs_buf; - long rxPool_ResourceConfig_subframeBitmap_choice_bs_size; - long rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused; - - //SIB19 - //for discRxPool - SL_CP_Len_r12_t discRxPool_cp_Len; - e_SL_DiscResourcePool_r12__discPeriod_r12 discRxPool_discPeriod; - long discRxPool_numRetx; - long discRxPool_numRepetition; - long discRxPool_ResourceConfig_prb_Num; - long discRxPool_ResourceConfig_prb_Start; - long discRxPool_ResourceConfig_prb_End; - SL_OffsetIndicator_r12_PR discRxPool_ResourceConfig_offsetIndicator_present; - long discRxPool_ResourceConfig_offsetIndicator_choice; - SubframeBitmapSL_r12_PR discRxPool_ResourceConfig_subframeBitmap_present; - char* discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf; - long discRxPool_ResourceConfig_subframeBitmap_choice_bs_size; - long discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused; - //for discRxPoolPS - SL_CP_Len_r12_t discRxPoolPS_cp_Len; - e_SL_DiscResourcePool_r12__discPeriod_r12 discRxPoolPS_discPeriod; - long discRxPoolPS_numRetx; - long discRxPoolPS_numRepetition; - long discRxPoolPS_ResourceConfig_prb_Num; - long discRxPoolPS_ResourceConfig_prb_Start; - long discRxPoolPS_ResourceConfig_prb_End; - SL_OffsetIndicator_r12_PR discRxPoolPS_ResourceConfig_offsetIndicator_present; - long discRxPoolPS_ResourceConfig_offsetIndicator_choice; - SubframeBitmapSL_r12_PR discRxPoolPS_ResourceConfig_subframeBitmap_present; - char* discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf; - long discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size; - long discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused; - - - /* get number of eNBs */ paramdef_t ENBSParams[] = ENBSPARAMS_DESC; config_get(ENBSParams, sizeof(ENBSParams)/sizeof(paramdef_t), NULL); - num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; - - /* for eNB ID */ - paramdef_t ENBParams[] = ENBPARAMS_DESC; - paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST, NULL, 0}; - - /* for Nid_cell */ - checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK; - paramdef_t CCsParams[] = CCPARAMS_DESC; - paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS, NULL, 0}; - /* map parameter checking array instances to parameter definition array instances */ - for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) { - CCsParams[I].chkPptr = &(config_check_CCparams[I]); - } + uint16_t num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; paramdef_t flexranParams[] = FLEXRANPARAMS_DESC; config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG); @@ -183,7 +84,7 @@ void RCconfig_flexran() num_enbs, sizeof(flexran_agent_info_t*)); } - for (i = 0; i < num_enbs; i++) { + for (uint16_t i = 0; i < num_enbs; i++) { RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t)); AssertFatal(RC.flexran[i], "can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n", @@ -200,36 +101,7 @@ void RCconfig_flexran() RC.flexran[i]->cache_name = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr)); RC.flexran[i]->node_ctrl_state = strcasecmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION; - config_getlist(&ENBParamList, ENBParams, sizeof(ENBParams)/sizeof(paramdef_t),NULL); - /* eNB ID from configuration, as read in by RCconfig_RRC() */ - if (!ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr) { - // Calculate a default eNB ID - if (EPC_MODE_ENABLED) - enb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8); - else - enb_id = i; - } else { - enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr); - } - - /* cell ID */ - sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i); - config_getlist(&CCsParamList, NULL, 0, aprefix); - if (CCsParamList.numelt > 0) { - sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i, ENB_CONFIG_STRING_COMPONENT_CARRIERS, 0); - config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix); - Nid_cell_tr = (uint16_t) Nid_cell; - } - - RC.flexran[i]->mod_id = i; - RC.flexran[i]->agent_id = (((uint64_t)i) << 48) | (((uint64_t)enb_id) << 16) | ((uint64_t)Nid_cell_tr); - - /* assume for the moment the monolithic case, i.e. agent can provide - * information for all layers */ - RC.flexran[i]->capability_mask = FLEXRAN_CAP_LOPHY | FLEXRAN_CAP_HIPHY - | FLEXRAN_CAP_LOMAC | FLEXRAN_CAP_HIMAC - | FLEXRAN_CAP_RLC | FLEXRAN_CAP_PDCP - | FLEXRAN_CAP_SDAP | FLEXRAN_CAP_RRC; + RC.flexran[i]->mod_id = i; } } diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h index 57265b38b7..98b2505e84 100644 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -162,8 +162,6 @@ typedef struct { char *cache_name; mid_t mod_id; - uint64_t agent_id; - uint8_t capability_mask; /* lock for waiting before starting or soft-restart */ pthread_cond_t cond_node_ctrl; -- GitLab From eb577d11dd93a70f1e2dc999110260705f20cdfb Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 23 Oct 2018 17:49:41 +0200 Subject: [PATCH 149/308] Remove warnings in enb_config.c and rrc_eNB.c --- openair2/ENB_APP/enb_config.c | 9 ++++++--- openair2/RRC/LTE/rrc_eNB.c | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 49ed7f3d26..08a4d29986 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2137,7 +2137,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { F1AP_SETUP_REQ (msg_p).num_cells_available++; F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); - LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); + LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr)); LOG_I(ENB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name); @@ -2160,7 +2160,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); F1AP_SETUP_REQ (msg_p).nr_cellid[k] = (uint64_t)*(ENBParamList.paramarray[i][ENB_NRCELLID_IDX].u64ptr); - LOG_I(ENB_APP,"F1AP: nr_cellid[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).nr_cellid[k]); + LOG_I(ENB_APP,"F1AP: nr_cellid[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).nr_cellid[k]); LOG_I(ENB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.mac[k]->eth_params_n.remote_addr); LOG_I(ENB_APP,"FIAP: CU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.remote_addr)); @@ -2770,6 +2770,9 @@ void extract_and_decode_SI(int inst,int si_ind,uint8_t *si_container,int si_cont } break; } + case BCCH_DL_SCH_MessageType__c1_PR_NOTHING: + AssertFatal(0, "Should have received SIB1 from CU\n"); + break; } } @@ -2842,7 +2845,7 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { for (i=0;i<RC.nb_inst;i++) { rrc_eNB_carrier_data_t *carrier = &RC.rrc[i]->carrier[0]; // identify local index of cell j by nr_cellid, plmn identity and physical cell ID - printf("Checking cell %d, rrc inst %d : rrc->nr_cellid %x, resp->nr_cellid %x\n", + printf("Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n", j,i,RC.rrc[i]->nr_cellid,resp->nr_cellid[j]); if (RC.rrc[i]->nr_cellid == resp->nr_cellid[j] && (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index b1c66f156c..e173713560 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6919,7 +6919,7 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); } }else if(dedicated_DRB == 0){ - LOG_D(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP, establishment cause %d\n", + LOG_D(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP, establishment cause %ld\n", ue_context_p->ue_context.reestablishment_cause ); // NN: not sure what we need to send S1AP_INITIAL_CONTEXT_SETUP_RESP only with this cause? //if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){ @@ -7560,8 +7560,6 @@ rrc_enb_task( instance_t instance; int rrc_inst; int result; - SRB_INFO *srb_info_p; - int CC_id; protocol_ctxt_t ctxt; -- GitLab From 608a14591e0da1f988035c24860a25425550295f Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 23 Oct 2018 17:52:32 +0200 Subject: [PATCH 150/308] Add BS ID and Capabilities to FlexRAN Hello Msg * Hello msg agent->RTC carries ID and capabilities this agent supports * RAN API provides ID and capabilities: - flexran_get_bs_id() - flexran_get_capabilities() // protobuf list of capabilities - flexran_get_capabilities() // capabilities as bit mask Add FlexRAN capabilities mask RAN API function --- openair2/ENB_APP/flexran_agent_common.c | 7 +- openair2/ENB_APP/flexran_agent_ran_api.c | 91 ++++++++++++++++++++++++ openair2/ENB_APP/flexran_agent_ran_api.h | 13 ++++ 3 files changed, 108 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index db1943c945..bffe145c92 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -120,6 +120,9 @@ int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessa goto error; hello_msg->header = header; + hello_msg->bs_id = flexran_get_bs_id(mod_id); + hello_msg->has_bs_id = 1; + hello_msg->n_capabilities = flexran_get_capabilities(mod_id, &hello_msg->capabilities); *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) @@ -150,6 +153,7 @@ int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) { goto error; free(msg->hello_msg->header); + free(msg->hello_msg->capabilities); free(msg->hello_msg); free(msg); return 0; @@ -816,9 +820,6 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F enb_config_reply_msg->header = header; - enb_config_reply_msg->enb_id = RC.flexran[mod_id]->agent_id; - enb_config_reply_msg->has_enb_id = 1; - enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; Protocol__FlexCellConfig **cell_conf; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index e39d676061..97e91dcfa8 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -1393,3 +1393,94 @@ float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id) if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult) return 0; return RSRQ_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult)]; } + +uint64_t flexran_get_bs_id(mid_t mod_id) +{ + if (!rrc_is_present(mod_id)) return 0; + return RC.rrc[mod_id]->nr_cellid; +} + +size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps) +{ + if (!caps) return 0; + if (!rrc_is_present(mod_id)) return 0; + size_t n_caps = 0; + switch (RC.rrc[mod_id]->node_type) { + case ngran_eNB_CU: + case ngran_ng_eNB_CU: + case ngran_gNB_CU: + n_caps = 3; + *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); + AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", + n_caps * sizeof(Protocol__FlexBsCapability)); + (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__PDCP; + (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__SDAP; + (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__RRC; + break; + case ngran_eNB_DU: + case ngran_gNB_DU: + n_caps = 5; + *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); + AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", + n_caps * sizeof(Protocol__FlexBsCapability)); + (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__LOPHY; + (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__HIPHY; + (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__LOMAC; + (*caps)[3] = PROTOCOL__FLEX_BS_CAPABILITY__HIMAC; + (*caps)[4] = PROTOCOL__FLEX_BS_CAPABILITY__RLC; + break; + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: + n_caps = 8; + *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); + AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", + n_caps * sizeof(Protocol__FlexBsCapability)); + (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__LOPHY; + (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__HIPHY; + (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__LOMAC; + (*caps)[3] = PROTOCOL__FLEX_BS_CAPABILITY__HIMAC; + (*caps)[4] = PROTOCOL__FLEX_BS_CAPABILITY__RLC; + (*caps)[5] = PROTOCOL__FLEX_BS_CAPABILITY__PDCP; + (*caps)[6] = PROTOCOL__FLEX_BS_CAPABILITY__SDAP; + (*caps)[7] = PROTOCOL__FLEX_BS_CAPABILITY__RRC; + break; + } + return n_caps; +} + +uint16_t flexran_get_capabilities_mask(mid_t mod_id) +{ + if (!rrc_is_present(mod_id)) return 0; + uint16_t mask = 0; + switch (RC.rrc[mod_id]->node_type) { + case ngran_eNB_CU: + case ngran_ng_eNB_CU: + case ngran_gNB_CU: + mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC); + break; + case ngran_eNB_DU: + case ngran_gNB_DU: + mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC); + break; + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: + mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC); + break; + } + return mask; +} diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index dacca55ab7..8fbff216d3 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -504,3 +504,16 @@ int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, mid_t ue_id, int cell_id); */ /*Get MNC PLMN identity neighbouring Cell*/ /* currently not implemented int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, mid_t ue_id, int cell_id); */ + +/********************* general information *****************/ +/* get an ID for this BS (or part of a BS) */ +uint64_t flexran_get_bs_id(mid_t mod_id); + +/* get the capabilities supported by the underlying network function, + * returns the number and stores list of this length in caps. If there are zero + * capabilities, *caps will be NULL */ +size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps); + +/* get the capabilities supported by the underlying network function as a bit + * mask. */ +uint16_t flexran_get_capabilities_mask(mid_t mod_id); -- GitLab From 33d0ac4982df431a7d4809d03aff01642d41bbb7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 10:17:39 +0200 Subject: [PATCH 151/308] Simplify MAC FlexRAN agent interface --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 34 +++++++++++-------- .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 6 ++-- .../MAC/flexran_agent_mac_internal.c | 16 ++++----- openair2/ENB_APP/flexran_agent.c | 16 +++------ .../ENB_APP/flexran_agent_common_internal.c | 2 +- openair2/ENB_APP/flexran_agent_extern.h | 5 +-- openair2/ENB_APP/flexran_agent_handler.c | 1 - openair2/RRC/LTE/rrc_eNB.c | 3 +- 8 files changed, 39 insertions(+), 44 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 549c7eaa22..682105d097 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -40,9 +40,6 @@ #include "common/utils/LOG/log.h" -/*Flags showing if a mac agent has already been registered*/ -unsigned int mac_agent_registered[NUM_MAX_ENB]; - /*Array containing the Agent-MAC interfaces*/ AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; @@ -1336,11 +1333,17 @@ void flexran_agent_send_sf_trigger(mid_t mod_id) { -int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { - if (mac_agent_registered[mod_id]) { +int flexran_agent_register_mac_xface(mid_t mod_id) +{ + if (agent_mac_xface[mod_id]) { LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); return -1; } + AGENT_MAC_xface *xface = malloc(sizeof(AGENT_MAC_xface)); + if (!xface) { + LOG_E(FLEXRAN_AGENT, "could not allocate memory for MAC agent xface %d\n", mod_id); + return -1; + } //xface->agent_ctxt = &shared_ctxt[mod_id]; xface->flexran_agent_send_sr_info = flexran_agent_send_sr_info; @@ -1350,14 +1353,18 @@ int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->dl_scheduler_loaded_lib = NULL; xface->ul_scheduler_loaded_lib = NULL; - mac_agent_registered[mod_id] = 1; agent_mac_xface[mod_id] = xface; return 0; } -int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { - +int flexran_agent_unregister_mac_xface(mid_t mod_id) +{ + if (!agent_mac_xface[mod_id]) { + LOG_E(FLEXRAN_AGENT, "MAC agent CM for eNB %d is not registered\n", mod_id); + return -1; + } + AGENT_MAC_xface *xface = agent_mac_xface[mod_id]; //xface->agent_ctxt = NULL; xface->flexran_agent_send_sr_info = NULL; xface->flexran_agent_send_sf_trigger = NULL; @@ -1366,14 +1373,13 @@ int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->dl_scheduler_loaded_lib = NULL; xface->ul_scheduler_loaded_lib = NULL; - mac_agent_registered[mod_id] = 0; + free(xface); agent_mac_xface[mod_id] = NULL; return 0; } - - - - - +AGENT_MAC_xface *flexran_agent_get_mac_xface(mid_t mod_id) +{ + return agent_mac_xface[mod_id]; +} diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h index 03e7def95e..cabd6f949b 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -36,6 +36,8 @@ #include "flexran_agent_common.h" #include "flexran_agent_extern.h" +// for flexran_agent_get_mac_xface() +#include "flexran_agent_extern.h" /* Initialization function for the agent structures etc */ @@ -82,9 +84,9 @@ void flexran_agent_send_update_mac_stats(mid_t mod_id); void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); /*Register technology specific interface callbacks*/ -int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); +int flexran_agent_register_mac_xface(mid_t mod_id); /*Unregister technology specific callbacks*/ -int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface); +int flexran_agent_unregister_mac_xface(mid_t mod_id); #endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index 2acee0686f..4e79d4c7ef 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -781,9 +781,9 @@ int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) { goto error; } // Check what key needs to be set - if (mac_agent_registered[mod_id]) { + if (flexran_agent_get_mac_xface(mod_id)) { LOG_D(ENB_APP, "Setting parameter %s\n", event.data.scalar.value); - param = dlsym(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib, + param = dlsym(flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib, (char *) event.data.scalar.value); if (param == NULL) { goto error; @@ -836,9 +836,9 @@ int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) { goto error; } // Check what key needs to be set - if (mac_agent_registered[mod_id]) { + if (flexran_agent_get_mac_xface(mod_id)) { LOG_D(ENB_APP, "Setting parameter %s\n", event.data.scalar.value); - param = dlsym(agent_mac_xface[mod_id]->ul_scheduler_loaded_lib, + param = dlsym(flexran_agent_get_mac_xface(mod_id)->ul_scheduler_loaded_lib, (char *) event.data.scalar.value); if (param == NULL) { goto error; @@ -882,11 +882,11 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { LOG_I(FLEXRAN_AGENT, "Loading function: %s\n", function_name); void *loaded_scheduler = dlsym(lib, function_name); if (loaded_scheduler) { - if (mac_agent_registered[mod_id]) { - if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) { - dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); + if (flexran_agent_get_mac_xface(mod_id)) { + if (flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib != NULL) { + dlclose(flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib); } - agent_mac_xface[mod_id]->dl_scheduler_loaded_lib = lib; + flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib = lib; LOG_I(FLEXRAN_AGENT, "New DL UE scheduler: %s\n", function_name); } } else { diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index 9c0af82e90..d7c7785e51 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -230,14 +230,11 @@ int flexran_agent_start(mid_t mod_id) new_thread(receive_thread, flexran); - /*Initialize and register the mac xface. Must be modified later - *for more flexibility in agent management */ + /* Register and initialize the control modules */ + flexran_agent_register_mac_xface(mod_id); + flexran_agent_init_mac_agent(mod_id); - AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface)); - flexran_agent_register_mac_xface(mod_id, mac_agent_xface); - - AGENT_RRC_xface *rrc_agent_xface = (AGENT_RRC_xface *) malloc(sizeof(AGENT_RRC_xface)); - flexran_agent_register_rrc_xface(mod_id, rrc_agent_xface); + flexran_agent_register_rrc_xface(mod_id); AGENT_PDCP_xface *pdcp_agent_xface = (AGENT_PDCP_xface *) malloc(sizeof(AGENT_PDCP_xface)); flexran_agent_register_pdcp_xface(mod_id, pdcp_agent_xface); @@ -248,11 +245,6 @@ int flexran_agent_start(mid_t mod_id) flexran_agent_init_timer(); - /* - * Initialize the mac agent - */ - flexran_agent_init_mac_agent(mod_id); - /* * start the enb agent task for tx and interaction with the underlying network function */ diff --git a/openair2/ENB_APP/flexran_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c index 8874a0f648..f5310dd28c 100644 --- a/openair2/ENB_APP/flexran_agent_common_internal.c +++ b/openair2/ENB_APP/flexran_agent_common_internal.c @@ -209,7 +209,7 @@ int parse_enb_id(mid_t mod_id, yaml_parser_t *parser) { } // Check what key needs to be set // use eNB egistered - if (mac_agent_registered[mod_id]) { + if (flexran_agent_get_mac_xface(mod_id)) { LOG_I(ENB_APP, "Setting parameter for eNB %s\n", event.data.scalar.value); if (strcmp((char *) event.data.scalar.tag, YAML_INT_TAG) == 0) { // if int if ((strtol((char *) event.data.scalar.value, &endptr, 10))== mod_id ) { // enb_id == mod_id: right enb instance to be configured diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h index ae77e9227a..20b0d6500a 100644 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -36,10 +36,7 @@ #include "flexran_agent_pdcp_defs.h" /* Control module interface for the communication of the MAC Control Module with the agent */ -extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; - -/* Flag indicating whether the VSFs for the MAC control module have been registered */ -extern unsigned int mac_agent_registered[NUM_MAX_ENB]; +AGENT_MAC_xface *flexran_agent_get_mac_xface(mid_t mod_id); /* Control module interface for the communication of the RRC Control Module with the agent */ extern AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 66123fd71c..f7a25e1ca4 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -769,6 +769,5 @@ err_code_t flexran_agent_destroy_cont_stats_update(mid_t mod_id) { flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply); free(stats_context[mod_id].mutex); - // mac_agent_registered[mod_id] = 0; return 1; } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index e173713560..8f89c65834 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7022,8 +7022,7 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[ctxt_pP->module_id]) { + if (rrc_agent_registered[ctxt_pP->module_id]) { agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); -- GitLab From 5e0088fa524563531453f72c2f489492437204e4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 11:25:08 +0200 Subject: [PATCH 152/308] Simplify RRC FlexRAN agent interface --- .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 35 ++++++++++++------- .../CONTROL_MODULES/RRC/flexran_agent_rrc.h | 9 +++-- openair2/ENB_APP/flexran_agent_extern.h | 5 +-- openair2/LAYER2/MAC/eNB_scheduler.c | 4 +-- openair2/RRC/LTE/L2_interface.c | 7 ++-- openair2/RRC/LTE/rrc_eNB.c | 20 +++++------ 6 files changed, 43 insertions(+), 37 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index b4bf029373..c485410b35 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -36,9 +36,6 @@ /*Trigger boolean for RRC measurement*/ bool triggered_rrc = false; -/*Flags showing if an rrc agent has already been registered*/ -unsigned int rrc_agent_registered[NUM_MAX_ENB]; - /*Array containing the Agent-RRC interfaces*/ AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; @@ -643,9 +640,15 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, } -int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) { - if (rrc_agent_registered[mod_id]) { - LOG_E(RRC, "RRC agent for eNB %d is already registered\n", mod_id); +int flexran_agent_register_rrc_xface(mid_t mod_id) +{ + if (agent_rrc_xface[mod_id]) { + LOG_E(FLEXRAN_AGENT, "RRC agent for eNB %d is already registered\n", mod_id); + return -1; + } + AGENT_RRC_xface *xface = malloc(sizeof(AGENT_RRC_xface)); + if (!xface) { + LOG_E(FLEXRAN_AGENT, "could not allocate memory for RRC agent xface %d\n", mod_id); return -1; } @@ -654,21 +657,29 @@ int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) { xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change; xface->flexran_trigger_rrc_measurements = flexran_trigger_rrc_measurements; - rrc_agent_registered[mod_id] = 1; agent_rrc_xface[mod_id] = xface; return 0; } -int flexran_agent_unregister_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) { - +int flexran_agent_unregister_rrc_xface(mid_t mod_id) +{ + if (!agent_rrc_xface[mod_id]) { + LOG_E(FLEXRAN_AGENT, "RRC agent for eNB %d is not registered\n", mod_id); + return -1; + } //xface->agent_ctxt = NULL; // xface->flexran_agent_send_update_rrc_stats = NULL; - xface->flexran_agent_notify_ue_state_change = NULL; - xface->flexran_trigger_rrc_measurements = NULL; - rrc_agent_registered[mod_id] = 0; + agent_rrc_xface[mod_id]->flexran_agent_notify_ue_state_change = NULL; + agent_rrc_xface[mod_id]->flexran_trigger_rrc_measurements = NULL; + free(agent_rrc_xface[mod_id]); agent_rrc_xface[mod_id] = NULL; return 0; } + +AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id) +{ + return agent_rrc_xface[mod_id]; +} diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h index 780976893e..d1a0c8f423 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h @@ -37,11 +37,10 @@ #include "flexran_agent_common.h" #include "flexran_agent_rrc_defs.h" +// for flexran_agent_get_rrc_xface() +#include "flexran_agent_extern.h" -/* Initialization function for the agent structures etc */ -void flexran_agent_init_rrc_agent(mid_t mod_id); - /* UE state change message constructor and destructor */ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); @@ -62,9 +61,9 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_co int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexranMessage *msg); /*Register technology specific interface callbacks*/ -int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface); +int flexran_agent_register_rrc_xface(mid_t mod_id); /*Unregister technology specific callbacks*/ -int flexran_agent_unregister_rrc_xface(mid_t mod_id, AGENT_RRC_xface*xface); +int flexran_agent_unregister_rrc_xface(mid_t mod_id); #endif diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h index 20b0d6500a..bc5b64a311 100644 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -39,10 +39,7 @@ AGENT_MAC_xface *flexran_agent_get_mac_xface(mid_t mod_id); /* Control module interface for the communication of the RRC Control Module with the agent */ -extern AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; - -/* Flag indicating whether the VSFs for the RRC control module have been registered */ -extern unsigned int rrc_agent_registered[NUM_MAX_ENB]; +AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id); /* Control module interface for the communication of the RRC Control Module with the agent */ extern AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index a2988f26d8..5461bf66aa 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -416,9 +416,9 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id, UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1; //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future - if (rrc_agent_registered[module_idP]) { + if (flexran_agent_get_rrc_xface(module_idP)) { LOG_W(MAC, "notify flexran Agent of UE state change\n"); - agent_rrc_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP, + flexran_agent_get_rrc_xface(module_idP)->flexran_agent_notify_ue_state_change(module_idP, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } } diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 27712073b9..93cd84b700 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -386,10 +386,9 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, else { LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); } - if (rrc_agent_registered[Mod_instP]) { - agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP, - rntiP, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + if (flexran_agent_get_rrc_xface(Mod_instP)) { + flexran_agent_get_rrc_xface(Mod_instP)->flexran_agent_notify_ue_state_change(Mod_instP, + rntiP, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } rrc_mac_remove_ue(Mod_instP,rntiP); } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 8f89c65834..343b398c9e 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1038,8 +1038,8 @@ void release_UE_in_freeList(module_id_t mod_id) } } - if (rrc_agent_registered[mod_id]) { - agent_rrc_xface[mod_id]->flexran_agent_notify_ue_state_change(mod_id, + if (flexran_agent_get_rrc_xface(mod_id)) { + flexran_agent_get_rrc_xface(mod_id)->flexran_agent_notify_ue_state_change(mod_id, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } @@ -6578,8 +6578,8 @@ rrc_eNB_decode_ccch( } else { // no context available - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) { + flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ctxt_pP->rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } @@ -6869,8 +6869,8 @@ rrc_eNB_decode_dcch( ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) { + flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); } @@ -7022,8 +7022,8 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) { + flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); } @@ -7090,8 +7090,8 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); } //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) { + flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); } -- GitLab From 391320b99245d8e71ab8af097f540e63659111ef Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 11:35:12 +0200 Subject: [PATCH 153/308] Simplify PDCP FlexRAN agent interface --- .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.c | 35 +++++++++++-------- .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.h | 6 ++-- openair2/ENB_APP/flexran_agent.c | 3 +- openair2/ENB_APP/flexran_agent_extern.h | 5 +-- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c index b2723f7181..34f3f414cc 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c @@ -28,12 +28,6 @@ #include "flexran_agent_pdcp.h" - -/*Trigger boolean for PDCP measurement*/ -bool triggered_pdcp = false; -/*Flags showing if a pdcp agent has already been registered*/ -unsigned int pdcp_agent_registered[NUM_MAX_ENB]; - /*Array containing the Agent-PDCP interfaces*/ AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB]; @@ -144,28 +138,41 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, -int flexran_agent_register_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface) { - if (pdcp_agent_registered[mod_id]) { - LOG_E(PDCP, "PDCP agent for eNB %d is already registered\n", mod_id); +int flexran_agent_register_pdcp_xface(mid_t mod_id) +{ + if (agent_pdcp_xface[mod_id]) { + LOG_E(FLEXRAN_AGENT, "PDCP agent CM for eNB %d is already registered\n", mod_id); + return -1; + } + AGENT_PDCP_xface *xface = malloc(sizeof(AGENT_PDCP_xface)); + if (!xface) { + LOG_E(FLEXRAN_AGENT, "could not allocate memory for PDCP agent xface %d\n", mod_id); return -1; } //xface->flexran_pdcp_stats_measurement = NULL; - pdcp_agent_registered[mod_id] = 1; agent_pdcp_xface[mod_id] = xface; return 0; } -int flexran_agent_unregister_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface) { - +int flexran_agent_unregister_pdcp_xface(mid_t mod_id) +{ + if (!agent_pdcp_xface[mod_id]) { + LOG_E(FLEXRAN_AGENT, "PDCP agent CM for eNB %d is not registered\n", mod_id); + return -1; + } //xface->agent_ctxt = NULL; //xface->flexran_pdcp_stats_measurement = NULL; - - pdcp_agent_registered[mod_id] = 0; + free(agent_pdcp_xface[mod_id]); agent_pdcp_xface[mod_id] = NULL; return 0; } + +AGENT_PDCP_xface *flexran_agent_get_pdcp_xface(mid_t mod_id) +{ + return agent_pdcp_xface[mod_id]; +} diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h index 83aac45406..be952326e8 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h @@ -39,6 +39,8 @@ #include "flexran_agent_defs.h" #include "flexran_agent_pdcp_defs.h" #include "flexran_agent_ran_api.h" +// for flexran_agent_get_pdcp_xface() +#include "flexran_agent_extern.h" /********************************** * FlexRAN agent - technology PDCP API @@ -56,9 +58,9 @@ void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id, Protocol__FlexPdcpStats *pdcp_aggr_stats); /*Register technology specific interface callbacks*/ -int flexran_agent_register_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface); +int flexran_agent_register_pdcp_xface(mid_t mod_id); /*Unregister technology specific callbacks*/ -int flexran_agent_unregister_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface*xface); +int flexran_agent_unregister_pdcp_xface(mid_t mod_id); #endif diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index d7c7785e51..30f2e27895 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -236,8 +236,7 @@ int flexran_agent_start(mid_t mod_id) flexran_agent_register_rrc_xface(mod_id); - AGENT_PDCP_xface *pdcp_agent_xface = (AGENT_PDCP_xface *) malloc(sizeof(AGENT_PDCP_xface)); - flexran_agent_register_pdcp_xface(mod_id, pdcp_agent_xface); + flexran_agent_register_pdcp_xface(mod_id); /* * initilize a timer diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h index bc5b64a311..f80532be93 100644 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -42,10 +42,7 @@ AGENT_MAC_xface *flexran_agent_get_mac_xface(mid_t mod_id); AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id); /* Control module interface for the communication of the RRC Control Module with the agent */ -extern AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB]; - -/* Flag indicating whether the VSFs for the RRC control module have been registered */ -extern unsigned int pdcp_agent_registered[NUM_MAX_ENB]; +AGENT_PDCP_xface *flexran_agent_get_pdcp_xface(mid_t mod_id); /* Requried to know which UEs had a harq updated over some subframe */ extern int harq_pid_updated[NUM_MAX_UE][8]; -- GitLab From c81535a8b08c8adaa78e5689acb6ee58f825485d Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 14:33:48 +0200 Subject: [PATCH 154/308] Add FlexRAN PHY CM --- cmake_targets/CMakeLists.txt | 2 + .../CONTROL_MODULES/PHY/flexran_agent_phy.c | 63 +++++++++++++++++++ .../CONTROL_MODULES/PHY/flexran_agent_phy.h | 54 ++++++++++++++++ .../PHY/flexran_agent_phy_defs.h | 35 +++++++++++ openair2/ENB_APP/flexran_agent.c | 2 + openair2/ENB_APP/flexran_agent.h | 1 + openair2/ENB_APP/flexran_agent_extern.h | 4 ++ 7 files changed, 161 insertions(+) create mode 100644 openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c create mode 100644 openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h create mode 100644 openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy_defs.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 7ad42079de..7f420e337b 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -825,6 +825,7 @@ include_directories("${OPENAIR_DIR}/targets/COMMON") include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") +include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PHY") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP") @@ -916,6 +917,7 @@ add_library(FLEXRAN_AGENT ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_timer.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c diff --git a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c new file mode 100644 index 0000000000..745659c949 --- /dev/null +++ b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c @@ -0,0 +1,63 @@ +/* + * 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 flexran_agent_phy.c + * \brief FlexRAN agent Control Module PHY + * \author Robert Schmidt + * \date Oct 2018 + */ + +#include "flexran_agent_phy.h" + +/* Array containing the Agent-PHY interfaces */ +AGENT_PHY_xface *agent_phy_xface[NUM_MAX_ENB]; + +int flexran_agent_register_phy_xface(mid_t mod_id) +{ + if (agent_phy_xface[mod_id]) { + LOG_E(PHY, "PHY agent for eNB %d is already registered\n", mod_id); + return -1; + } + AGENT_PHY_xface *xface = malloc(sizeof(AGENT_PHY_xface)); + if (!xface) { + LOG_E(FLEXRAN_AGENT, "could not allocate memory for PHY agent xface %d\n", mod_id); + return -1; + } + + agent_phy_xface[mod_id] = xface; + return 0; +} + +int flexran_agent_unregister_phy_xface(mid_t mod_id) +{ + if (!agent_phy_xface[mod_id]) { + LOG_E(FLEXRAN_AGENT, "PHY agent for eNB %d is not registered\n", mod_id); + return -1; + } + free(agent_phy_xface[mod_id]); + agent_phy_xface[mod_id] = NULL; + return 0; +} + +AGENT_PHY_xface *flexran_agent_get_phy_xface(mid_t mod_id) +{ + return agent_phy_xface[mod_id]; +} diff --git a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h new file mode 100644 index 0000000000..26a658a943 --- /dev/null +++ b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h @@ -0,0 +1,54 @@ +/* + * 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 flexran_agent_phy.h + * \brief FlexRAN agent Control Module PHY header + * \author Robert Schmidt + * \date Oct 2018 + */ + +#ifndef FLEXRAN_AGENT_PHY_H_ +#define FLEXRAN_AGENT_PHY_H_ + +#include "header.pb-c.h" +#include "flexran.pb-c.h" +#include "stats_messages.pb-c.h" +#include "stats_common.pb-c.h" + + +#include "flexran_agent_common.h" +#include "flexran_agent_defs.h" +#include "flexran_agent_phy_defs.h" +#include "flexran_agent_ran_api.h" +// for flexran_agent_get_phy_xface() +#include "flexran_agent_extern.h" + +/********************************** + * FlexRAN agent - technology PHY API + **********************************/ + +/* Register technology specific interface callbacks */ +int flexran_agent_register_phy_xface(mid_t mod_id); + +/* Unregister technology specific callbacks */ +int flexran_agent_unregister_phy_xface(mid_t mod_id); + +#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy_defs.h b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy_defs.h new file mode 100644 index 0000000000..06c262ef7f --- /dev/null +++ b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy_defs.h @@ -0,0 +1,35 @@ +/* + * 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 + */ +#ifndef __FLEXRAN_AGENT_PHY_PRIMITIVES_H__ +#define __FLEXRAN_AGENT_PHY_PRIMITIVES_H__ + +#include "flexran_agent_defs.h" +#include "flexran.pb-c.h" +#include "header.pb-c.h" + +/* FLEXRAN AGENT-PHY Interface */ +typedef struct { + + /* currently empty, will be used to control RU */ + +} AGENT_PHY_xface; + +#endif /* __FLEXRAN_AGENT_PHY_PRIMITIVES_H__ */ diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index 30f2e27895..bd353fdd2c 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -231,6 +231,8 @@ int flexran_agent_start(mid_t mod_id) new_thread(receive_thread, flexran); /* Register and initialize the control modules */ + flexran_agent_register_phy_xface(mod_id); + flexran_agent_register_mac_xface(mod_id); flexran_agent_init_mac_agent(mod_id); diff --git a/openair2/ENB_APP/flexran_agent.h b/openair2/ENB_APP/flexran_agent.h index 4ce727ff1c..e50a2be4f6 100644 --- a/openair2/ENB_APP/flexran_agent.h +++ b/openair2/ENB_APP/flexran_agent.h @@ -36,6 +36,7 @@ #include "flexran_agent_defs.h" #include "flexran_agent_net_comm.h" #include "flexran_agent_ran_api.h" +#include "flexran_agent_phy.h" #include "flexran_agent_mac.h" #include "flexran_agent_rrc.h" #include "flexran_agent_pdcp.h" diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h index f80532be93..e1dec8506c 100644 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -31,10 +31,14 @@ #define __FLEXRAN_AGENT_EXTERN_H__ #include "flexran_agent_defs.h" +#include "flexran_agent_phy_defs.h" #include "flexran_agent_mac_defs.h" #include "flexran_agent_rrc_defs.h" #include "flexran_agent_pdcp_defs.h" +/* Control module interface for the communication of the PHY control module with the agent */ +AGENT_PHY_xface *flexran_agent_get_phy_xface(mid_t mod_id); + /* Control module interface for the communication of the MAC Control Module with the agent */ AGENT_MAC_xface *flexran_agent_get_mac_xface(mid_t mod_id); -- GitLab From e8af3bd464b6dde9c5a0f0815b3d48d5d715704c Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 17:37:04 +0200 Subject: [PATCH 155/308] Selectively load FlexRAN CMs depending on BS capability --- openair2/ENB_APP/flexran_agent.c | 38 ++++++++++++++++++++++----- openair2/ENB_APP/flexran_agent_defs.h | 16 +++++------ 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index bd353fdd2c..c2a1790380 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -230,15 +230,41 @@ int flexran_agent_start(mid_t mod_id) new_thread(receive_thread, flexran); - /* Register and initialize the control modules */ - flexran_agent_register_phy_xface(mod_id); + /* Register and initialize the control modules depending on capabilities. + * After registering, calling flexran_agent_get_*_xface() tells whether a + * control module is operational */ + uint16_t caps = flexran_get_capabilities_mask(mod_id); + LOG_I(FLEXRAN_AGENT, "Agent handles BS ID %ld, capabilities=0x%x => handling%s%s%s%s%s%s%s%s\n", + flexran_get_bs_id(mod_id), caps, + FLEXRAN_CAP_LOPHY(caps) ? " LOPHY" : "", + FLEXRAN_CAP_HIPHY(caps) ? " HIPHY" : "", + FLEXRAN_CAP_LOMAC(caps) ? " LOMAC" : "", + FLEXRAN_CAP_HIMAC(caps) ? " HIMAC" : "", + FLEXRAN_CAP_RLC(caps) ? " RLC" : "", + FLEXRAN_CAP_PDCP(caps) ? " PDCP" : "", + FLEXRAN_CAP_SDAP(caps) ? " SDAP" : "", + FLEXRAN_CAP_RRC(caps) ? " RRC" : ""); + + if (FLEXRAN_CAP_LOPHY(caps) || FLEXRAN_CAP_HIPHY(caps)) { + flexran_agent_register_phy_xface(mod_id); + LOG_I(FLEXRAN_AGENT, "registered PHY interface/CM for eNB %d\n", mod_id); + } - flexran_agent_register_mac_xface(mod_id); - flexran_agent_init_mac_agent(mod_id); + if (FLEXRAN_CAP_LOMAC(caps) || FLEXRAN_CAP_HIMAC(caps)) { + flexran_agent_register_mac_xface(mod_id); + flexran_agent_init_mac_agent(mod_id); + LOG_I(FLEXRAN_AGENT, "registered MAC interface/CM for eNB %d\n", mod_id); + } - flexran_agent_register_rrc_xface(mod_id); + if (FLEXRAN_CAP_RRC(caps)) { + flexran_agent_register_rrc_xface(mod_id); + LOG_I(FLEXRAN_AGENT, "registered RRC interface/CM for eNB %d\n", mod_id); + } - flexran_agent_register_pdcp_xface(mod_id); + if (FLEXRAN_CAP_PDCP(caps)) { + flexran_agent_register_pdcp_xface(mod_id); + LOG_I(FLEXRAN_AGENT, "registered PDCP interface/CM for eNB %d\n", mod_id); + } /* * initilize a timer diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h index 98b2505e84..b97e56092d 100644 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -138,14 +138,14 @@ typedef enum { FLEXRAN_AGENT_TIMER_STATE_MAX, } flexran_agent_timer_state_t; -#define FLEXRAN_CAP_LOPHY 1 -#define FLEXRAN_CAP_HIPHY 2 -#define FLEXRAN_CAP_LOMAC 4 -#define FLEXRAN_CAP_HIMAC 8 -#define FLEXRAN_CAP_RLC 16 -#define FLEXRAN_CAP_PDCP 32 -#define FLEXRAN_CAP_SDAP 64 -#define FLEXRAN_CAP_RRC 128 +#define FLEXRAN_CAP_LOPHY(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY)) > 0) +#define FLEXRAN_CAP_HIPHY(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY)) > 0) +#define FLEXRAN_CAP_LOMAC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC)) > 0) +#define FLEXRAN_CAP_HIMAC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC)) > 0) +#define FLEXRAN_CAP_RLC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC)) > 0) +#define FLEXRAN_CAP_PDCP(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP)) > 0) +#define FLEXRAN_CAP_SDAP(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP)) > 0) +#define FLEXRAN_CAP_RRC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC)) > 0) typedef enum { ENB_NORMAL_OPERATION = 0x0, -- GitLab From be750619dc047c836308e4ed872b69ae58392f5e Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 11:16:03 +0200 Subject: [PATCH 156/308] Remove warning of uninitialized use in RLC --- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index e3f2e22f8e..eda3bd76e4 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -936,7 +936,6 @@ rlc_am_mac_data_indication ( (void)l_rlc_p; /* avoid gcc warning "unused variable" */ - LOG_I(RLC, "In rlc_am_mac_indication: size %d\n",tb_size_in_bytes); #if TRACE_RLC_AM_PDU || MESSAGE_CHART_GENERATOR if (data_indP.data.nb_elements > 0) { @@ -947,6 +946,7 @@ rlc_am_mac_data_indication ( rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)((struct mac_tb_ind *) (tb_p->data))->data_ptr; tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size; + LOG_I(RLC, "In rlc_am_mac_indication: size %d\n",tb_size_in_bytes); if ((((struct mac_tb_ind *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) { if (rlc_am_get_data_pdu_infos(ctxt_pP,l_rlc_p,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) { -- GitLab From 9a2aab34f629e7efbebcfd606def58497e06b7d1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 11:16:20 +0200 Subject: [PATCH 157/308] Remove lots of warnings in F1AP --- openair2/COMMON/f1ap_messages_types.h | 2 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 12 +++++-- openair2/F1AP/f1ap_du_interface_management.c | 6 ++-- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 32 +++++++++---------- openair2/F1AP/f1ap_du_ue_context_management.c | 8 +++-- 6 files changed, 35 insertions(+), 27 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index ed04cc704e..5498ebadcb 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -277,7 +277,7 @@ typedef struct f1ap_ue_context_setup_req_s { uint8_t mnc_digit_length; uint64_t nr_cellid; uint8_t servCellIndex; - uint8_t cellULConfigured; + uint8_t *cellULConfigured; uint32_t servCellId; uint8_t *cu_to_du_rrc_information; uint8_t cu_to_du_rrc_information_length; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 7e62f2235d..9727e3d5d7 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -364,7 +364,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ctxt.enb_flag = 1; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); - LOG_I(CU_F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %d (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); + LOG_I(CU_F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); pdcp_data_ind (&ctxt, 1, // srb_flag 0, // embms_flag diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 06b4c471ab..4b6d12d4aa 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -738,7 +738,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_MaskedIMEISV; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_MaskedIMEISV; - MaskedIMEISV_TO_BIT_STRING(12340000, &ie->value.choice.MaskedIMEISV); // size (64) + MaskedIMEISV_TO_BIT_STRING(12340000l, &ie->value.choice.MaskedIMEISV); // size (64) ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -792,7 +792,10 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); + AssertFatal(f1ap_ue_context_setup_req->gNB_DU_ue_id, + "can not allocate memory for f1ap_ue_context_setup_req->gNB_DU_ue_id\n"); + *f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; /* Cause */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, @@ -938,7 +941,10 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); + AssertFatal(f1ap_ue_context_setup_req->gNB_DU_ue_id, + "can not allocate memory for f1ap_ue_context_setup_req->gNB_DU_ue_id\n"); + *f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; /* Optional*/ /* CriticalityDiagnostics */ diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index c088c72aa9..ba5ca584f0 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -505,11 +505,13 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ext!=NULL,"Extension for SI is null\n"); F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - LOG_D(DU_F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %x num_si %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nr_cellid[i],F1AP_SETUP_RESP (msg_p).num_SI[i]); + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", + i, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], + F1AP_SETUP_RESP (msg_p).nr_cellid[i], F1AP_SETUP_RESP (msg_p).num_SI[i]); for (int si =0;si < ext->list.count;si++) { size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; - LOG_D(DU_F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size); + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %ld bytes\n", i, si, size); F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si], diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 4ba8d291d4..b0ab66f2ed 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -71,13 +71,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, #ifndef UETARGET LOG_D(DU_F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); - MessageDef *message_p; F1AP_DLRRCMessageTransfer_t *container; F1AP_DLRRCMessageTransferIEs_t *ie; - uint8_t *buffer; - uint32_t len; - uint64_t cu_ue_f1ap_id; uint64_t du_ue_f1ap_id; uint64_t srb_id; @@ -170,6 +166,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, case F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority: rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority; break; + default: + LOG_W(DU_F1AP, "unhandled IE RAT_FrequencyPriorityInformation.present\n"); + break; } } @@ -218,9 +217,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: { LOG_I(DU_F1AP, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n", + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance], du_ue_f1ap_id)); // Get configuration RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; @@ -341,7 +340,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, case DL_DCCH_MessageType__c1_PR_NOTHING: LOG_I(DU_F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); - return; + return 0; case DL_DCCH_MessageType__c1_PR_dlInformationTransfer: LOG_I(DU_F1AP,"Received NAS DL Information Transfer\n"); break; @@ -357,7 +356,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, case DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: // handle RRCConnectionReconfiguration LOG_I(DU_F1AP, - "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %x/RNTI %x\n", + "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); @@ -379,11 +378,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated) { LOG_I(DU_F1AP,"Radio Resource Configuration is present\n"); - RadioResourceConfigDedicated_t* radioResourceConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated; uint8_t DRB2LCHAN[8]; - long SRB_id,drb_id; - int i,cnt; - LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig; + long drb_id; + int i; DRB_ToAddModList_t* DRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToAddModList; SRB_ToAddModList_t* SRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->srb_ToAddModList; DRB_ToReleaseList_t* DRB_ReleaseList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToReleaseList; @@ -502,6 +499,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, case DL_DCCH_MessageType__c1_PR_spare4: #endif break; + case DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9: + LOG_I(DU_F1AP, "Received ueInformationRequest_r9\n"); + break; + case DL_DCCH_MessageType__c1_PR_rrcConnectionResume_r13: + LOG_I(DU_F1AP, "Received rrcConnectionResume_r13\n"); } } } @@ -509,7 +511,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } - LOG_I(DU_F1AP, "Received DL RRC Transfer on srb_id %d\n",srb_id); + LOG_I(DU_F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id); rlc_op_status_t rlc_status; boolean_t ret = TRUE; mem_block_t *pdcp_pdu_p = NULL; @@ -594,10 +596,6 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, LOG_I(DU_F1AP,"[DU %d] Received UL_RRC_MESSAGE_TRANSFER : size %d UE RNTI %x in SRB %d\n", ctxt_pP->module_id, sdu_sizeP, rnti, rb_idP); - struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - rnti); - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 3cdafe4308..4477a1cd48 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -100,9 +100,10 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SpCellULConfigured, false); // SpCellULConfigured if (ie) { + /* correct here */ f1ap_ue_context_setup_req->cellULConfigured = malloc(sizeof(uint32_t)); if (f1ap_ue_context_setup_req->cellULConfigured) - f1ap_ue_context_setup_req->cellULConfigured = ie->value.choice.CellULConfigured; + *f1ap_ue_context_setup_req->cellULConfigured = ie->value.choice.CellULConfigured; } else { f1ap_ue_context_setup_req->cellULConfigured = NULL; } @@ -643,7 +644,6 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, MessageDef *msg_p; // message to RRC F1AP_UEContextReleaseRequest_t *container; F1AP_UEContextReleaseRequestIEs_t *ie; - int i; DevAssert(pdu); @@ -661,7 +661,9 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); + if (f1ap_ue_context_setup_req->gNB_DU_ue_id) + *f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; /* Cause */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, -- GitLab From 2623e3f298351f6c54cebb3b476c3a8b152fec4e Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 14:58:40 +0200 Subject: [PATCH 158/308] Improve interface of FlexRAN RAN API: Return protobuf types The functions of the RAN API should not return the types of OAI, but protobuf types. Previously, they would return OAI types and the calling code "marshals" this into Protobuf type. This commit changes the following functions and modifies the calling code to directly store the protobuf type: * flexran_get_hopping_mode() * flexran_get_phich_resource() * flexran_get_phich_duration() * flexran_get_ul_cyclic_prefix_length() * flexran_get_dl_cyclic_prefix_length() * flexran_get_duplex_mode() usage * flexran_get_enable64QAM() --- openair2/ENB_APP/flexran_agent_common.c | 50 ++++------------ openair2/ENB_APP/flexran_agent_ran_api.c | 72 ++++++++++++++++-------- openair2/ENB_APP/flexran_agent_ran_api.h | 12 ++-- 3 files changed, 65 insertions(+), 69 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index bffe145c92..53137855d3 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -840,33 +840,18 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F cell_conf[i]->pusch_hopping_offset = flexran_get_hopping_offset(mod_id,i); cell_conf[i]->has_pusch_hopping_offset = 1; - if (flexran_get_hopping_mode(mod_id,i) == 0) { - cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; - } else if(flexran_get_hopping_mode(mod_id,i) == 1) { - cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; - } + cell_conf[i]->hopping_mode = flexran_get_hopping_mode(mod_id,i); cell_conf[i]->has_hopping_mode = 1; cell_conf[i]->n_sb = flexran_get_n_SB(mod_id,i); cell_conf[i]->has_n_sb = 1; - if (flexran_get_phich_resource(mod_id,i) == 0) { - cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0 - } else if (flexran_get_phich_resource(mod_id,i) == 1) { - cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; //1 - } else if (flexran_get_phich_resource(mod_id,i) == 2) { - cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; // 2 - } else if (flexran_get_phich_resource(mod_id,i) == 3) { - cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3 - } + cell_conf[i]->phich_resource = flexran_get_phich_resource(mod_id,i); cell_conf[i]->has_phich_resource = 1; - if (flexran_get_phich_duration(mod_id,i) == 0) { - cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; - } else if(flexran_get_phich_duration(mod_id,i) == 1) { - cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED; - } + cell_conf[i]->phich_duration = flexran_get_phich_duration(mod_id,i); cell_conf[i]->has_phich_duration = 1; + cell_conf[i]->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(mod_id,i); cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; Protocol__FlexSiConfig *si_config; @@ -914,29 +899,18 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F cell_conf[i]->ul_bandwidth = flexran_get_N_RB_UL(mod_id,i); cell_conf[i]->has_ul_bandwidth = 1; - if (flexran_get_ul_cyclic_prefix_length(mod_id, i) == 0) { - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; - } else if(flexran_get_ul_cyclic_prefix_length(mod_id, i) == 1) { - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; - } + cell_conf[i]->ul_cyclic_prefix_length = flexran_get_ul_cyclic_prefix_length(mod_id, i); cell_conf[i]->has_ul_cyclic_prefix_length = 1; - if (flexran_get_ul_cyclic_prefix_length(mod_id,i) == 0) { - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; - } else if (flexran_get_ul_cyclic_prefix_length(mod_id,i) == 1) { - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; - } - + cell_conf[i]->dl_cyclic_prefix_length = flexran_get_dl_cyclic_prefix_length(mod_id,i); cell_conf[i]->has_dl_cyclic_prefix_length = 1; + cell_conf[i]->antenna_ports_count = flexran_get_antenna_ports(mod_id, i); cell_conf[i]->has_antenna_ports_count = 1; - if (flexran_get_duplex_mode(mod_id,i) == 1) { - cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; - } else if(flexran_get_duplex_mode(mod_id,i) == 0) { - cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; - } + cell_conf[i]->duplex_mode = flexran_get_duplex_mode(mod_id,i); cell_conf[i]->has_duplex_mode = 1; + cell_conf[i]->subframe_assignment = flexran_get_subframe_assignment(mod_id, i); cell_conf[i]->has_subframe_assignment = 1; cell_conf[i]->special_subframe_patterns = flexran_get_special_subframe_assignment(mod_id,i); @@ -1022,11 +996,7 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F cell_conf[i]->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (mod_id,i); cell_conf[i]->has_ul_pusch_power = 1; - if (flexran_get_enable64QAM(mod_id,i) == 0) { - cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; - } else if(flexran_get_enable64QAM(mod_id,i) == 1) { - cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; - } + cell_conf[i]->enable_64qam = flexran_get_enable64QAM(mod_id,i); cell_conf[i]->has_enable_64qam = 1; cell_conf[i]->carrier_index = i; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 97e91dcfa8..09088aa79d 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -508,10 +508,16 @@ uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id) return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.pusch_HoppingOffset; } -PUSCH_HOPPING_t flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id) -{ - if (!phy_is_present(mod_id, cc_id)) return 0; - return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.hoppingMode; +Protocol__FlexHoppingMode flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id) +{ + if (!phy_is_present(mod_id, cc_id)) return -1; + switch (RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.hoppingMode) { + case interSubFrame: + return PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; + case intraAndInterSubFrame: + return PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; + } + return -1; } uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id) @@ -520,33 +526,41 @@ uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id) return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.n_SB; } -uint8_t flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id) +Protocol__FlexQam flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id) { if (!phy_is_present(mod_id, cc_id)) return 0; - return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.enable64QAM; + if (RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.enable64QAM == TRUE) + return PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; + else + return PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; } -PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id) +Protocol__FlexPhichDuration flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - return RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_duration; + if (!phy_is_present(mod_id, cc_id)) return -1; + switch (RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_duration) { + case normal: + return PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; + case extended: + return PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED; + } + return -1; } -int flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id) +Protocol__FlexPhichResource flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; + if (!phy_is_present(mod_id, cc_id)) return -1; switch (RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_resource) { case oneSixth: - return 0; + return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; case half: - return 1; + return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; case one: - return 2; + return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; case two: - return 3; - default: - return -1; + return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO; } + return -1; } uint16_t flexran_get_n1pucch_an(mid_t mod_id, uint8_t cc_id) @@ -585,16 +599,28 @@ uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id) return RC.eNB[mod_id][cc_id]->frame_parms.maxHARQ_Msg3Tx; } -lte_prefix_type_t flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id) +Protocol__FlexUlCyclicPrefixLength flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - return RC.eNB[mod_id][cc_id]->frame_parms.Ncp_UL; + if (!phy_is_present(mod_id, cc_id)) return -1; + switch (RC.eNB[mod_id][cc_id]->frame_parms.Ncp_UL) { + case EXTENDED: + return PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; + case NORMAL: + return PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; + } + return -1; } -lte_prefix_type_t flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id) +Protocol__FlexDlCyclicPrefixLength flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - return RC.eNB[mod_id][cc_id]->frame_parms.Ncp; + if (!phy_is_present(mod_id, cc_id)) return -1; + switch (RC.eNB[mod_id][cc_id]->frame_parms.Ncp) { + case EXTENDED: + return PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; + case NORMAL: + return PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; + } + return -1; } uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id) diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index 8fbff216d3..c98113a392 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -206,10 +206,10 @@ uint8_t flexran_get_prach_FreqOffset(mid_t mod_id, uint8_t cc_id); uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id); /* Get the length of the UL cyclic prefix */ -lte_prefix_type_t flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id); +Protocol__FlexUlCyclicPrefixLength flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id); /* Get the length of the DL cyclic prefix */ -lte_prefix_type_t flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id); +Protocol__FlexDlCyclicPrefixLength flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id); /* Get the physical cell id of a cell */ uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id); @@ -283,17 +283,17 @@ int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, uint8_t cc_id); uint8_t flexran_get_threequarter_fs(mid_t mod_id, uint8_t cc_id); -PUSCH_HOPPING_t flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id); +Protocol__FlexHoppingMode flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id); uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id); uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id); -int flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id); +Protocol__FlexPhichResource flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id); -uint8_t flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id); +Protocol__FlexQam flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id); -PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id); +Protocol__FlexPhichDuration flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id); /* * ************************************ -- GitLab From b702b415a7319cc90f41c7eb40f1970c8fb28b01 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 24 Oct 2018 17:29:44 +0200 Subject: [PATCH 159/308] Split enb_config_reply->cell_conf message to PHY, MAC, RRC --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 14 ++ .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 4 + .../CONTROL_MODULES/PHY/flexran_agent_phy.c | 120 +++++++++++- .../CONTROL_MODULES/PHY/flexran_agent_phy.h | 4 + .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 55 +++++- .../CONTROL_MODULES/RRC/flexran_agent_rrc.h | 4 + openair2/ENB_APP/flexran_agent_common.c | 183 ++---------------- 7 files changed, 209 insertions(+), 175 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 682105d097..b1f70a0822 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1358,6 +1358,20 @@ int flexran_agent_register_mac_xface(mid_t mod_id) return 0; } +void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, + Protocol__FlexCellConfig *conf) { + if (!conf->si_config) { + conf->si_config = malloc(sizeof(Protocol__FlexSiConfig)); + if (conf->si_config) + protocol__flex_si_config__init(conf->si_config); + } + + if (conf->si_config) { + conf->si_config->sfn = flexran_get_current_system_frame_num(mod_id); + conf->si_config->has_sfn = 1; + } +} + int flexran_agent_unregister_mac_xface(mid_t mod_id) { if (!agent_mac_xface[mod_id]) { diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h index cabd6f949b..af93674f0c 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -83,6 +83,10 @@ void flexran_agent_send_update_mac_stats(mid_t mod_id); /// Provide to the scheduler a pending dl_mac_config message void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); +/* Fill the MAC part of an cell_config message */ +void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, + Protocol__FlexCellConfig *conf); + /*Register technology specific interface callbacks*/ int flexran_agent_register_mac_xface(mid_t mod_id); diff --git a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c index 745659c949..2f87262938 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c +++ b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c @@ -26,17 +26,133 @@ */ #include "flexran_agent_phy.h" +#include "flexran_agent_ran_api.h" /* Array containing the Agent-PHY interfaces */ AGENT_PHY_xface *agent_phy_xface[NUM_MAX_ENB]; -int flexran_agent_register_phy_xface(mid_t mod_id) -{ +void flexran_agent_fill_phy_cell_config(mid_t mod_id, uint8_t cc_id, + Protocol__FlexCellConfig *conf) { + conf->phy_cell_id = flexran_get_cell_id(mod_id, cc_id); + conf->has_phy_cell_id = 1; + + conf->pusch_hopping_offset = flexran_get_hopping_offset(mod_id, cc_id); + conf->has_pusch_hopping_offset = 1; + + conf->hopping_mode = flexran_get_hopping_mode(mod_id, cc_id); + conf->has_hopping_mode = 1; + + conf->n_sb = flexran_get_n_SB(mod_id, cc_id); + conf->has_n_sb = 1; + + conf->phich_resource = flexran_get_phich_resource(mod_id, cc_id); + conf->has_phich_resource = 1; + + conf->phich_duration = flexran_get_phich_duration(mod_id, cc_id); + conf->has_phich_duration = 1; + + conf->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(mod_id, cc_id); + conf->has_init_nr_pdcch_ofdm_sym = 1; + + conf->dl_bandwidth = flexran_get_N_RB_DL(mod_id, cc_id); + conf->has_dl_bandwidth = 1; + + conf->ul_bandwidth = flexran_get_N_RB_UL(mod_id, cc_id); + conf->has_ul_bandwidth = 1; + + conf->ul_cyclic_prefix_length = flexran_get_ul_cyclic_prefix_length(mod_id, cc_id); + conf->has_ul_cyclic_prefix_length = 1; + + conf->dl_cyclic_prefix_length = flexran_get_dl_cyclic_prefix_length(mod_id, cc_id); + conf->has_dl_cyclic_prefix_length = 1; + + conf->antenna_ports_count = flexran_get_antenna_ports(mod_id, cc_id); + conf->has_antenna_ports_count = 1; + + conf->duplex_mode = flexran_get_duplex_mode(mod_id, cc_id); + conf->has_duplex_mode = 1; + + conf->subframe_assignment = flexran_get_subframe_assignment(mod_id, cc_id); + conf->has_subframe_assignment = 1; + + conf->special_subframe_patterns = flexran_get_special_subframe_assignment(mod_id, cc_id); + conf->has_special_subframe_patterns = 1; + + //TODO: Fill in with actual value, The MBSFN radio frame period + conf->n_mbsfn_subframe_config_rfperiod = 0; + uint32_t *elem_rfperiod = malloc(sizeof(uint32_t) * conf->n_mbsfn_subframe_config_rfperiod); + if (elem_rfperiod) + for(int j = 0; j < conf->n_mbsfn_subframe_config_rfperiod; j++) + elem_rfperiod[j] = 1; + conf->mbsfn_subframe_config_rfperiod = elem_rfperiod; + + //TODO: Fill in with actual value, The MBSFN radio frame offset + conf->n_mbsfn_subframe_config_rfoffset = 0; + uint32_t *elem_rfoffset = malloc(sizeof(uint32_t) * conf->n_mbsfn_subframe_config_rfoffset); + if (elem_rfoffset) + for(int j = 0; j < conf->n_mbsfn_subframe_config_rfoffset; j++) + elem_rfoffset[j] = 1; + conf->mbsfn_subframe_config_rfoffset = elem_rfoffset; + + //TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes + conf->n_mbsfn_subframe_config_sfalloc = 0; + uint32_t *elem_sfalloc = malloc(sizeof(uint32_t) * conf->n_mbsfn_subframe_config_sfalloc); + if (elem_sfalloc) + for(int j = 0; j < conf->n_mbsfn_subframe_config_sfalloc; j++) + elem_sfalloc[j] = 1; + conf->mbsfn_subframe_config_sfalloc = elem_sfalloc; + + conf->prach_config_index = flexran_get_prach_ConfigIndex(mod_id, cc_id); + conf->has_prach_config_index = 1; + + conf->prach_freq_offset = flexran_get_prach_FreqOffset(mod_id, cc_id); + conf->has_prach_freq_offset = 1; + + conf->max_harq_msg3tx = flexran_get_maxHARQ_Msg3Tx(mod_id, cc_id); + conf->has_max_harq_msg3tx = 1; + + conf->n1pucch_an = flexran_get_n1pucch_an(mod_id, cc_id); + conf->has_n1pucch_an = 1; + + conf->deltapucch_shift = flexran_get_deltaPUCCH_Shift(mod_id, cc_id); + conf->has_deltapucch_shift = 1; + + conf->nrb_cqi = flexran_get_nRB_CQI(mod_id, cc_id); + conf->has_nrb_cqi = 1; + + conf->srs_subframe_config = flexran_get_srs_SubframeConfig(mod_id, cc_id); + conf->has_srs_subframe_config = 1; + + conf->srs_bw_config = flexran_get_srs_BandwidthConfig(mod_id, cc_id); + conf->has_srs_bw_config = 1; + + conf->srs_mac_up_pts = flexran_get_srs_MaxUpPts(mod_id, cc_id); + conf->has_srs_mac_up_pts = 1; + + conf->dl_freq = flexran_agent_get_operating_dl_freq (mod_id, cc_id); + conf->has_dl_freq = 1; + + conf->ul_freq = flexran_agent_get_operating_ul_freq (mod_id, cc_id); + conf->has_ul_freq = 1; + + conf->eutra_band = flexran_agent_get_operating_eutra_band (mod_id, cc_id); + conf->has_eutra_band = 1; + + conf->dl_pdsch_power = flexran_agent_get_operating_pdsch_refpower(mod_id, cc_id); + conf->has_dl_pdsch_power = 1; + + conf->enable_64qam = flexran_get_enable64QAM(mod_id, cc_id); + conf->has_enable_64qam = 1; +} + +int flexran_agent_register_phy_xface(mid_t mod_id) { if (agent_phy_xface[mod_id]) { LOG_E(PHY, "PHY agent for eNB %d is already registered\n", mod_id); return -1; } + AGENT_PHY_xface *xface = malloc(sizeof(AGENT_PHY_xface)); + if (!xface) { LOG_E(FLEXRAN_AGENT, "could not allocate memory for PHY agent xface %d\n", mod_id); return -1; diff --git a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h index 26a658a943..25b3deac35 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h +++ b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h @@ -45,6 +45,10 @@ * FlexRAN agent - technology PHY API **********************************/ +/* Fill the PHY part of an cell_config message */ +void flexran_agent_fill_phy_cell_config(mid_t mod_id, uint8_t cc_id, + Protocol__FlexCellConfig *conf); + /* Register technology specific interface callbacks */ int flexran_agent_register_phy_xface(mid_t mod_id); diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index c485410b35..2e6f330275 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -27,7 +27,7 @@ */ #include "flexran_agent_rrc.h" - +#include "flexran_agent_ran_api.h" #include "liblfds700.h" @@ -662,6 +662,59 @@ int flexran_agent_register_rrc_xface(mid_t mod_id) return 0; } +void flexran_agent_fill_rrc_cell_config(mid_t mod_id, uint8_t cc_id, + Protocol__FlexCellConfig *conf) { + conf->cell_id = cc_id; + conf->has_cell_id = 1; + + if (!conf->si_config) { + conf->si_config = malloc(sizeof(Protocol__FlexSiConfig)); + if (conf->si_config) + protocol__flex_si_config__init(conf->si_config); + } + + if (conf->si_config) { + // TODO THIS IS DU RRC + conf->si_config->sib1_length = flexran_get_sib1_length(mod_id, cc_id); + conf->si_config->has_sib1_length = 1; + + conf->si_config->si_window_length = (uint32_t) flexran_get_si_window_length(mod_id, cc_id); + conf->si_config->has_si_window_length = 1; + + conf->si_config->n_si_message = 0; + + /* Protocol__FlexSiMessage **si_message; */ + /* si_message = malloc(sizeof(Protocol__FlexSiMessage *) * si_config->n_si_message); */ + /* if(si_message == NULL) */ + /* goto error; */ + /* for(j = 0; j < si_config->n_si_message; j++){ */ + /* si_message[j] = malloc(sizeof(Protocol__FlexSiMessage)); */ + /* if(si_message[j] == NULL) */ + /* goto error; */ + /* protocol__flex_si_message__init(si_message[j]); */ + /* //TODO: Fill in with actual value, Periodicity of SI msg in radio frames */ + /* si_message[j]->periodicity = 1; //SIPeriod */ + /* si_message[j]->has_periodicity = 1; */ + /* //TODO: Fill in with actual value, rhe length of the SI message in bytes */ + /* si_message[j]->length = 10; */ + /* si_message[j]->has_length = 1; */ + /* } */ + /* if(si_config->n_si_message > 0){ */ + /* si_config->si_message = si_message; */ + /* } */ + } + + conf->ra_response_window_size = flexran_get_ra_ResponseWindowSize(mod_id, cc_id); + conf->has_ra_response_window_size = 1; + + // belongs to MAC but is read in RRC + conf->mac_contention_resolution_timer = flexran_get_mac_ContentionResolutionTimer(mod_id, cc_id); + conf->has_mac_contention_resolution_timer = 1; + + conf->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (mod_id, cc_id); + conf->has_ul_pusch_power = 1; +} + int flexran_agent_unregister_rrc_xface(mid_t mod_id) { if (!agent_rrc_xface[mod_id]) { diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h index d1a0c8f423..a9b2ac49cc 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h @@ -60,6 +60,10 @@ void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t *); int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexranMessage *msg); +/* Fill the RRC part of an cell_config message */ +void flexran_agent_fill_rrc_cell_config(mid_t mod_id, uint8_t cc_id, + Protocol__FlexCellConfig *conf); + /*Register technology specific interface callbacks*/ int flexran_agent_register_rrc_xface(mid_t mod_id); diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 53137855d3..592af05f2e 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -35,6 +35,9 @@ #include "flexran_agent_extern.h" #include "flexran_agent_net_comm.h" #include "flexran_agent_ran_api.h" +#include "flexran_agent_phy.h" +#include "flexran_agent_mac.h" +#include "flexran_agent_rrc.h" //#include "PHY/extern.h" #include "common/utils/LOG/log.h" @@ -807,8 +810,6 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F Protocol__FlexEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; xid = (enb_config_req_msg->header)->xid; - int i, j; - Protocol__FlexEnbConfigReply *enb_config_reply_msg; enb_config_reply_msg = malloc(sizeof(Protocol__FlexEnbConfigReply)); if(enb_config_reply_msg == NULL) @@ -827,178 +828,16 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F cell_conf = malloc(sizeof(Protocol__FlexCellConfig *) * enb_config_reply_msg->n_cell_config); if(cell_conf == NULL) goto error; - for(i = 0; i < enb_config_reply_msg->n_cell_config; i++){ + for(int i = 0; i < enb_config_reply_msg->n_cell_config; i++){ cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig)); + if (!cell_conf[i]) goto error; protocol__flex_cell_config__init(cell_conf[i]); - - cell_conf[i]->phy_cell_id = 1; - cell_conf[i]->has_phy_cell_id = flexran_get_cell_id(mod_id,i); - - cell_conf[i]->cell_id = i; - cell_conf[i]->has_cell_id = 1; - - cell_conf[i]->pusch_hopping_offset = flexran_get_hopping_offset(mod_id,i); - cell_conf[i]->has_pusch_hopping_offset = 1; - - cell_conf[i]->hopping_mode = flexran_get_hopping_mode(mod_id,i); - cell_conf[i]->has_hopping_mode = 1; - - cell_conf[i]->n_sb = flexran_get_n_SB(mod_id,i); - cell_conf[i]->has_n_sb = 1; - - cell_conf[i]->phich_resource = flexran_get_phich_resource(mod_id,i); - cell_conf[i]->has_phich_resource = 1; - - cell_conf[i]->phich_duration = flexran_get_phich_duration(mod_id,i); - cell_conf[i]->has_phich_duration = 1; - - cell_conf[i]->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(mod_id,i); - cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; - Protocol__FlexSiConfig *si_config; - si_config = malloc(sizeof(Protocol__FlexSiConfig)); - if(si_config == NULL) - goto error; - protocol__flex_si_config__init(si_config); - - si_config->sfn = flexran_get_current_system_frame_num(mod_id); - si_config->has_sfn = 1; - - si_config->sib1_length = flexran_get_sib1_length(mod_id,i); - si_config->has_sib1_length = 1; - - si_config->si_window_length = (uint32_t) flexran_get_si_window_length(mod_id, i); - si_config->has_si_window_length = 1; - - si_config->n_si_message = 0; - - /* Protocol__FlexSiMessage **si_message; */ - /* si_message = malloc(sizeof(Protocol__FlexSiMessage *) * si_config->n_si_message); */ - /* if(si_message == NULL) */ - /* goto error; */ - /* for(j = 0; j < si_config->n_si_message; j++){ */ - /* si_message[j] = malloc(sizeof(Protocol__FlexSiMessage)); */ - /* if(si_message[j] == NULL) */ - /* goto error; */ - /* protocol__flex_si_message__init(si_message[j]); */ - /* //TODO: Fill in with actual value, Periodicity of SI msg in radio frames */ - /* si_message[j]->periodicity = 1; //SIPeriod */ - /* si_message[j]->has_periodicity = 1; */ - /* //TODO: Fill in with actual value, rhe length of the SI message in bytes */ - /* si_message[j]->length = 10; */ - /* si_message[j]->has_length = 1; */ - /* } */ - /* if(si_config->n_si_message > 0){ */ - /* si_config->si_message = si_message; */ - /* } */ - - cell_conf[i]->si_config = si_config; - - cell_conf[i]->dl_bandwidth = flexran_get_N_RB_DL(mod_id,i); - cell_conf[i]->has_dl_bandwidth = 1; - - cell_conf[i]->ul_bandwidth = flexran_get_N_RB_UL(mod_id,i); - cell_conf[i]->has_ul_bandwidth = 1; - - cell_conf[i]->ul_cyclic_prefix_length = flexran_get_ul_cyclic_prefix_length(mod_id, i); - cell_conf[i]->has_ul_cyclic_prefix_length = 1; - - cell_conf[i]->dl_cyclic_prefix_length = flexran_get_dl_cyclic_prefix_length(mod_id,i); - cell_conf[i]->has_dl_cyclic_prefix_length = 1; - - cell_conf[i]->antenna_ports_count = flexran_get_antenna_ports(mod_id, i); - cell_conf[i]->has_antenna_ports_count = 1; - - cell_conf[i]->duplex_mode = flexran_get_duplex_mode(mod_id,i); - cell_conf[i]->has_duplex_mode = 1; - - cell_conf[i]->subframe_assignment = flexran_get_subframe_assignment(mod_id, i); - cell_conf[i]->has_subframe_assignment = 1; - cell_conf[i]->special_subframe_patterns = flexran_get_special_subframe_assignment(mod_id,i); - cell_conf[i]->has_special_subframe_patterns = 1; - //TODO: Fill in with actual value, The MBSFN radio frame period - cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 0; - uint32_t *elem_rfperiod; - elem_rfperiod = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfperiod); - if(elem_rfperiod == NULL) - goto error; - for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_rfperiod; j++){ - elem_rfperiod[j] = 1; - } - cell_conf[i]->mbsfn_subframe_config_rfperiod = elem_rfperiod; - - //TODO: Fill in with actual value, The MBSFN radio frame offset - cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 0; - uint32_t *elem_rfoffset; - elem_rfoffset = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfoffset); - if(elem_rfoffset == NULL) - goto error; - for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_rfoffset; j++){ - elem_rfoffset[j] = 1; - } - cell_conf[i]->mbsfn_subframe_config_rfoffset = elem_rfoffset; - - //TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes - cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 0; - uint32_t *elem_sfalloc; - elem_sfalloc = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_sfalloc); - if(elem_sfalloc == NULL) - goto error; - for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_sfalloc; j++){ - elem_sfalloc[j] = 1; - } - cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; - - cell_conf[i]->prach_config_index = flexran_get_prach_ConfigIndex(mod_id,i); - cell_conf[i]->has_prach_config_index = 1; - - cell_conf[i]->prach_freq_offset = flexran_get_prach_FreqOffset(mod_id,i); - cell_conf[i]->has_prach_freq_offset = 1; - - cell_conf[i]->ra_response_window_size = flexran_get_ra_ResponseWindowSize(mod_id,i); - cell_conf[i]->has_ra_response_window_size = 1; - - cell_conf[i]->mac_contention_resolution_timer = flexran_get_mac_ContentionResolutionTimer(mod_id,i); - cell_conf[i]->has_mac_contention_resolution_timer = 1; - - cell_conf[i]->max_harq_msg3tx = flexran_get_maxHARQ_Msg3Tx(mod_id,i); - cell_conf[i]->has_max_harq_msg3tx = 1; - - cell_conf[i]->n1pucch_an = flexran_get_n1pucch_an(mod_id,i); - cell_conf[i]->has_n1pucch_an = 1; - - cell_conf[i]->deltapucch_shift = flexran_get_deltaPUCCH_Shift(mod_id,i); - cell_conf[i]->has_deltapucch_shift = 1; - - cell_conf[i]->nrb_cqi = flexran_get_nRB_CQI(mod_id,i); - cell_conf[i]->has_nrb_cqi = 1; - - cell_conf[i]->srs_subframe_config = flexran_get_srs_SubframeConfig(mod_id,i); - cell_conf[i]->has_srs_subframe_config = 1; - - cell_conf[i]->srs_bw_config = flexran_get_srs_BandwidthConfig(mod_id,i); - cell_conf[i]->has_srs_bw_config = 1; - - cell_conf[i]->srs_mac_up_pts = flexran_get_srs_MaxUpPts(mod_id,i); - cell_conf[i]->has_srs_mac_up_pts = 1; - - cell_conf[i]->dl_freq = flexran_agent_get_operating_dl_freq (mod_id,i); - cell_conf[i]->has_dl_freq = 1; - - cell_conf[i]->ul_freq = flexran_agent_get_operating_ul_freq (mod_id, i); - cell_conf[i]->has_ul_freq = 1; - - cell_conf[i]->eutra_band = flexran_agent_get_operating_eutra_band (mod_id,i); - cell_conf[i]->has_eutra_band = 1; - - cell_conf[i]->dl_pdsch_power = flexran_agent_get_operating_pdsch_refpower(mod_id, i); - cell_conf[i]->has_dl_pdsch_power = 1; - - cell_conf[i]->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (mod_id,i); - cell_conf[i]->has_ul_pusch_power = 1; - - cell_conf[i]->enable_64qam = flexran_get_enable64QAM(mod_id,i); - cell_conf[i]->has_enable_64qam = 1; - + if (flexran_agent_get_phy_xface(mod_id)) + flexran_agent_fill_phy_cell_config(mod_id, i, cell_conf[i]); + if (flexran_agent_get_rrc_xface(mod_id)) + flexran_agent_fill_rrc_cell_config(mod_id, i, cell_conf[i]); + if (flexran_agent_get_mac_xface(mod_id)) + flexran_agent_fill_mac_cell_config(mod_id, i, cell_conf[i]); cell_conf[i]->carrier_index = i; cell_conf[i]->has_carrier_index = 1; } -- GitLab From fa7168a097dcf0d6ada624ebb7b9f8d82ee7f723 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 10:14:13 +0200 Subject: [PATCH 160/308] FlexRAN enb_config_reply destroy message update --- openair2/ENB_APP/flexran_agent_common.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 592af05f2e..04a001ccdc 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -280,15 +280,17 @@ int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) goto error; free(msg->enb_config_reply_msg->header); - int i, j; Protocol__FlexEnbConfigReply *reply = msg->enb_config_reply_msg; - for(i = 0; i < reply->n_cell_config;i++) { - free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); - free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod); - free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc); + for (int i = 0; i < reply->n_cell_config;i++) { + if (reply->cell_config[i]->mbsfn_subframe_config_rfoffset) + free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); + if (reply->cell_config[i]->mbsfn_subframe_config_rfperiod) + free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod); + if (reply->cell_config[i]->mbsfn_subframe_config_sfalloc) + free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc); if (reply->cell_config[i]->si_config != NULL) { - for(j = 0; j < reply->cell_config[i]->si_config->n_si_message;j++){ + for (int j = 0; j < reply->cell_config[i]->si_config->n_si_message;j++){ free(reply->cell_config[i]->si_config->si_message[j]); } free(reply->cell_config[i]->si_config->si_message); -- GitLab From a7b114c4ecbfeb98cf2866fe531514c0180f1a1b Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 10:23:43 +0200 Subject: [PATCH 161/308] RAN API: Check for MAC presence --- openair2/ENB_APP/flexran_agent_ran_api.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 09088aa79d..7fb0d767e1 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -73,6 +73,7 @@ sub_frame_t flexran_get_current_subframe(mid_t mod_id) /* Why uint16_t, frame_t and sub_frame_t are defined as uint32_t? */ uint16_t flexran_get_sfn_sf(mid_t mod_id) { + if (!mac_is_present(mod_id)) return 0; frame_t frame = flexran_get_current_system_frame_num(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); uint16_t sfn_sf, frame_mask, sf_mask; @@ -86,6 +87,7 @@ uint16_t flexran_get_sfn_sf(mid_t mod_id) uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time) { + if (!mac_is_present(mod_id)) return 0; frame_t frame = flexran_get_current_system_frame_num(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); uint16_t sfn_sf, frame_mask, sf_mask; @@ -114,6 +116,7 @@ int flexran_get_num_ues(mid_t mod_id) rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id) { + if (!mac_is_present(mod_id)) return 0; return UE_RNTI(mod_id, ue_id); } @@ -137,6 +140,7 @@ uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id) rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { + if (!mac_is_present(mod_id)) return 0; rnti_t rnti = flexran_get_ue_crnti(mod_id, ue_id); frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); @@ -150,6 +154,7 @@ rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logi rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { + if (!mac_is_present(mod_id)) return 0; rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); @@ -163,6 +168,7 @@ rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, lo frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { + if (!mac_is_present(mod_id)) return 0; rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); -- GitLab From 89d8afb61258393e980aa6934d929463199c02aa Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 10:25:23 +0200 Subject: [PATCH 162/308] Remove MAC presence checking from scheduler primitives --- openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index b85335caab..45ff985f30 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -1836,7 +1836,6 @@ int UE_num_active_CC(UE_list_t * listP, int ue_idP) int UE_PCCID(module_id_t mod_idP, int ue_idP) //------------------------------------------------------------------------------ { - if (!RC.mac || !RC.mac[mod_idP]) return 0; return (RC.mac[mod_idP]->UE_list.pCC_id[ue_idP]); } @@ -1844,7 +1843,6 @@ int UE_PCCID(module_id_t mod_idP, int ue_idP) rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP) //------------------------------------------------------------------------------ { - if (!RC.mac || !RC.mac[mod_idP]) return 0; rnti_t rnti = RC.mac[mod_idP]-> UE_list.UE_template[UE_PCCID(mod_idP, ue_idP)][ue_idP].rnti; @@ -1862,7 +1860,6 @@ rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP) boolean_t is_UE_active(module_id_t mod_idP, int ue_idP) //------------------------------------------------------------------------------ { - if (!RC.mac || !RC.mac[mod_idP]) return 0; return (RC.mac[mod_idP]->UE_list.active[ue_idP]); } -- GitLab From 369e89ee2a58589786b52e279203374d89c63d6f Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 15:31:12 +0200 Subject: [PATCH 163/308] Create RAN API flexran_get_num_ue_lcs() [no dedicated bearers detection] --- openair2/ENB_APP/flexran_agent_ran_api.c | 14 ++++++++++++++ openair2/ENB_APP/flexran_agent_ran_api.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 7fb0d767e1..f8789e3d71 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -114,6 +114,20 @@ int flexran_get_num_ues(mid_t mod_id) return RC.mac[mod_id]->UE_list.num_UEs; } +int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id) +{ + if (!mac_is_present(mod_id)) return 0; + // Not sure whether this is needed: if (!rrc_is_present(mod_id)) return 0; + const rnti_t rnti = flexran_get_ue_crnti(mod_id, ue_id); + const int s = mac_eNB_get_rrc_status(mod_id, rnti); + if (s < RRC_CONNECTED) + return 0; + else if (s == RRC_CONNECTED) + return 1; + else + return 3; +} + rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id) { if (!mac_is_present(mod_id)) return 0; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index c98113a392..b0e3f941a7 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -73,6 +73,10 @@ uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time); /* Return the number of attached UEs */ int flexran_get_num_ues(mid_t mod_id); +/* Get the number of logical channels per UE. This function does not consider + * dedicated bearers yet */ +int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id); + /* Get the rnti of a UE with id ue_id */ rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id); -- GitLab From 3035781485d66dbdb3a73c8dfcffdd54f7af9107 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 15:32:42 +0200 Subject: [PATCH 164/308] Move ue_lc_config message filling into MAC CM --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 60 ++++++++++++++ .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 4 + openair2/ENB_APP/flexran_agent_common.c | 83 +++---------------- 3 files changed, 77 insertions(+), 70 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index b1f70a0822..c9efccfa72 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1372,6 +1372,66 @@ void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, } } +void flexran_agent_fill_mac_lc_ue_config(mid_t mod_id, mid_t ue_id, + Protocol__FlexLcUeConfig *lc_ue_conf) +{ + lc_ue_conf->rnti = flexran_get_ue_crnti(mod_id, ue_id); + lc_ue_conf->has_rnti = 1; + + lc_ue_conf->n_lc_config = flexran_get_num_ue_lcs(mod_id, ue_id); + if (lc_ue_conf->n_lc_config == 0) + return; + + Protocol__FlexLcConfig **lc_config = + calloc(lc_ue_conf->n_lc_config, sizeof(Protocol__FlexLcConfig *)); + if (!lc_config) { + LOG_E(FLEXRAN_AGENT, "could not allocate memory for lc_config of UE %x\n", lc_ue_conf->rnti); + lc_ue_conf->n_lc_config = 0; + return; // can not allocate memory, skip rest + } + for (int j = 0; j < lc_ue_conf->n_lc_config; j++) { + lc_config[j] = malloc(sizeof(Protocol__FlexLcConfig)); + if (!lc_config[j]) continue; // go over this error, try entry + protocol__flex_lc_config__init(lc_config[j]); + + lc_config[j]->has_lcid = 1; + lc_config[j]->lcid = j+1; + + const int lcg = flexran_get_lcg(mod_id, ue_id, j+1); + if (lcg >= 0 && lcg <= 3) { + lc_config[j]->has_lcg = 1; + lc_config[j]->lcg = flexran_get_lcg(mod_id, ue_id, j+1); + } + + lc_config[j]->has_direction = 1; + lc_config[j]->direction = flexran_get_direction(ue_id, j+1); + //TODO: Bearer type. One of FLQBT_* values. Currently only default bearer supported + lc_config[j]->has_qos_bearer_type = 1; + lc_config[j]->qos_bearer_type = PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_NON_GBR; + + //TODO: Set the QCI defined in TS 23.203, coded as defined in TS 36.413 + // One less than the actual QCI value. Needs to be generalized + lc_config[j]->has_qci = 1; + lc_config[j]->qci = 1; + if (lc_config[j]->direction == PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_GBR) { + /* TODO all of the need to be taken from API */ + //TODO: Set the max bitrate (UL) + lc_config[j]->has_e_rab_max_bitrate_ul = 0; + lc_config[j]->e_rab_max_bitrate_ul = 0; + //TODO: Set the max bitrate (DL) + lc_config[j]->has_e_rab_max_bitrate_dl = 0; + lc_config[j]->e_rab_max_bitrate_dl = 0; + //TODO: Set the guaranteed bitrate (UL) + lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 0; + lc_config[j]->e_rab_guaranteed_bitrate_ul = 0; + //TODO: Set the guaranteed bitrate (DL) + lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 0; + lc_config[j]->e_rab_guaranteed_bitrate_dl = 0; + } + } + lc_ue_conf->lc_config = lc_config; +} + int flexran_agent_unregister_mac_xface(mid_t mod_id) { if (!agent_mac_xface[mod_id]) { diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h index af93674f0c..f4b281407e 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -87,6 +87,10 @@ void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMess void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, Protocol__FlexCellConfig *conf); +/* Fill the lc_ue_config->lc_config message */ +void flexran_agent_fill_mac_lc_ue_config(mid_t mod_id, mid_t ue_id, + Protocol__FlexLcUeConfig *lc_ue_conf); + /*Register technology specific interface callbacks*/ int flexran_agent_register_mac_xface(mid_t mod_id); diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 04a001ccdc..a6678d52db 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -443,8 +443,6 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl Protocol__FlexLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; xid = (lc_config_request_msg->header)->xid; - int i, j; - Protocol__FlexLcConfigReply *lc_config_reply_msg; lc_config_reply_msg = malloc(sizeof(Protocol__FlexLcConfigReply)); if(lc_config_reply_msg == NULL) @@ -456,82 +454,27 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl lc_config_reply_msg->header = header; - lc_config_reply_msg->n_lc_ue_config = flexran_get_num_ues(mod_id); + /* the lc_config_reply entirely depends on MAC except for the + * mac_eNB_get_rrc_status() function (which in the current OAI implementation + * is reachable if F1 is present). Therefore we check here wether MAC CM is + * present and the message gets properly filled if it is or remains empty if + * not */ + lc_config_reply_msg->n_lc_ue_config = + flexran_agent_get_mac_xface(mod_id) ? flexran_get_num_ues(mod_id) : 0; - Protocol__FlexLcUeConfig **lc_ue_config; + Protocol__FlexLcUeConfig **lc_ue_config = NULL; if (lc_config_reply_msg->n_lc_ue_config > 0) { lc_ue_config = malloc(sizeof(Protocol__FlexLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); if (lc_ue_config == NULL) { goto error; } // Fill the config for each UE - for (i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { + for (int i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { lc_ue_config[i] = malloc(sizeof(Protocol__FlexLcUeConfig)); - protocol__flex_lc_ue_config__init(lc_ue_config[i]); + if (!lc_ue_config[i]) goto error; - lc_ue_config[i]->has_rnti = 1; - lc_ue_config[i]->rnti = flexran_get_ue_crnti(mod_id,i); - - //TODO: Set the number of LC configurations that will be reported for this UE - //Set this according to the current state of the UE. This is only a temporary fix - int status = 0; - status = mac_eNB_get_rrc_status(mod_id, flexran_get_ue_crnti(mod_id, i)); - /* TODO needs to be revised and appropriate API to be implemented */ - if (status < RRC_CONNECTED) { - lc_ue_config[i]->n_lc_config = 0; - } else if (status == RRC_CONNECTED) { - lc_ue_config[i]->n_lc_config = 1; - } else { - lc_ue_config[i]->n_lc_config = 3; - } - - Protocol__FlexLcConfig **lc_config; - if (lc_ue_config[i]->n_lc_config > 0) { - lc_config = malloc(sizeof(Protocol__FlexLcConfig *) * lc_ue_config[i]->n_lc_config); - if (lc_config == NULL) { - goto error; - } - for (j = 0; j < lc_ue_config[i]->n_lc_config; j++) { - lc_config[j] = malloc(sizeof(Protocol__FlexLcConfig)); - protocol__flex_lc_config__init(lc_config[j]); - - lc_config[j]->has_lcid = 1; - lc_config[j]->lcid = j+1; - - int lcg = flexran_get_lcg(mod_id, i, j+1); - if (lcg >= 0 && lcg <= 3) { - lc_config[j]->has_lcg = 1; - lc_config[j]->lcg = flexran_get_lcg(mod_id, i,j+1); - } - - lc_config[j]->has_direction = 1; - lc_config[j]->direction = flexran_get_direction(i,j+1); - //TODO: Bearer type. One of FLQBT_* values. Currently only default bearer supported - lc_config[j]->has_qos_bearer_type = 1; - lc_config[j]->qos_bearer_type = PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_NON_GBR; - - //TODO: Set the QCI defined in TS 23.203, coded as defined in TS 36.413 - // One less than the actual QCI value. Needs to be generalized - lc_config[j]->has_qci = 1; - lc_config[j]->qci = 1; - if (lc_config[j]->direction == PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_GBR) { - /* TODO all of the need to be taken from API */ - //TODO: Set the max bitrate (UL) - lc_config[j]->has_e_rab_max_bitrate_ul = 0; - lc_config[j]->e_rab_max_bitrate_ul = 0; - //TODO: Set the max bitrate (DL) - lc_config[j]->has_e_rab_max_bitrate_dl = 0; - lc_config[j]->e_rab_max_bitrate_dl = 0; - //TODO: Set the guaranteed bitrate (UL) - lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 0; - lc_config[j]->e_rab_guaranteed_bitrate_ul = 0; - //TODO: Set the guaranteed bitrate (DL) - lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 0; - lc_config[j]->e_rab_guaranteed_bitrate_dl = 0; - } - } - lc_ue_config[i]->lc_config = lc_config; - } + protocol__flex_lc_ue_config__init(lc_ue_config[i]); + flexran_agent_fill_mac_lc_ue_config(mod_id, i, lc_ue_config[i]); } // end for UE lc_config_reply_msg->lc_ue_config = lc_ue_config; } // lc_config_reply_msg->n_lc_ue_config > 0 @@ -553,7 +496,7 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl free(lc_config_reply_msg); if(*msg != NULL) free(*msg); - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -- GitLab From e0742be7472ff48a6f1f05890cb38434f90ec91b Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 15:56:23 +0200 Subject: [PATCH 165/308] RAN API flexran_get_num_ues() belongs to MAC, change name --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 4 ++-- openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c | 2 +- openair2/ENB_APP/flexran_agent_common.c | 4 ++-- openair2/ENB_APP/flexran_agent_handler.c | 2 +- openair2/ENB_APP/flexran_agent_ran_api.c | 2 +- openair2/ENB_APP/flexran_agent_ran_api.h | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index c9efccfa72..d857953184 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -891,7 +891,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle /*TODO: Fill in the number of dl HARQ related info, based on the number of currently *transmitting UEs */ - // sf_trigger_msg->n_dl_info = flexran_get_num_ues(mod_id); + // sf_trigger_msg->n_dl_info = flexran_get_mac_num_ues(mod_id); Protocol__FlexDlInfo **dl_info = NULL; @@ -945,7 +945,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle /* Fill in the number of UL reception status related info, based on the number of currently * transmitting UEs */ - sf_trigger_msg->n_ul_info = flexran_get_num_ues(mod_id); + sf_trigger_msg->n_ul_info = flexran_get_mac_num_ues(mod_id); Protocol__FlexUlInfo **ul_info = NULL; diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index 2e6f330275..edaaf6980b 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -269,7 +269,7 @@ void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t* measResults triggered_rrc = true; int num; - num = flexran_get_num_ues (mod_id); + num = flexran_get_mac_num_ues (mod_id); meas_stats = malloc(sizeof(rrc_meas_stats) * num); diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index a6678d52db..112382ce29 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -460,7 +460,7 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl * present and the message gets properly filled if it is or remains empty if * not */ lc_config_reply_msg->n_lc_ue_config = - flexran_agent_get_mac_xface(mod_id) ? flexran_get_num_ues(mod_id) : 0; + flexran_agent_get_mac_xface(mod_id) ? flexran_get_mac_num_ues(mod_id) : 0; Protocol__FlexLcUeConfig **lc_ue_config = NULL; if (lc_config_reply_msg->n_lc_ue_config > 0) { @@ -527,7 +527,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl ue_config_reply_msg->header = header; - ue_config_reply_msg->n_ue_config = flexran_get_num_ues(mod_id); + ue_config_reply_msg->n_ue_config = flexran_get_mac_num_ues(mod_id); Protocol__FlexUeConfig **ue_config; if (ue_config_reply_msg->n_ue_config > 0) { diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index f7a25e1ca4..a5e7713a47 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -241,7 +241,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr //Create a list of all eNB RNTIs and cells //Set the number of UEs and create list with their RNTIs stats configs - report_config.nr_ue = flexran_get_num_ues(mod_id); //eNB_UE_list->num_UEs + report_config.nr_ue = flexran_get_mac_num_ues(mod_id); report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); if (report_config.ue_report_type == NULL) { // TODO: Add appropriate error code diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index f8789e3d71..c274455a53 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -108,7 +108,7 @@ uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time) return sfn_sf; } -int flexran_get_num_ues(mid_t mod_id) +int flexran_get_mac_num_ues(mid_t mod_id) { if (!mac_is_present(mod_id)) return 0; return RC.mac[mod_id]->UE_list.num_UEs; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index b0e3f941a7..2b0652939a 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -70,8 +70,8 @@ uint16_t flexran_get_sfn_sf(mid_t mod_id); rest for frame */ uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time); -/* Return the number of attached UEs */ -int flexran_get_num_ues(mid_t mod_id); +/* Return the number of attached UEs for the MAC */ +int flexran_get_mac_num_ues(mid_t mod_id); /* Get the number of logical channels per UE. This function does not consider * dedicated bearers yet */ -- GitLab From fdd47e5701c08467b444a910c5c9857181ab0448 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 16:20:48 +0200 Subject: [PATCH 166/308] RAN API: add functions for getting UE RNTIs directly from RRC --- openair2/ENB_APP/flexran_agent_ran_api.c | 28 ++++++++++++++++++++++++ openair2/ENB_APP/flexran_agent_ran_api.h | 10 +++++++++ 2 files changed, 38 insertions(+) diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index c274455a53..15532e086b 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -747,7 +747,35 @@ uint8_t flexran_get_num_pdcch_symb(mid_t mod_id, uint8_t cc_id) * Get Messages for UE Configuration Reply * ************************************ */ +int flexran_get_rrc_num_ues(mid_t mod_id) +{ + if (!rrc_is_present(mod_id)) return 0; + return RC.rrc[mod_id]->Nb_ue; +} +rnti_t flexran_get_rrc_rnti_nth_ue(mid_t mod_id, int index) +{ + if (!rrc_is_present(mod_id)) return 0; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[mod_id]->rrc_ue_head) { + if (index == 0) return ue_context_p->ue_context.rnti; + --index; + } + return 0; +} + +int flexran_get_rrc_rnti_list(mid_t mod_id, rnti_t *list, int max_list) +{ + if (!rrc_is_present(mod_id)) return 0; + int n = 0; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[mod_id]->rrc_ue_head) { + if (n >= max_list) break; + list[n] = ue_context_p->ue_context.rnti; + ++n; + } + return n; +} TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index 2b0652939a..ada2cbd30c 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -304,6 +304,16 @@ Protocol__FlexPhichDuration flexran_get_phich_duration(mid_t mod_id, uint8_t cc_ * Get Messages for UE Configuration Reply * ************************************ */ +/* Get the number of attached UEs for the RRC */ +int flexran_get_rrc_num_ues(mid_t mod_id); + +/* Get the RNTI of UE at index 'index' in RRC list */ +rnti_t flexran_get_rrc_rnti_nth_ue(mid_t mod_id, int index); + +/* Get the list of RNTIs of up to max_list entries. When max_list >= + * flexran_get_rrc_num_ues(), gets a list of all UEs registered in the RRC. UE + * RNTIs are saved in list, returns number of saved RNTIs */ +int flexran_get_rrc_rnti_list(mid_t mod_id, rnti_t *list, int max_list); /* Get timer in subframes. Controls the synchronization status of the UE, not the actual timing -- GitLab From 1fc631e2a4d6c5aa1e67f5c17d52b5a00b87ce6d Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 19:22:23 +0200 Subject: [PATCH 167/308] RAN API RRC part: Change interface to RNTI, change flexran_get_aperiodic_cqi_rep_mode() * the RAN API RRC part now takes rnti and does not look it up in the MAC every time again * the function flexran_get_aperiodic_cqi_rep_mode() has been changed to return a proper protobuf variable, not OAI typedef --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 6 +- .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 166 ++++++++-------- .../ENB_APP/MESSAGES/V2/config_common.proto | 5 +- openair2/ENB_APP/flexran_agent_common.c | 103 +++++----- openair2/ENB_APP/flexran_agent_handler.c | 2 +- openair2/ENB_APP/flexran_agent_ran_api.c | 180 ++++++------------ openair2/ENB_APP/flexran_agent_ran_api.h | 74 +++---- 7 files changed, 235 insertions(+), 301 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index d857953184..162e5b0590 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -911,7 +911,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle if(dl_info[i] == NULL) goto error; protocol__flex_dl_info__init(dl_info[i]); - dl_info[i]->rnti = flexran_get_ue_crnti(mod_id, UE_id); + dl_info[i]->rnti = flexran_get_mac_ue_crnti(mod_id, UE_id); dl_info[i]->has_rnti = 1; /*Fill in the right id of this round's HARQ process for this UE*/ // uint8_t harq_id; @@ -959,7 +959,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle if(ul_info[i] == NULL) goto error; protocol__flex_ul_info__init(ul_info[i]); - ul_info[i]->rnti = flexran_get_ue_crnti(mod_id, i); + ul_info[i]->rnti = flexran_get_mac_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; /* Fill in the Tx power control command for this UE (if available), * primary carrier */ @@ -1375,7 +1375,7 @@ void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, void flexran_agent_fill_mac_lc_ue_config(mid_t mod_id, mid_t ue_id, Protocol__FlexLcUeConfig *lc_ue_conf) { - lc_ue_conf->rnti = flexran_get_ue_crnti(mod_id, ue_id); + lc_ue_conf->rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); lc_ue_conf->has_rnti = 1; lc_ue_conf->n_lc_config = flexran_get_num_ue_lcs(mod_id, ue_id); diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index edaaf6980b..02180cc756 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -74,20 +74,22 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch config->rnti = rnti; } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED || state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED) { - int i = find_UE_id(mod_id, rnti); + // TODO this goes into the MAC CM */ + //int i = find_UE_id(mod_id, rnti); config->has_rnti = 1; config->rnti = rnti; - if(flexran_get_time_alignment_timer(mod_id,i) != -1) { - config->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i); + /* RNTI correct */ + if(flexran_get_time_alignment_timer(mod_id, rnti) != -1) { + config->time_alignment_timer = flexran_get_time_alignment_timer(mod_id, rnti); config->has_time_alignment_timer = 1; } - if(flexran_get_meas_gap_config(mod_id,i) != -1){ - config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i); + if(flexran_get_meas_gap_config(mod_id, rnti) != -1){ + config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id, rnti); config->has_meas_gap_config_pattern = 1; } if(config->has_meas_gap_config_pattern == 1 && config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { - config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i); + config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id, rnti); config->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) @@ -99,107 +101,104 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch //TODO: Set the CQI configuration (Optional) //We do not set it for now - if(flexran_get_ue_transmission_mode(mod_id,i) != -1) { - config->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i); + if(flexran_get_ue_transmission_mode(mod_id, rnti) != -1) { + config->transmission_mode = flexran_get_ue_transmission_mode(mod_id, rnti); config->has_transmission_mode = 1; } - config->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i); - config->has_ue_aggregated_max_bitrate_ul = 1; + /* TODO into MAC CM */ + //config->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i); + //config->has_ue_aggregated_max_bitrate_ul = 1; - config->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i); - config->has_ue_aggregated_max_bitrate_dl = 1; + /* TODO into MAC CM */ + //config->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i); + //config->has_ue_aggregated_max_bitrate_dl = 1; - //TODO: Set the UE capabilities Protocol__FlexUeCapabilities *c_capabilities; c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); protocol__flex_ue_capabilities__init(c_capabilities); - //TODO: Set half duplex (FDD operation) - c_capabilities->has_half_duplex = 0; - c_capabilities->half_duplex = 1;//flexran_get_half_duplex(i); - //TODO: Set intra-frame hopping flag - c_capabilities->has_intra_sf_hopping = 0; - c_capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i); - //TODO: Set support for type 2 hopping with n_sb > 1 - c_capabilities->has_type2_sb_1 = 0; - c_capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i); - //TODO: Set ue category - c_capabilities->has_ue_category = 0; - c_capabilities->ue_category = 1;//flexran_get_ue_category(i); - //TODO: Set UE support for resource allocation type 1 - c_capabilities->has_res_alloc_type1 = 0; - c_capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i); - //Set the capabilites to the message + + c_capabilities->has_half_duplex = 1; + c_capabilities->half_duplex = flexran_get_half_duplex(mod_id, rnti); + + c_capabilities->has_intra_sf_hopping = 1; + c_capabilities->intra_sf_hopping = flexran_get_intra_sf_hopping(mod_id, rnti); + + c_capabilities->has_type2_sb_1 = 1; + c_capabilities->type2_sb_1 = flexran_get_type2_sb_1(mod_id, rnti); + + c_capabilities->has_ue_category = 1; + c_capabilities->ue_category = flexran_get_ue_category(mod_id, rnti); + + c_capabilities->has_res_alloc_type1 = 1; + c_capabilities->res_alloc_type1 = flexran_get_res_alloc_type1(mod_id, rnti); + config->capabilities = c_capabilities; - if(flexran_get_ue_transmission_antenna(mod_id,i) != -1) { + if(flexran_get_ue_transmission_antenna(mod_id, rnti) != -1) { config->has_ue_transmission_antenna = 1; - config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i); + config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id, rnti); } - if(flexran_get_tti_bundling(mod_id,i) != -1) { + if (flexran_get_tti_bundling(mod_id, rnti) != -1) { config->has_tti_bundling = 1; - config->tti_bundling = flexran_get_tti_bundling(mod_id,i); + config->tti_bundling = flexran_get_tti_bundling(mod_id, rnti); } - if(flexran_get_maxHARQ_TX(mod_id,i) != -1){ + if(flexran_get_maxHARQ_TX(mod_id, rnti) != -1){ config->has_max_harq_tx = 1; - config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i); + config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id, rnti); } - if(flexran_get_beta_offset_ack_index(mod_id,i) != -1) { + if(flexran_get_beta_offset_ack_index(mod_id, rnti) != -1) { config->has_beta_offset_ack_index = 1; - config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i); + config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id, rnti); } - if(flexran_get_beta_offset_ri_index(mod_id,i) != -1) { + if(flexran_get_beta_offset_ri_index(mod_id, rnti) != -1) { config->has_beta_offset_ri_index = 1; - config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i); + config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id, rnti); } - if(flexran_get_beta_offset_cqi_index(mod_id,i) != -1) { + if(flexran_get_beta_offset_cqi_index(mod_id, rnti) != -1) { config->has_beta_offset_cqi_index = 1; - config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i); + config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id, rnti); } /* assume primary carrier */ - if(flexran_get_ack_nack_simultaneous_trans(mod_id,i,0) != -1) { + if(flexran_get_ack_nack_simultaneous_trans(mod_id,0) != -1) { config->has_ack_nack_simultaneous_trans = 1; - config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i,0); + config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,0); } - if(flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) { + if(flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti) != -1) { config->has_simultaneous_ack_nack_cqi = 1; - config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i); + config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti); } - if(flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) { + if(flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti) != -1) { config->has_aperiodic_cqi_rep_mode = 1; - int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i); - if (mode > 4) { - config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; - } else { - config->aperiodic_cqi_rep_mode = mode; - } + config->aperiodic_cqi_rep_mode = flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti); } - if(flexran_get_tdd_ack_nack_feedback_mode(mod_id, i) != -1) { + if(flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti) != -1) { config->has_tdd_ack_nack_feedback = 1; - config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id,i); + config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti); } - if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) { + if(flexran_get_ack_nack_repetition_factor(mod_id, rnti) != -1) { config->has_ack_nack_repetition_factor = 1; - config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i); + config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id, rnti); } - if(flexran_get_extended_bsr_size(mod_id, i) != -1) { + if(flexran_get_extended_bsr_size(mod_id, rnti) != -1) { config->has_extended_bsr_size = 1; - config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i); + config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id, rnti); } - config->has_pcell_carrier_index = 1; - config->pcell_carrier_index = UE_PCCID(mod_id, i); + // TODO this goes into the MAC CM + //config->has_pcell_carrier_index = 1; + //config->pcell_carrier_index = UE_PCCID(mod_id, i); //TODO: Set carrier aggregation support (boolean) config->has_ca_support = 0; config->ca_support = 0; @@ -261,24 +260,25 @@ int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { /* this is called by RRC as a part of rrc xface . The controller previously requested this*/ void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t* measResults) { - int i; // int priority = 0; // Warning Preventing // void *data; // int size; // err_code_t err_code = -100; triggered_rrc = true; - int num; - num = flexran_get_mac_num_ues (mod_id); + int num = flexran_get_rrc_num_ues (mod_id); + rnti_t rntis[num]; + flexran_get_rrc_rnti_list(mod_id, rntis, num); meas_stats = malloc(sizeof(rrc_meas_stats) * num); - for (i = 0; i < num; i++){ - meas_stats[i].rnti = flexran_get_ue_crnti(mod_id, i); - meas_stats[i].meas_id = flexran_get_rrc_pcell_measid(mod_id,i); - meas_stats[i].rsrp = flexran_get_rrc_pcell_rsrp(mod_id,i) - 140; + for (int i = 0; i < num; i++){ + const rnti_t rnti = rntis[i]; + meas_stats[i].rnti = rnti; + meas_stats[i].meas_id = flexran_get_rrc_pcell_measid(mod_id, rnti); + meas_stats[i].rsrp = flexran_get_rrc_pcell_rsrp(mod_id, rnti) - 140; // measResults->measResultPCell.rsrpResult - 140; - meas_stats[i].rsrq = flexran_get_rrc_pcell_rsrq(mod_id,i)/2 - 20; + meas_stats[i].rsrq = flexran_get_rrc_pcell_rsrq(mod_id, rnti)/2 - 20; // (measResults->measResultPCell.rsrqResult)/2 - 20; } @@ -489,14 +489,12 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report) { - - // Protocol__FlexHeader *header; - int i,j; - - /* Allocate memory for list of UE reports */ if (report_config->nr_ue > 0) { + rnti_t rntis[report_config->nr_ue]; + flexran_get_rrc_rnti_list(mod_id, rntis, report_config->nr_ue); - for (i = 0; i < report_config->nr_ue; i++) { + for (int i = 0; i < report_config->nr_ue; i++) { + const rnti_t rnti = rntis[i]; /* Check flag for creation of buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS) { @@ -508,13 +506,13 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, goto error; protocol__flex_rrc_measurements__init(rrc_measurements); - rrc_measurements->measid = flexran_get_rrc_pcell_measid(mod_id,i); + rrc_measurements->measid = flexran_get_rrc_pcell_measid(mod_id, rnti); rrc_measurements->has_measid = 1; - rrc_measurements->pcell_rsrp = flexran_get_rrc_pcell_rsrp(mod_id,i); + rrc_measurements->pcell_rsrp = flexran_get_rrc_pcell_rsrp(mod_id, rnti); rrc_measurements->has_pcell_rsrp = 1; - rrc_measurements->pcell_rsrq = flexran_get_rrc_pcell_rsrq(mod_id,i); + rrc_measurements->pcell_rsrq = flexran_get_rrc_pcell_rsrq(mod_id, rnti); rrc_measurements->has_pcell_rsrq = 1 ; @@ -526,7 +524,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, protocol__flex_neigh_cells_measurements__init(neigh_meas); - neigh_meas->n_eutra_meas = flexran_get_rrc_num_ncell(mod_id, i); + neigh_meas->n_eutra_meas = flexran_get_rrc_num_ncell(mod_id, rnti); Protocol__FlexEutraMeasurements **eutra_meas = NULL; @@ -536,7 +534,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, if (eutra_meas == NULL) goto error; - for (j = 0; j < neigh_meas->n_eutra_meas; j++ ){ + for (int j = 0; j < neigh_meas->n_eutra_meas; j++ ){ eutra_meas[j] = malloc(sizeof(Protocol__FlexEutraMeasurements)); if (eutra_meas[j] == NULL) @@ -544,7 +542,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, protocol__flex_eutra_measurements__init(eutra_meas[j]); - eutra_meas[j]->phys_cell_id = flexran_get_rrc_neigh_phy_cell_id(mod_id, i, j); + eutra_meas[j]->phys_cell_id = flexran_get_rrc_neigh_phy_cell_id(mod_id, rnti, j); eutra_meas[j]->has_phys_cell_id = 1; @@ -555,10 +553,10 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, protocol__flex_eutra_ref_signal_meas__init(meas_result); - meas_result->rsrp = flexran_get_rrc_neigh_rsrp(mod_id, i, eutra_meas[j]->phys_cell_id); + meas_result->rsrp = flexran_get_rrc_neigh_rsrp(mod_id, rnti, eutra_meas[j]->phys_cell_id); meas_result->has_rsrp = 1; - meas_result->rsrq = flexran_get_rrc_neigh_rsrq(mod_id, i, eutra_meas[j]->phys_cell_id); + meas_result->rsrq = flexran_get_rrc_neigh_rsrq(mod_id, rnti, eutra_meas[j]->phys_cell_id); meas_result->has_rsrq = 1; eutra_meas[j]->meas_result = meas_result; @@ -620,10 +618,10 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, error: - for (i = 0; i < report_config->nr_ue; i++){ + for (int i = 0; i < report_config->nr_ue; i++){ if (ue_report[i]->rrc_measurements->neigh_meas != NULL){ - for (j = 0; j < flexran_get_rrc_num_ncell(mod_id, i); j++){ + for (int j = 0; j < ue_report[i]->rrc_measurements->neigh_meas->n_eutra_meas; j++){ free(ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]); } diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index 7b392b6b3b..1ee758fafd 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -137,6 +137,9 @@ enum flex_aperiodic_cqi_report_mode { FLACRM_RM30 = 3; FLACRM_RM31 = 4; FLACRM_NONE = 5; + FLACRM_RM32_v1250 = 6; + FLACRM_RM10_v1310 = 7; + FLACRM_RM11_v1310 = 8; } enum flex_tdd_ack_nack_feedback_mode { @@ -177,4 +180,4 @@ enum flex_ue_state_change_type { FLUESC_ACTIVATED = 1; FLUESC_DEACTIVATED = 2; FLUESC_MOVED = 3; -} \ No newline at end of file +} diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 112382ce29..df61a03cde 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -527,7 +527,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl ue_config_reply_msg->header = header; - ue_config_reply_msg->n_ue_config = flexran_get_mac_num_ues(mod_id); + ue_config_reply_msg->n_ue_config = flexran_get_rrc_num_ues(mod_id); Protocol__FlexUeConfig **ue_config; if (ue_config_reply_msg->n_ue_config > 0) { @@ -535,30 +535,34 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl if (ue_config == NULL) { goto error; } + rnti_t rntis[ue_config_reply_msg->n_ue_config]; + flexran_get_rrc_rnti_list(mod_id, rntis, ue_config_reply_msg->n_ue_config); for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { + const rnti_t rnti = rntis[i]; ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); protocol__flex_ue_config__init(ue_config[i]); - ue_config[i]->rnti = flexran_get_ue_crnti(mod_id,i); + /* correct RNTI */ + ue_config[i]->rnti = rnti; ue_config[i]->has_rnti = 1; - ue_config[i]->imsi = flexran_get_ue_imsi(mod_id, i); + ue_config[i]->imsi = flexran_get_ue_imsi(mod_id, rnti); ue_config[i]->has_imsi = 1; //TODO: Set the DRX configuration (optional) //Not supported for now, so we do not set it - if (flexran_get_time_alignment_timer(mod_id,i) != -1) { - ue_config[i]->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i); + if (flexran_get_time_alignment_timer(mod_id, rnti) != -1) { + ue_config[i]->time_alignment_timer = flexran_get_time_alignment_timer(mod_id, rnti); ue_config[i]->has_time_alignment_timer = 1; } - if (flexran_get_meas_gap_config(mod_id,i) != -1) { - ue_config[i]->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i); + if (flexran_get_meas_gap_config(mod_id, rnti) != -1) { + ue_config[i]->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id, rnti); ue_config[i]->has_meas_gap_config_pattern = 1; } if (ue_config[i]->has_meas_gap_config_pattern == 1 && - ue_config[i]->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { - ue_config[i]->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i); + ue_config[i]->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { + ue_config[i]->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id, rnti); ue_config[i]->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) @@ -570,104 +574,101 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl //TODO: Set the CQI configuration (Optional) //We do not set it for now - if (flexran_get_ue_transmission_mode(mod_id,i) != -1) { - ue_config[i]->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i); + if (flexran_get_ue_transmission_mode(mod_id, rnti) != -1) { + ue_config[i]->transmission_mode = flexran_get_ue_transmission_mode(mod_id, rnti); ue_config[i]->has_transmission_mode = 1; } - ue_config[i]->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i); - ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; + /* into MAC CM */ + //ue_config[i]->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i); + //ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; - ue_config[i]->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i); - ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; + //ue_config[i]->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i); + //ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; Protocol__FlexUeCapabilities *capabilities; capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); protocol__flex_ue_capabilities__init(capabilities); capabilities->has_half_duplex = 1; - capabilities->half_duplex = flexran_get_half_duplex(mod_id, i); + capabilities->half_duplex = flexran_get_half_duplex(mod_id, rnti); capabilities->has_intra_sf_hopping = 1; - capabilities->intra_sf_hopping = flexran_get_intra_sf_hopping(mod_id, i); + capabilities->intra_sf_hopping = flexran_get_intra_sf_hopping(mod_id, rnti); capabilities->has_type2_sb_1 = 1; - capabilities->type2_sb_1 = flexran_get_type2_sb_1(mod_id, i); + capabilities->type2_sb_1 = flexran_get_type2_sb_1(mod_id, rnti); capabilities->has_ue_category = 1; - capabilities->ue_category = flexran_get_ue_category(mod_id, i); + capabilities->ue_category = flexran_get_ue_category(mod_id, rnti); capabilities->has_res_alloc_type1 = 1; - capabilities->res_alloc_type1 = flexran_get_res_alloc_type1(mod_id, i); + capabilities->res_alloc_type1 = flexran_get_res_alloc_type1(mod_id, rnti); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; - if (flexran_get_ue_transmission_antenna(mod_id,i) != -1) { + if (flexran_get_ue_transmission_antenna(mod_id, rnti) != -1) { ue_config[i]->has_ue_transmission_antenna = 1; - ue_config[i]->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i); + ue_config[i]->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id, rnti); } - if (flexran_get_tti_bundling(mod_id,i) != -1) { + if (flexran_get_tti_bundling(mod_id, rnti) != -1) { ue_config[i]->has_tti_bundling = 1; - ue_config[i]->tti_bundling = flexran_get_tti_bundling(mod_id,i); + ue_config[i]->tti_bundling = flexran_get_tti_bundling(mod_id, rnti); } - if (flexran_get_maxHARQ_TX(mod_id,i) != -1) { + if (flexran_get_maxHARQ_TX(mod_id, rnti) != -1) { ue_config[i]->has_max_harq_tx = 1; - ue_config[i]->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i); + ue_config[i]->max_harq_tx = flexran_get_maxHARQ_TX(mod_id, rnti); } - if (flexran_get_beta_offset_ack_index(mod_id,i) != -1) { + if (flexran_get_beta_offset_ack_index(mod_id, rnti) != -1) { ue_config[i]->has_beta_offset_ack_index = 1; - ue_config[i]->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i); + ue_config[i]->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id, rnti); } - if (flexran_get_beta_offset_ri_index(mod_id,i) != -1) { + if (flexran_get_beta_offset_ri_index(mod_id, rnti) != -1) { ue_config[i]->has_beta_offset_ri_index = 1; - ue_config[i]->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i); + ue_config[i]->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id, rnti); } - if (flexran_get_beta_offset_cqi_index(mod_id,i) != -1) { + if (flexran_get_beta_offset_cqi_index(mod_id, rnti) != -1) { ue_config[i]->has_beta_offset_cqi_index = 1; - ue_config[i]->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i); + ue_config[i]->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id, rnti); } /* assume primary carrier */ - if (flexran_get_ack_nack_simultaneous_trans(mod_id, i, 0) != -1) { + if (flexran_get_ack_nack_simultaneous_trans(mod_id, 0) != -1) { ue_config[i]->has_ack_nack_simultaneous_trans = 1; - ue_config[i]->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id, i, 0); + ue_config[i]->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id, 0); } - if (flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) { + if (flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti) != -1) { ue_config[i]->has_simultaneous_ack_nack_cqi = 1; - ue_config[i]->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i); + ue_config[i]->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti); } - if (flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) { + if (flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti) != -1) { ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i); - if (mode > 4) { - ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; - } else { - ue_config[i]->aperiodic_cqi_rep_mode = mode; - } + ue_config[i]->aperiodic_cqi_rep_mode = flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti); } - if (flexran_get_tdd_ack_nack_feedback_mode(mod_id, i) != -1) { + if (flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti) != -1) { ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id,i); + ue_config[i]->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti); } - if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) { + if(flexran_get_ack_nack_repetition_factor(mod_id, rnti) != -1) { ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i); + ue_config[i]->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id, rnti); } - if (flexran_get_extended_bsr_size(mod_id, i) != -1) { + if (flexran_get_extended_bsr_size(mod_id, rnti) != -1) { ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i); + ue_config[i]->extended_bsr_size = flexran_get_extended_bsr_size(mod_id, rnti); } //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; - ue_config[i]->has_pcell_carrier_index = 1; - ue_config[i]->pcell_carrier_index = UE_PCCID(mod_id, i); + /* into MAC CM */ + //ue_config[i]->has_pcell_carrier_index = 1; + //ue_config[i]->pcell_carrier_index = UE_PCCID(mod_id, i); if(ue_config[i]->has_ca_support){ //TODO: Set cross carrier scheduling support (boolean) ue_config[i]->has_cross_carrier_sched_support = 0; diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index a5e7713a47..dd8a569dc0 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -249,7 +249,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr goto error; } for (i = 0; i < report_config.nr_ue; i++) { - report_config.ue_report_type[i].ue_rnti = flexran_get_ue_crnti(enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti; + report_config.ue_report_type[i].ue_rnti = flexran_get_mac_ue_crnti(enb_id, i); report_config.ue_report_type[i].ue_report_flags = ue_flags; } //Set the number of CCs and create a list with the cell stats configs diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 15532e086b..45976559e4 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -118,7 +118,7 @@ int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id) { if (!mac_is_present(mod_id)) return 0; // Not sure whether this is needed: if (!rrc_is_present(mod_id)) return 0; - const rnti_t rnti = flexran_get_ue_crnti(mod_id, ue_id); + const rnti_t rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); const int s = mac_eNB_get_rrc_status(mod_id, rnti); if (s < RRC_CONNECTED) return 0; @@ -128,7 +128,7 @@ int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id) return 3; } -rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id) +rnti_t flexran_get_mac_ue_crnti(mid_t mod_id, mid_t ue_id) { if (!mac_is_present(mod_id)) return 0; return UE_RNTI(mod_id, ue_id); @@ -155,7 +155,7 @@ uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id) rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { if (!mac_is_present(mod_id)) return 0; - rnti_t rnti = flexran_get_ue_crnti(mod_id, ue_id); + rnti_t rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0 @@ -169,7 +169,7 @@ rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logi rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { if (!mac_is_present(mod_id)) return 0; - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + rnti_t rnti = flexran_get_mac_ue_crnti(mod_id,ue_id); frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0 @@ -183,7 +183,7 @@ rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, lo frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { if (!mac_is_present(mod_id)) return 0; - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + rnti_t rnti = flexran_get_mac_ue_crnti(mod_id,ue_id); frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, subframe, ENB_FLAG_YES, MBMS_FLAG_NO, channel_id, 0 @@ -457,7 +457,7 @@ int flexran_get_harq(mid_t mod_id, if (mac_xface_not_ready()) return 0 ; - uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + uint16_t rnti = flexran_get_mac_ue_crnti(mod_id,ue_id); if (harq_flag == openair_harq_DL){ mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&harq_round,openair_harq_DL); @@ -777,25 +777,19 @@ int flexran_get_rrc_rnti_list(mid_t mod_id, rnti_t *list, int max_list) return n; } -TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id) +TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.mac_MainConfig) return -1; return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated; } -Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id) +Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measGapConfig) return -1; if (ue_context_p->ue_context.measGapConfig->present != MeasGapConfig_PR_setup) return -1; @@ -810,13 +804,10 @@ Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid } -long flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) +long flexran_get_meas_gap_config_offset(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measGapConfig) return -1; if (ue_context_p->ue_context.measGapConfig->present != MeasGapConfig_PR_setup) return -1; @@ -830,13 +821,10 @@ long flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) } } -uint8_t flexran_get_rrc_status(mid_t mod_id, mid_t ue_id) +uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return 0; - - rnti_t rnti = flexran_get_ue_crnti(mod_id, ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return RRC_INACTIVE; return ue_context_p->ue_context.Status; } @@ -853,13 +841,10 @@ uint64_t flexran_get_ue_aggregated_max_bitrate_ul(mid_t mod_id, mid_t ue_id) return RC.mac[mod_id]->UE_list.UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL; } -int flexran_get_half_duplex(mid_t mod_id, mid_t ue_id) +int flexran_get_half_duplex(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.UE_Capability) return -1; SupportedBandListEUTRA_t *bands = &ue_context_p->ue_context.UE_Capability->rf_Parameters.supportedBandListEUTRA; @@ -869,13 +854,10 @@ int flexran_get_half_duplex(mid_t mod_id, mid_t ue_id) return 0; } -int flexran_get_intra_sf_hopping(mid_t mod_id, mid_t ue_id) +int flexran_get_intra_sf_hopping(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.UE_Capability) return -1; if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1; @@ -887,13 +869,10 @@ int flexran_get_intra_sf_hopping(mid_t mod_id, mid_t ue_id) return (buf >> 7) & 1; } -int flexran_get_type2_sb_1(mid_t mod_id, mid_t ue_id) +int flexran_get_type2_sb_1(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.UE_Capability) return -1; if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1; @@ -906,25 +885,19 @@ int flexran_get_type2_sb_1(mid_t mod_id, mid_t ue_id) return (buf >> 3) & 1; } -long flexran_get_ue_category(mid_t mod_id, mid_t ue_id) +long flexran_get_ue_category(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.UE_Capability) return -1; return ue_context_p->ue_context.UE_Capability->ue_Category; } -int flexran_get_res_alloc_type1(mid_t mod_id, mid_t ue_id) +int flexran_get_res_alloc_type1(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.UE_Capability) return -1; if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1; @@ -936,24 +909,19 @@ int flexran_get_res_alloc_type1(mid_t mod_id, mid_t ue_id) return (buf >> 6) & 1; } -long flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) +long flexran_get_ue_transmission_mode(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->antennaInfo) return -1; return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; } -BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id) +BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); if (!ue_context_p) return -1; if (!ue_context_p->ue_context.mac_MainConfig) return -1; @@ -961,65 +929,50 @@ BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id) return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling; } -long flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) +long flexran_get_maxHARQ_TX(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.mac_MainConfig) return -1; if (!ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config) return -1; return *(ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx); } -long flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) +long flexran_get_beta_offset_ack_index(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1; return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index; } -long flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) +long flexran_get_beta_offset_ri_index(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1; return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; } -long flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) +long flexran_get_beta_offset_cqi_index(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1; return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; } -BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) +BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig) return -1; @@ -1027,33 +980,46 @@ BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI; } -BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, mid_t ue_id, uint8_t cc_id) +BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, uint8_t cc_id) { if (!rrc_is_present(mod_id)) return -1; if (!RC.rrc[mod_id]->carrier[cc_id].sib2) return -1; return RC.rrc[mod_id]->carrier[cc_id].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } -CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) +Protocol__FlexAperiodicCqiReportMode flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig) return -1; - return *ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; + switch (*ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) { + case CQI_ReportModeAperiodic_rm12: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM12; + case CQI_ReportModeAperiodic_rm20: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM20; + case CQI_ReportModeAperiodic_rm22: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM22; + case CQI_ReportModeAperiodic_rm30: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM30; + case CQI_ReportModeAperiodic_rm31: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM31; + case CQI_ReportModeAperiodic_rm32_v1250: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM32_v1250; + case CQI_ReportModeAperiodic_rm10_v1310: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM10_v1310; + case CQI_ReportModeAperiodic_rm11_v1310: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM11_v1310; + default: + return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; + } } -long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, mid_t ue_id) +long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated) return -1; @@ -1061,26 +1027,20 @@ long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, mid_t ue_id) return *(ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode); } -long flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) +long flexran_get_ack_nack_repetition_factor(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated) return -1; return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor; } -long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id) +long flexran_get_extended_bsr_size(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.mac_MainConfig) return -1; if (!ue_context_p->ue_context.mac_MainConfig->ext2) return -1; @@ -1088,13 +1048,10 @@ long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id) return *(ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10); } -int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) +int flexran_get_ue_transmission_antenna(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->antennaInfo) return -1; @@ -1108,16 +1065,12 @@ int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) } } -uint64_t flexran_get_ue_imsi(mid_t mod_id, mid_t ue_id) +uint64_t flexran_get_ue_imsi(mid_t mod_id, rnti_t rnti) { uint64_t imsi; if (!rrc_is_present(mod_id)) return 0; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return 0; - imsi = ue_context_p->ue_context.imsi.digit15; imsi += ue_context_p->ue_context.imsi.digit14 * 10; // pow(10, 1) imsi += ue_context_p->ue_context.imsi.digit13 * 100; // pow(10, 2) @@ -1371,50 +1324,38 @@ uint32_t flexran_get_pdcp_rx_oo(const mid_t mod_id, const mid_t ue_id, const lc /******************** RRC *****************************/ -MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id) +MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; return ue_context_p->ue_context.measResults->measId; } -float flexran_get_rrc_pcell_rsrp(mid_t mod_id, mid_t ue_id) +float flexran_get_rrc_pcell_rsrp(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; return RSRP_meas_mapping[ue_context_p->ue_context.measResults->measResultPCell.rsrpResult]; } -float flexran_get_rrc_pcell_rsrq(mid_t mod_id, mid_t ue_id) +float flexran_get_rrc_pcell_rsrq(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; return RSRQ_meas_mapping[ue_context_p->ue_context.measResults->measResultPCell.rsrqResult]; } /*Number of neighbouring cells for specific UE*/ -int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id) +int flexran_get_rrc_num_ncell(mid_t mod_id, rnti_t rnti) { if (!rrc_is_present(mod_id)) return 0; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return 0; if (!ue_context_p->ue_context.measResults) return 0; if (!ue_context_p->ue_context.measResults->measResultNeighCells) return 0; @@ -1422,13 +1363,10 @@ int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id) return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count; } -PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id) +long flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, rnti_t rnti, long cell_id) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; @@ -1437,13 +1375,10 @@ PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int ce return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->physCellId; } -float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id) +float flexran_get_rrc_neigh_rsrp(mid_t mod_id, rnti_t rnti, long cell_id) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; @@ -1453,13 +1388,10 @@ float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id) return RSRP_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrpResult)]; } -float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id) +float flexran_get_rrc_neigh_rsrq(mid_t mod_id, rnti_t rnti, long cell_id) { if (!rrc_is_present(mod_id)) return -1; - - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index ada2cbd30c..766b9bc3b7 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -77,8 +77,8 @@ int flexran_get_mac_num_ues(mid_t mod_id); * dedicated bearers yet */ int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id); -/* Get the rnti of a UE with id ue_id */ -rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id); +/* Get the rnti of a UE with id ue_id from MAC */ +rnti_t flexran_get_mac_ue_crnti(mid_t mod_id, mid_t ue_id); /* Get the RLC buffer status report in bytes of a ue for a designated * logical channel id */ @@ -318,13 +318,13 @@ int flexran_get_rrc_rnti_list(mid_t mod_id, rnti_t *list, int max_list); /* Get timer in subframes. Controls the synchronization status of the UE, not the actual timing advance procedure. See TS 36.321 */ -TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id); +TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, rnti_t rnti); /* Get measurement gap configuration. See TS 36.133 */ -Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id); +Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, rnti_t rnti); /* Get measurement gap configuration offset if applicable */ -long flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); +long flexran_get_meas_gap_config_offset(mid_t mod_id, rnti_t rnti); /* DL aggregated bit-rate of non-gbr bearer per UE. See TS 36.413 */ @@ -335,62 +335,62 @@ uint64_t flexran_get_ue_aggregated_max_bitrate_dl(mid_t mod_id, mid_t ue_id); uint64_t flexran_get_ue_aggregated_max_bitrate_ul(mid_t mod_id, mid_t ue_id); /* Only half-duplex support. FDD operation. Boolean value */ -int flexran_get_half_duplex(mid_t mod_id, mid_t ue_id); +int flexran_get_half_duplex(mid_t mod_id, rnti_t rnti); /* Support of intra-subframe hopping. Boolean value */ -int flexran_get_intra_sf_hopping(mid_t mod_id, mid_t ue_id); +int flexran_get_intra_sf_hopping(mid_t mod_id, rnti_t rnti); /* UE support for type 2 hopping with n_sb>1 */ -int flexran_get_type2_sb_1(mid_t mod_id, mid_t ue_id); +int flexran_get_type2_sb_1(mid_t mod_id, rnti_t rnti); /* Get the UE category */ -long flexran_get_ue_category(mid_t mod_id, mid_t ue_id); +long flexran_get_ue_category(mid_t mod_id, rnti_t rnti); /* UE support for resource allocation type 1 */ -int flexran_get_res_alloc_type1(mid_t mod_id, mid_t ue_id); +int flexran_get_res_alloc_type1(mid_t mod_id, rnti_t rnti); /* Get UE transmission mode */ -long flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); +long flexran_get_ue_transmission_mode(mid_t mod_id, rnti_t rnti); /* Boolean value. See TS 36.321 */ -BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id); +BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, rnti_t rnti); /* The max HARQ retransmission for UL. See TS 36.321 */ -long flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); +long flexran_get_maxHARQ_TX(mid_t mod_id, rnti_t rnti); /* See TS 36.213 */ -long flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); +long flexran_get_beta_offset_ack_index(mid_t mod_id, rnti_t rnti); /* See TS 36.213 */ -long flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); +long flexran_get_beta_offset_ri_index(mid_t mod_id, rnti_t rnti); /* See TS 36.213 */ -long flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); +long flexran_get_beta_offset_cqi_index(mid_t mod_id, rnti_t rnti); /* Boolean. See TS36.213, Section 10.1 */ -BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); +BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, rnti_t rnti); /* Boolean. See TS 36.213, Section 8.2 */ -BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, mid_t ue_id, uint8_t cc_id); +BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, uint8_t cc_id); /* Get aperiodic CQI report mode */ -CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); +Protocol__FlexAperiodicCqiReportMode flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id, rnti_t rnti); /* Get ACK/NACK feedback mode. TDD only */ -long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, mid_t ue_id); +long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, rnti_t rnti); /* See TS36.213, section 10.1 */ -long flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); +long flexran_get_ack_nack_repetition_factor(mid_t mod_id, rnti_t rnti); /* Boolean. Extended buffer status report size */ -long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id); +long flexran_get_extended_bsr_size(mid_t mod_id, rnti_t rnti); /* Get number of UE transmission antennas */ -int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); +int flexran_get_ue_transmission_antenna(mid_t mod_id, rnti_t rnti); /* Get the IMSI of UE */ -uint64_t flexran_get_ue_imsi(mid_t mod_id, mid_t ue_id); +uint64_t flexran_get_ue_imsi(mid_t mod_id, rnti_t rnti); /* Get logical channel group of a channel with id lc_id */ long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id); @@ -429,7 +429,7 @@ void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type); /*RRC status flexRAN*/ -uint8_t flexran_get_rrc_status(mid_t mod_id, mid_t ue_id); +uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti); /***************************** PDCP ***********************/ @@ -491,33 +491,33 @@ uint32_t flexran_get_pdcp_rx_oo(const mid_t mod_id, const mid_t ue_id, const lc /*********************RRC**********************/ /*Get primary cell measuremeant id flexRAN*/ -MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id); +MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, rnti_t rnti); /*Get primary cell RSRP measurement flexRAN*/ -float flexran_get_rrc_pcell_rsrp(mid_t mod_id, mid_t ue_id); +float flexran_get_rrc_pcell_rsrp(mid_t mod_id, rnti_t rnti); /*Get primary cell RSRQ measurement flexRAN*/ -float flexran_get_rrc_pcell_rsrq(mid_t mod_id, mid_t ue_id); +float flexran_get_rrc_pcell_rsrq(mid_t mod_id, rnti_t rnti); /* Get RRC neighbouring measurement */ -int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id); +int flexran_get_rrc_num_ncell(mid_t mod_id, rnti_t rnti); -/*Get physical cell id*/ -PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id); +/* Get physical cell id */ +long flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, rnti_t rnti, long cell_id); -/*Get RSRP of neighbouring Cell*/ -float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id); +/* Get RSRP of neighbouring Cell */ +float flexran_get_rrc_neigh_rsrp(mid_t mod_id, rnti_t rnti, long cell_id); -/*Get RSRQ of neighbouring Cell*/ -float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id); +/* Get RSRQ of neighbouring Cell */ +float flexran_get_rrc_neigh_rsrq(mid_t mod_id, rnti_t rnti, long cell_id); /*Get MCC PLMN identity neighbouring Cell*/ /* currently not implemented -int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, mid_t ue_id, int cell_id); */ +int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, rnti_t rnti, int cell_id); */ /*Get MNC PLMN identity neighbouring Cell*/ /* currently not implemented -int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, mid_t ue_id, int cell_id); */ +int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, rnti_t rnti, int cell_id); */ /********************* general information *****************/ /* get an ID for this BS (or part of a BS) */ -- GitLab From 2fa8c29fd48e5b3224848f8fc934f2f8dc3af476 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 20:00:35 +0200 Subject: [PATCH 168/308] Put ue_config MAC and RRC parts in resp. CMs --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 24 ++ .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 4 + .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 296 +++++++++--------- .../CONTROL_MODULES/RRC/flexran_agent_rrc.h | 4 + openair2/ENB_APP/flexran_agent_common.c | 153 +-------- 5 files changed, 195 insertions(+), 286 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 162e5b0590..9890b2b0a2 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1372,6 +1372,30 @@ void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, } } +void flexran_agent_fill_mac_ue_config(mid_t mod_id, mid_t ue_id, + Protocol__FlexUeConfig *ue_conf) +{ + if (ue_conf->has_rnti && ue_conf->rnti != flexran_get_mac_ue_crnti(mod_id, ue_id)) { + LOG_E(FLEXRAN_AGENT, "ue_config existing RNTI %x does not match MAC RNTI %x\n", + ue_conf->rnti, flexran_get_mac_ue_crnti(mod_id, ue_id)); + return; + } + ue_conf->rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); + ue_conf->has_rnti = 1; + + ue_conf->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id, ue_id); + ue_conf->has_ue_aggregated_max_bitrate_ul = 1; + + ue_conf->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id, ue_id); + ue_conf->has_ue_aggregated_max_bitrate_dl = 1; + + /* TODO update through RAN API */ + //config->has_pcell_carrier_index = 1; + //config->pcell_carrier_index = UE_PCCID(mod_id, i); + + //TODO: Set carrier aggregation support (boolean) +} + void flexran_agent_fill_mac_lc_ue_config(mid_t mod_id, mid_t ue_id, Protocol__FlexLcUeConfig *lc_ue_conf) { diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h index f4b281407e..24f00fa66f 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -87,6 +87,10 @@ void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMess void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, Protocol__FlexCellConfig *conf); +/* Fill the MAC part of a ue_config message */ +void flexran_agent_fill_mac_ue_config(mid_t mod_id, mid_t ue_id, + Protocol__FlexUeConfig *ue_conf); + /* Fill the lc_ue_config->lc_config message */ void flexran_agent_fill_mac_lc_ue_config(mid_t mod_id, mid_t ue_id, Protocol__FlexLcUeConfig *lc_ue_conf); diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index 02180cc756..60d31203d8 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -68,153 +68,22 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch goto error; } protocol__flex_ue_config__init(config); - if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED) { - // Simply set the rnti of the UE + switch (state_change) { + case PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED: config->has_rnti = 1; config->rnti = rnti; - } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED - || state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED) { - // TODO this goes into the MAC CM */ - //int i = find_UE_id(mod_id, rnti); - config->has_rnti = 1; - config->rnti = rnti; - /* RNTI correct */ - if(flexran_get_time_alignment_timer(mod_id, rnti) != -1) { - config->time_alignment_timer = flexran_get_time_alignment_timer(mod_id, rnti); - config->has_time_alignment_timer = 1; - } - if(flexran_get_meas_gap_config(mod_id, rnti) != -1){ - config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id, rnti); - config->has_meas_gap_config_pattern = 1; - } - if(config->has_meas_gap_config_pattern == 1 && - config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { - config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id, rnti); - config->has_meas_gap_config_sf_offset = 1; - } - //TODO: Set the SPS configuration (Optional) - //Not supported for now, so we do not set it - - //TODO: Set the SR configuration (Optional) - //We do not set it for now - - //TODO: Set the CQI configuration (Optional) - //We do not set it for now - - if(flexran_get_ue_transmission_mode(mod_id, rnti) != -1) { - config->transmission_mode = flexran_get_ue_transmission_mode(mod_id, rnti); - config->has_transmission_mode = 1; - } - - /* TODO into MAC CM */ - //config->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i); - //config->has_ue_aggregated_max_bitrate_ul = 1; - - /* TODO into MAC CM */ - //config->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i); - //config->has_ue_aggregated_max_bitrate_dl = 1; - - Protocol__FlexUeCapabilities *c_capabilities; - c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); - protocol__flex_ue_capabilities__init(c_capabilities); - - c_capabilities->has_half_duplex = 1; - c_capabilities->half_duplex = flexran_get_half_duplex(mod_id, rnti); - - c_capabilities->has_intra_sf_hopping = 1; - c_capabilities->intra_sf_hopping = flexran_get_intra_sf_hopping(mod_id, rnti); - - c_capabilities->has_type2_sb_1 = 1; - c_capabilities->type2_sb_1 = flexran_get_type2_sb_1(mod_id, rnti); - - c_capabilities->has_ue_category = 1; - c_capabilities->ue_category = flexran_get_ue_category(mod_id, rnti); - - c_capabilities->has_res_alloc_type1 = 1; - c_capabilities->res_alloc_type1 = flexran_get_res_alloc_type1(mod_id, rnti); - - config->capabilities = c_capabilities; - - if(flexran_get_ue_transmission_antenna(mod_id, rnti) != -1) { - config->has_ue_transmission_antenna = 1; - config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id, rnti); - } - - if (flexran_get_tti_bundling(mod_id, rnti) != -1) { - config->has_tti_bundling = 1; - config->tti_bundling = flexran_get_tti_bundling(mod_id, rnti); - } - - if(flexran_get_maxHARQ_TX(mod_id, rnti) != -1){ - config->has_max_harq_tx = 1; - config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id, rnti); - } - - if(flexran_get_beta_offset_ack_index(mod_id, rnti) != -1) { - config->has_beta_offset_ack_index = 1; - config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id, rnti); - } - - if(flexran_get_beta_offset_ri_index(mod_id, rnti) != -1) { - config->has_beta_offset_ri_index = 1; - config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id, rnti); - } - - if(flexran_get_beta_offset_cqi_index(mod_id, rnti) != -1) { - config->has_beta_offset_cqi_index = 1; - config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id, rnti); - } - - /* assume primary carrier */ - if(flexran_get_ack_nack_simultaneous_trans(mod_id,0) != -1) { - config->has_ack_nack_simultaneous_trans = 1; - config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,0); - } - - if(flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti) != -1) { - config->has_simultaneous_ack_nack_cqi = 1; - config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti); - } - - if(flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti) != -1) { - config->has_aperiodic_cqi_rep_mode = 1; - config->aperiodic_cqi_rep_mode = flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti); - } - - if(flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti) != -1) { - config->has_tdd_ack_nack_feedback = 1; - config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti); - } - - if(flexran_get_ack_nack_repetition_factor(mod_id, rnti) != -1) { - config->has_ack_nack_repetition_factor = 1; - config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id, rnti); - } - - if(flexran_get_extended_bsr_size(mod_id, rnti) != -1) { - config->has_extended_bsr_size = 1; - config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id, rnti); - } - - // TODO this goes into the MAC CM - //config->has_pcell_carrier_index = 1; - //config->pcell_carrier_index = UE_PCCID(mod_id, i); - //TODO: Set carrier aggregation support (boolean) - config->has_ca_support = 0; - config->ca_support = 0; - if(config->has_ca_support){ - //TODO: Set cross carrier scheduling support (boolean) - config->has_cross_carrier_sched_support = 1; - config->cross_carrier_sched_support = 0; - //TODO: Set secondary cells configuration - // We do not set it for now. No carrier aggregation support - - //TODO: Set deactivation timer for secondary cell - config->has_scell_deactivation_timer = 0; - config->scell_deactivation_timer = 0; - } - } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) { - // TODO: Not supported for now. Leave blank + break; + case PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED: + case PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED: + flexran_agent_fill_rrc_ue_config(mod_id, rnti, config); + /* we don't call into the MAC CM here; it will be called later through an + * ue_config_request */ + break; + + case PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED: + default: + LOG_E(FLEXRAN_AGENT, "state change FLUESC_MOVED or unknown state occured for RNTI %x\n", + rnti); } ue_state_change_msg->config = config; @@ -238,16 +107,18 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch return; error: if (err_code != 0) - LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d \n",err_code); + LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d for RNTI %x\n", + err_code, rnti); } - int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) goto error; free(msg->ue_state_change_msg->header); - //TODO: Free the contents of the UE config structure + if (msg->ue_state_change_msg->config->capabilities) + free(msg->ue_state_change_msg->config->capabilities); + free(msg->ue_state_change_msg->config); free(msg->ue_state_change_msg); free(msg); return 0; @@ -637,6 +508,135 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, return -1; } +void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, + Protocol__FlexUeConfig *ue_conf) +{ + if (ue_conf->has_rnti && ue_conf->rnti != rnti) { + LOG_E(FLEXRAN_AGENT, "ue_config existing RNTI %x does not match RRC RNTI %x\n", + ue_conf->rnti, rnti); + return; + } + ue_conf->has_rnti = 1; + ue_conf->rnti = rnti; + ue_conf->imsi = flexran_get_ue_imsi(mod_id, rnti); + ue_conf->has_imsi = 1; + + //TODO: Set the DRX configuration (optional) + //Not supported for now, so we do not set it + + if(flexran_get_time_alignment_timer(mod_id, rnti) != -1) { + ue_conf->time_alignment_timer = flexran_get_time_alignment_timer(mod_id, rnti); + ue_conf->has_time_alignment_timer = 1; + } + if(flexran_get_meas_gap_config(mod_id, rnti) != -1){ + ue_conf->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id, rnti); + ue_conf->has_meas_gap_config_pattern = 1; + } + if(ue_conf->has_meas_gap_config_pattern == 1 && + ue_conf->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { + ue_conf->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id, rnti); + ue_conf->has_meas_gap_config_sf_offset = 1; + } + + //TODO: Set the SPS configuration (Optional) + //Not supported for now, so we do not set it + + //TODO: Set the SR configuration (Optional) + //We do not set it for now + + //TODO: Set the CQI configuration (Optional) + //We do not set it for now + + if(flexran_get_ue_transmission_mode(mod_id, rnti) != -1) { + ue_conf->transmission_mode = flexran_get_ue_transmission_mode(mod_id, rnti); + ue_conf->has_transmission_mode = 1; + } + + + Protocol__FlexUeCapabilities *c_capabilities; + c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); + if (c_capabilities) { + protocol__flex_ue_capabilities__init(c_capabilities); + + c_capabilities->has_half_duplex = 1; + c_capabilities->half_duplex = flexran_get_half_duplex(mod_id, rnti); + + c_capabilities->has_intra_sf_hopping = 1; + c_capabilities->intra_sf_hopping = flexran_get_intra_sf_hopping(mod_id, rnti); + + c_capabilities->has_type2_sb_1 = 1; + c_capabilities->type2_sb_1 = flexran_get_type2_sb_1(mod_id, rnti); + + c_capabilities->has_ue_category = 1; + c_capabilities->ue_category = flexran_get_ue_category(mod_id, rnti); + + c_capabilities->has_res_alloc_type1 = 1; + c_capabilities->res_alloc_type1 = flexran_get_res_alloc_type1(mod_id, rnti); + + ue_conf->capabilities = c_capabilities; + } + + if(flexran_get_ue_transmission_antenna(mod_id, rnti) != -1) { + ue_conf->has_ue_transmission_antenna = 1; + ue_conf->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id, rnti); + } + + if (flexran_get_tti_bundling(mod_id, rnti) != -1) { + ue_conf->has_tti_bundling = 1; + ue_conf->tti_bundling = flexran_get_tti_bundling(mod_id, rnti); + } + + if(flexran_get_maxHARQ_TX(mod_id, rnti) != -1){ + ue_conf->has_max_harq_tx = 1; + ue_conf->max_harq_tx = flexran_get_maxHARQ_TX(mod_id, rnti); + } + + if(flexran_get_beta_offset_ack_index(mod_id, rnti) != -1) { + ue_conf->has_beta_offset_ack_index = 1; + ue_conf->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id, rnti); + } + + if(flexran_get_beta_offset_ri_index(mod_id, rnti) != -1) { + ue_conf->has_beta_offset_ri_index = 1; + ue_conf->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id, rnti); + } + + if(flexran_get_beta_offset_cqi_index(mod_id, rnti) != -1) { + ue_conf->has_beta_offset_cqi_index = 1; + ue_conf->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id, rnti); + } + + /* assume primary carrier */ + if(flexran_get_ack_nack_simultaneous_trans(mod_id,0) != -1) { + ue_conf->has_ack_nack_simultaneous_trans = 1; + ue_conf->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,0); + } + + if(flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti) != -1) { + ue_conf->has_simultaneous_ack_nack_cqi = 1; + ue_conf->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti); + } + + if(flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti) != -1) { + ue_conf->has_aperiodic_cqi_rep_mode = 1; + ue_conf->aperiodic_cqi_rep_mode = flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti); + } + + if(flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti) != -1) { + ue_conf->has_tdd_ack_nack_feedback = 1; + ue_conf->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti); + } + + if(flexran_get_ack_nack_repetition_factor(mod_id, rnti) != -1) { + ue_conf->has_ack_nack_repetition_factor = 1; + ue_conf->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id, rnti); + } + + if(flexran_get_extended_bsr_size(mod_id, rnti) != -1) { + ue_conf->has_extended_bsr_size = 1; + ue_conf->extended_bsr_size = flexran_get_extended_bsr_size(mod_id, rnti); + } +} int flexran_agent_register_rrc_xface(mid_t mod_id) { diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h index a9b2ac49cc..f65174cb4e 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h @@ -60,6 +60,10 @@ void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t *); int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexranMessage *msg); +/* Fill the RRC part of a ue_config message */ +void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, + Protocol__FlexUeConfig *ue_conf); + /* Fill the RRC part of an cell_config message */ void flexran_agent_fill_rrc_cell_config(mid_t mod_id, uint8_t cc_id, Protocol__FlexCellConfig *conf); diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index df61a03cde..4b3ff410d5 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -527,7 +527,17 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl ue_config_reply_msg->header = header; - ue_config_reply_msg->n_ue_config = flexran_get_rrc_num_ues(mod_id); + ue_config_reply_msg->n_ue_config = 0; + if (flexran_agent_get_rrc_xface(mod_id)) + ue_config_reply_msg->n_ue_config = flexran_get_rrc_num_ues(mod_id); + else if (flexran_agent_get_mac_xface(mod_id)) + ue_config_reply_msg->n_ue_config = flexran_get_mac_num_ues(mod_id); + + if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id) + && flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) { + LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC and MAC\n"); + goto error; + } Protocol__FlexUeConfig **ue_config; if (ue_config_reply_msg->n_ue_config > 0) { @@ -542,143 +552,10 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); protocol__flex_ue_config__init(ue_config[i]); - /* correct RNTI */ - ue_config[i]->rnti = rnti; - ue_config[i]->has_rnti = 1; - ue_config[i]->imsi = flexran_get_ue_imsi(mod_id, rnti); - ue_config[i]->has_imsi = 1; - //TODO: Set the DRX configuration (optional) - //Not supported for now, so we do not set it - - if (flexran_get_time_alignment_timer(mod_id, rnti) != -1) { - ue_config[i]->time_alignment_timer = flexran_get_time_alignment_timer(mod_id, rnti); - ue_config[i]->has_time_alignment_timer = 1; - } - - if (flexran_get_meas_gap_config(mod_id, rnti) != -1) { - ue_config[i]->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id, rnti); - ue_config[i]->has_meas_gap_config_pattern = 1; - } - - if (ue_config[i]->has_meas_gap_config_pattern == 1 && - ue_config[i]->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { - ue_config[i]->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id, rnti); - ue_config[i]->has_meas_gap_config_sf_offset = 1; - } - //TODO: Set the SPS configuration (Optional) - //Not supported for noe, so we do not set it - - //TODO: Set the SR configuration (Optional) - //We do not set it for now - - //TODO: Set the CQI configuration (Optional) - //We do not set it for now - - if (flexran_get_ue_transmission_mode(mod_id, rnti) != -1) { - ue_config[i]->transmission_mode = flexran_get_ue_transmission_mode(mod_id, rnti); - ue_config[i]->has_transmission_mode = 1; - } - - /* into MAC CM */ - //ue_config[i]->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i); - //ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; - - //ue_config[i]->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i); - //ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; - - Protocol__FlexUeCapabilities *capabilities; - capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); - protocol__flex_ue_capabilities__init(capabilities); - capabilities->has_half_duplex = 1; - capabilities->half_duplex = flexran_get_half_duplex(mod_id, rnti); - capabilities->has_intra_sf_hopping = 1; - capabilities->intra_sf_hopping = flexran_get_intra_sf_hopping(mod_id, rnti); - capabilities->has_type2_sb_1 = 1; - capabilities->type2_sb_1 = flexran_get_type2_sb_1(mod_id, rnti); - capabilities->has_ue_category = 1; - capabilities->ue_category = flexran_get_ue_category(mod_id, rnti); - capabilities->has_res_alloc_type1 = 1; - capabilities->res_alloc_type1 = flexran_get_res_alloc_type1(mod_id, rnti); - //Set the capabilites to the message - ue_config[i]->capabilities = capabilities; - - if (flexran_get_ue_transmission_antenna(mod_id, rnti) != -1) { - ue_config[i]->has_ue_transmission_antenna = 1; - ue_config[i]->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id, rnti); - } - - if (flexran_get_tti_bundling(mod_id, rnti) != -1) { - ue_config[i]->has_tti_bundling = 1; - ue_config[i]->tti_bundling = flexran_get_tti_bundling(mod_id, rnti); - } - - if (flexran_get_maxHARQ_TX(mod_id, rnti) != -1) { - ue_config[i]->has_max_harq_tx = 1; - ue_config[i]->max_harq_tx = flexran_get_maxHARQ_TX(mod_id, rnti); - } - - if (flexran_get_beta_offset_ack_index(mod_id, rnti) != -1) { - ue_config[i]->has_beta_offset_ack_index = 1; - ue_config[i]->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id, rnti); - } - - if (flexran_get_beta_offset_ri_index(mod_id, rnti) != -1) { - ue_config[i]->has_beta_offset_ri_index = 1; - ue_config[i]->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id, rnti); - } - - if (flexran_get_beta_offset_cqi_index(mod_id, rnti) != -1) { - ue_config[i]->has_beta_offset_cqi_index = 1; - ue_config[i]->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id, rnti); - } - - /* assume primary carrier */ - if (flexran_get_ack_nack_simultaneous_trans(mod_id, 0) != -1) { - ue_config[i]->has_ack_nack_simultaneous_trans = 1; - ue_config[i]->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id, 0); - } - - if (flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti) != -1) { - ue_config[i]->has_simultaneous_ack_nack_cqi = 1; - ue_config[i]->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti); - } - - if (flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti) != -1) { - ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - ue_config[i]->aperiodic_cqi_rep_mode = flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti); - } - - if (flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti) != -1) { - ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti); - } - - if(flexran_get_ack_nack_repetition_factor(mod_id, rnti) != -1) { - ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id, rnti); - } - - if (flexran_get_extended_bsr_size(mod_id, rnti) != -1) { - ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = flexran_get_extended_bsr_size(mod_id, rnti); - } - //TODO: Set carrier aggregation support (boolean) - ue_config[i]->has_ca_support = 0; - ue_config[i]->ca_support = 0; - - /* into MAC CM */ - //ue_config[i]->has_pcell_carrier_index = 1; - //ue_config[i]->pcell_carrier_index = UE_PCCID(mod_id, i); - if(ue_config[i]->has_ca_support){ - //TODO: Set cross carrier scheduling support (boolean) - ue_config[i]->has_cross_carrier_sched_support = 0; - ue_config[i]->cross_carrier_sched_support = 0; - //TODO: Set secondary cells configuration - // We do not set it for now. No carrier aggregation support - //TODO: Set deactivation timer for secondary cell - ue_config[i]->has_scell_deactivation_timer = 0; - ue_config[i]->scell_deactivation_timer = 0; - } + if (flexran_agent_get_rrc_xface(mod_id)) + flexran_agent_fill_rrc_ue_config(mod_id, rnti, ue_config[i]); + if (flexran_agent_get_mac_xface(mod_id)) + flexran_agent_fill_mac_ue_config(mod_id, i, ue_config[i]); } ue_config_reply_msg->ue_config = ue_config; } -- GitLab From d7948d04b46d57ef6fd4dcb86647eb0a425b9f21 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 25 Oct 2018 20:02:58 +0200 Subject: [PATCH 169/308] Always fill RRC part of ue_config with all parameters --- .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 96 +++++++------------ 1 file changed, 33 insertions(+), 63 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index 60d31203d8..ad5990b70f 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -524,16 +524,13 @@ void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, //TODO: Set the DRX configuration (optional) //Not supported for now, so we do not set it - if(flexran_get_time_alignment_timer(mod_id, rnti) != -1) { - ue_conf->time_alignment_timer = flexran_get_time_alignment_timer(mod_id, rnti); - ue_conf->has_time_alignment_timer = 1; - } - if(flexran_get_meas_gap_config(mod_id, rnti) != -1){ - ue_conf->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id, rnti); - ue_conf->has_meas_gap_config_pattern = 1; - } - if(ue_conf->has_meas_gap_config_pattern == 1 && - ue_conf->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { + ue_conf->time_alignment_timer = flexran_get_time_alignment_timer(mod_id, rnti); + ue_conf->has_time_alignment_timer = 1; + + ue_conf->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id, rnti); + ue_conf->has_meas_gap_config_pattern = 1; + + if(ue_conf->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { ue_conf->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id, rnti); ue_conf->has_meas_gap_config_sf_offset = 1; } @@ -547,11 +544,8 @@ void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, //TODO: Set the CQI configuration (Optional) //We do not set it for now - if(flexran_get_ue_transmission_mode(mod_id, rnti) != -1) { - ue_conf->transmission_mode = flexran_get_ue_transmission_mode(mod_id, rnti); - ue_conf->has_transmission_mode = 1; - } - + ue_conf->transmission_mode = flexran_get_ue_transmission_mode(mod_id, rnti); + ue_conf->has_transmission_mode = 1; Protocol__FlexUeCapabilities *c_capabilities; c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); @@ -576,66 +570,42 @@ void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, ue_conf->capabilities = c_capabilities; } - if(flexran_get_ue_transmission_antenna(mod_id, rnti) != -1) { - ue_conf->has_ue_transmission_antenna = 1; - ue_conf->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id, rnti); - } + ue_conf->has_ue_transmission_antenna = 1; + ue_conf->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id, rnti); - if (flexran_get_tti_bundling(mod_id, rnti) != -1) { - ue_conf->has_tti_bundling = 1; - ue_conf->tti_bundling = flexran_get_tti_bundling(mod_id, rnti); - } + ue_conf->has_tti_bundling = 1; + ue_conf->tti_bundling = flexran_get_tti_bundling(mod_id, rnti); - if(flexran_get_maxHARQ_TX(mod_id, rnti) != -1){ - ue_conf->has_max_harq_tx = 1; - ue_conf->max_harq_tx = flexran_get_maxHARQ_TX(mod_id, rnti); - } + ue_conf->has_max_harq_tx = 1; + ue_conf->max_harq_tx = flexran_get_maxHARQ_TX(mod_id, rnti); - if(flexran_get_beta_offset_ack_index(mod_id, rnti) != -1) { - ue_conf->has_beta_offset_ack_index = 1; - ue_conf->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id, rnti); - } + ue_conf->has_beta_offset_ack_index = 1; + ue_conf->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id, rnti); - if(flexran_get_beta_offset_ri_index(mod_id, rnti) != -1) { - ue_conf->has_beta_offset_ri_index = 1; - ue_conf->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id, rnti); - } + ue_conf->has_beta_offset_ri_index = 1; + ue_conf->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id, rnti); - if(flexran_get_beta_offset_cqi_index(mod_id, rnti) != -1) { - ue_conf->has_beta_offset_cqi_index = 1; - ue_conf->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id, rnti); - } + ue_conf->has_beta_offset_cqi_index = 1; + ue_conf->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id, rnti); /* assume primary carrier */ - if(flexran_get_ack_nack_simultaneous_trans(mod_id,0) != -1) { - ue_conf->has_ack_nack_simultaneous_trans = 1; - ue_conf->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,0); - } + ue_conf->has_ack_nack_simultaneous_trans = 1; + ue_conf->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,0); - if(flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti) != -1) { - ue_conf->has_simultaneous_ack_nack_cqi = 1; - ue_conf->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti); - } + ue_conf->has_simultaneous_ack_nack_cqi = 1; + ue_conf->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti); - if(flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti) != -1) { - ue_conf->has_aperiodic_cqi_rep_mode = 1; - ue_conf->aperiodic_cqi_rep_mode = flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti); - } + ue_conf->has_aperiodic_cqi_rep_mode = 1; + ue_conf->aperiodic_cqi_rep_mode = flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti); - if(flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti) != -1) { - ue_conf->has_tdd_ack_nack_feedback = 1; - ue_conf->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti); - } + ue_conf->has_tdd_ack_nack_feedback = 1; + ue_conf->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti); - if(flexran_get_ack_nack_repetition_factor(mod_id, rnti) != -1) { - ue_conf->has_ack_nack_repetition_factor = 1; - ue_conf->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id, rnti); - } + ue_conf->has_ack_nack_repetition_factor = 1; + ue_conf->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id, rnti); - if(flexran_get_extended_bsr_size(mod_id, rnti) != -1) { - ue_conf->has_extended_bsr_size = 1; - ue_conf->extended_bsr_size = flexran_get_extended_bsr_size(mod_id, rnti); - } + ue_conf->has_extended_bsr_size = 1; + ue_conf->extended_bsr_size = flexran_get_extended_bsr_size(mod_id, rnti); } int flexran_agent_register_rrc_xface(mid_t mod_id) -- GitLab From ec9e70a023de89b1707ec0e78e16298c86a26a15 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 26 Oct 2018 11:20:51 +0200 Subject: [PATCH 170/308] FlexRAN: provide better error messages in async channel --- openair2/ENB_APP/flexran_agent.c | 9 ++++++++- openair2/ENB_APP/flexran_agent_async.c | 24 +++++++++++++++++------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index c2a1790380..79cb6ea97f 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -201,6 +201,11 @@ int flexran_agent_start(mid_t mod_id) /*Create the async channel info*/ flexran_agent_async_channel_t *channel_info = flexran_agent_async_channel_info(mod_id, in_ip, in_port); + if (!channel_info) { + LOG_E(FLEXRAN_AGENT, "could not create channel_info\n"); + exit(1); + } + /*Create a channel using the async channel info*/ channel_id = flexran_agent_create_channel((void *) channel_info, flexran_agent_async_msg_send, @@ -209,12 +214,14 @@ int flexran_agent_start(mid_t mod_id) if (channel_id <= 0) { + LOG_E(FLEXRAN_AGENT, "could not create channel\n"); goto error; } flexran_agent_channel_t *channel = get_channel(channel_id); if (channel == NULL) { + LOG_E(FLEXRAN_AGENT, "could not get channel for channel_id %d\n", channel_id); goto error; } @@ -307,7 +314,7 @@ int flexran_agent_start(mid_t mod_id) return 0; error: - LOG_I(FLEXRAN_AGENT,"there was an error\n"); + LOG_E(FLEXRAN_AGENT, "%s(): there was an error\n", __func__); return 1; } diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c index d738f981f9..12d9bf7e2a 100644 --- a/openair2/ENB_APP/flexran_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -36,13 +36,18 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c flexran_agent_async_channel_t *channel; channel = (flexran_agent_async_channel_t *) malloc(sizeof(flexran_agent_channel_t)); - if (channel == NULL) - goto error; + if (channel == NULL) { + LOG_E(FLEXRAN_AGENT, "could not allocate memory for flexran_agent_async_channel_t\n"); + return NULL; + } channel->enb_id = mod_id; /*Create a socket*/ channel->link = new_link_client(dst_ip, dst_port); - if (channel->link == NULL) goto error; + if (channel->link == NULL) { + LOG_E(FLEXRAN_AGENT, "could not create new link client\n"); + goto error; + } LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", channel->enb_id, @@ -56,12 +61,17 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c // channel->send_queue = new_message_queue(500); // not using the circular buffer: affects the PDCP split channel->send_queue = new_message_queue(); - - if (channel->send_queue == NULL) goto error; + if (channel->send_queue == NULL) { + LOG_E(FLEXRAN_AGENT, "could not create send_queue\n"); + goto error; + } // not using the circular buffer: affects the PDCP split //channel->receive_queue = new_message_queue(500); channel->send_queue = new_message_queue(); - if (channel->receive_queue == NULL) goto error; + if (channel->receive_queue == NULL) { + LOG_E(FLEXRAN_AGENT, "could not create send_queue\n"); + goto error; + } /* * create a link manager @@ -81,7 +91,7 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c return channel; error: - LOG_I(FLEXRAN_AGENT,"there was an error\n"); + LOG_I(FLEXRAN_AGENT, "%s(): there was an error\n", __func__); return NULL; } -- GitLab From 34adfd2af8c1fe54f73fb33a0dd8419ffde96a36 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 26 Oct 2018 11:23:30 +0200 Subject: [PATCH 171/308] ASYNC_IF link_{send,receive}_packet(): infer socket type automatically --- .../LAYER2/PROTO_AGENT/proto_agent_defs.h | 2 - openair2/UTIL/ASYNC_IF/link_manager.c | 4 +- openair2/UTIL/ASYNC_IF/socket_link.c | 48 +++++++++++-------- openair2/UTIL/ASYNC_IF/socket_link.h | 7 +-- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h index 0e0302002c..8857a498ef 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h @@ -100,8 +100,6 @@ typedef uint8_t mod_id_t; // module or enb id typedef uint8_t lcid_t; typedef int32_t err_code_t; -#define CHANNEL_UDP 1 - typedef struct { /* general info */ diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 82fe142237..f355e79dd9 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -47,7 +47,7 @@ static void *link_manager_sender_thread(void *_manager) while (manager->run) { while (message_get(manager->send_queue, &data, &size, &priority) == 0) { - link_send_packet(manager->socket_link, data, size, manager->type, manager->peer_addr, manager->port); + link_send_packet(manager->socket_link, data, size, manager->peer_addr, manager->port); free(data); } // if (message_get(manager->send_queue, &data, &size, &priority)) @@ -76,7 +76,7 @@ static void *link_manager_receiver_thread(void *_manager) LOG_D(MAC, "starting link manager receiver thread\n"); while (manager->run) { - if (link_receive_packet(manager->socket_link, &data, &size, manager->type)) + if (link_receive_packet(manager->socket_link, &data, &size)) goto error; /* todo: priority */ if (message_put(manager->receive_queue, data, size, 0)) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index d8dcb764e9..7bd5d4eea9 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -68,6 +68,7 @@ socket_link_t *new_link_server(int port) LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } + ret->type = SOCK_STREAM; reuse = 1; if (setsockopt(socket_server, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) { @@ -135,6 +136,7 @@ socket_link_t *new_link_client(const char *server, int port) LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); goto error; } + ret->type = SOCK_STREAM; no_delay = 1; if (setsockopt(ret->socket_fd, SOL_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { @@ -183,6 +185,7 @@ socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port) if ((socket_server=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { goto error; } + ret->type = SOCK_DGRAM; // zero out the structure memset((char *) &si_me, 0, sizeof(si_me)); @@ -231,6 +234,7 @@ socket_link_t *new_link_udp_client(const char *server, int port){ if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1){ goto error; } + ret->type = SOCK_DGRAM; memset((char *) &si_other, 0, sizeof(si_other)); si_other.sin_family = AF_INET; @@ -302,6 +306,7 @@ socket_link_t *new_link_sctp_server(int port) ret->socket_fd = -1; ret->socket_fd = accept (listenSock, NULL, NULL); + ret->type = SOCK_STREAM; return ret; @@ -334,6 +339,7 @@ socket_link_t *new_link_sctp_client(const char *server, int port) perror("socket()"); exit(1); } + ret->type = SOCK_STREAM; bzero ((void *) &servaddr, sizeof (servaddr)); servaddr.sin_family = AF_INET; @@ -469,57 +475,54 @@ socket_closed: /* * return -1 on error and 0 if the sending was fine */ -int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, const char *peer_addr, int peer_port) +int link_send_packet(socket_link_t *link, void *data, int size, const char *peer_addr, int peer_port) { char sizebuf[4]; int32_t s = size; - - if ((proto_type == 0) || (proto_type == 2)) - { + switch (link->type) { + case SOCK_STREAM: /* send the size first, maximum is 2^31 bytes */ sizebuf[0] = (s >> 24) & 255; sizebuf[1] = (s >> 16) & 255; sizebuf[2] = (s >> 8) & 255; sizebuf[3] = s & 255; if (socket_send(link->socket_fd, sizebuf, 4) == -1) - goto error; + return -1; link->bytes_sent += 4; if (socket_send(link->socket_fd, data, size) == -1) - goto error; - - } - else if (proto_type == 1 ) - { + return -1; + break; + case SOCK_DGRAM: /* UDP is connectionless -> only send the data */ if (socket_udp_send(link->socket_fd, data, size, peer_addr, peer_port) == -1) - goto error; - + return -1; + break; + default: + LOG_E(MAC, "unknown socket type %d\n", link->type); + return -1; } link->bytes_sent += size; link->packets_sent++; return 0; - -error: - return -1; } /* * return -1 on error and 0 if the sending was fine */ -int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uint16_t proto_type) +int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) { unsigned char sizebuf[4]; int32_t size = 0; void *data = NULL; /* received the size first, maximum is 2^31 bytes */ - if ((proto_type == 0) || (proto_type == 2)) - { + switch (link->type) { + case SOCK_STREAM: if (socket_receive(link->socket_fd, sizebuf, 4) == -1) goto error; @@ -538,9 +541,8 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uin if (socket_receive(link->socket_fd, data, size) == -1) goto error; - } - else if (proto_type == 1) - { + break; + case SOCK_DGRAM: /* we get a single packet (no size, UDP could lose it). Therefore, prepare * for the maximum UDP packet size */ size = 65535; @@ -553,6 +555,10 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uin size = socket_udp_receive(link->socket_fd, data, size); if (size < 0) goto error; + break; + default: + LOG_E(MAC, "unknown socket type %d\n", link->type); + goto error; } link->bytes_received += size; diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h index a7a83f66c6..b466721e08 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.h +++ b/openair2/UTIL/ASYNC_IF/socket_link.h @@ -37,9 +37,10 @@ extern "C" { #endif + typedef struct { int socket_fd; - int peer_port; + int type; uint64_t bytes_sent; uint64_t packets_sent; uint64_t bytes_received; @@ -53,8 +54,8 @@ socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port); socket_link_t *new_link_udp_client(const char *server, int port); socket_link_t *new_link_sctp_server(int port); socket_link_t *new_link_sctp_client(const char *server, int port); -int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, const char *peer_addr, int port); -int link_receive_packet(socket_link_t *link, void **data, int *size, uint16_t proto_type); +int link_send_packet(socket_link_t *link, void *data, int size, const char *peer_addr, int port); +int link_receive_packet(socket_link_t *link, void **data, int *size); int close_link(socket_link_t *link); -- GitLab From 0efde02161c7865aeae2c30a4e988f6bec9c89f8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 26 Oct 2018 13:36:39 +0200 Subject: [PATCH 172/308] Sanitize link_manager interface, correct in FlexRAN/PROTO_AGENT This commit cleans up the link_manager interface: * don't provide peer_addr/port in create_link_manager() (for TCP/SCTP it is not needed, so in the UDP case in needs to be set explicitly) * Make FlexRAN connect again (correct hardcoded address) * Fix FlexRAN: retain the manager pointer * Fix FlexRAN: store receive_queue pointer * the link_manager's sender thread passes the correct peer_addr/port for the UDP case --- openair2/ENB_APP/flexran_agent_async.c | 22 ++++++------------- .../LAYER2/PROTO_AGENT/proto_agent_async.c | 12 +++++----- .../LAYER2/PROTO_AGENT/proto_agent_async.h | 2 -- openair2/UTIL/ASYNC_IF/link_manager.c | 10 ++------- openair2/UTIL/ASYNC_IF/link_manager.h | 10 +++------ openair2/UTIL/ASYNC_IF/socket_link.c | 2 -- 6 files changed, 17 insertions(+), 41 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c index 12d9bf7e2a..34d2f5b1e8 100644 --- a/openair2/ENB_APP/flexran_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -67,26 +67,18 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c } // not using the circular buffer: affects the PDCP split //channel->receive_queue = new_message_queue(500); - channel->send_queue = new_message_queue(); + channel->receive_queue = new_message_queue(); if (channel->receive_queue == NULL) { LOG_E(FLEXRAN_AGENT, "could not create send_queue\n"); goto error; } - /* - * create a link manager - */ - - // PDCP split interface ASYNC_IF link manager is using more arguments - -// channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link); - - // Hardcoded fix: TODO: Fix this - uint8_t type = 1; - char *peer_addr = strdup("127.0.0.1"); - uint32_t port = 10000; - create_link_manager(channel->send_queue, channel->receive_queue, channel->link, type, peer_addr, port); - if (channel->manager == NULL) goto error; + /* create a link manager */ + channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link); + if (channel->manager == NULL) { + LOG_E(FLEXRAN_AGENT, "could not create link_manager\n"); + goto error; + } return channel; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 080491e5ee..660c21e75e 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -44,9 +44,6 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bi if (channel == NULL) goto error; - channel->peer_port = peer_port; - channel->peer_addr = peer_ip; - channel->enb_id = mod_id; channel->link = new_link_udp_server(bind_ip, bind_port); @@ -59,10 +56,11 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bi channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, - channel->link, - CHANNEL_UDP, - channel->peer_addr, - channel->peer_port); + channel->link); + /* manually set remote IP&port for UDP server remote end */ + channel->manager->peer_port = peer_port; + channel->manager->peer_addr = peer_ip; + if (channel->manager == NULL) goto error; return channel; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h index 780f004681..7658e1d98f 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h @@ -41,8 +41,6 @@ typedef struct proto_agent_async_channel_s { mod_id_t enb_id; - const char *peer_addr; - int peer_port; socket_link_t *link; message_queue_t *send_queue; message_queue_t *receive_queue; diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index f355e79dd9..973f155422 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -47,7 +47,7 @@ static void *link_manager_sender_thread(void *_manager) while (manager->run) { while (message_get(manager->send_queue, &data, &size, &priority) == 0) { - link_send_packet(manager->socket_link, data, size, manager->peer_addr, manager->port); + link_send_packet(manager->socket_link, data, size, manager->peer_addr, manager->peer_port); free(data); } // if (message_get(manager->send_queue, &data, &size, &priority)) @@ -95,10 +95,7 @@ error: link_manager_t *create_link_manager( message_queue_t *send_queue, message_queue_t *receive_queue, - socket_link_t *link, - uint16_t type, - const char *peer_addr, - int port ) + socket_link_t *link) { link_manager_t *ret = NULL; pthread_attr_t attr; @@ -113,9 +110,6 @@ link_manager_t *create_link_manager( ret->send_queue = send_queue; ret->receive_queue = receive_queue; ret->socket_link = link; - ret->type = type; - ret->peer_addr = peer_addr; - ret->port = port; ret->run = 1; if (pthread_attr_init(&attr)) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index f749119de6..4148392eec 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -45,9 +45,8 @@ typedef struct { message_queue_t *send_queue; message_queue_t *receive_queue; socket_link_t *socket_link; - uint16_t type; - const char *peer_addr; - int port; + const char *peer_addr; /* for UDP server remote IP */ + int peer_port; /* for UDP server remote address */ pthread_t sender; pthread_t receiver; volatile int run; @@ -56,10 +55,7 @@ typedef struct { link_manager_t *create_link_manager( message_queue_t *send_queue, message_queue_t *receive_queue, - socket_link_t *link, - uint16_t type, - const char *peer_addr, - int port); + socket_link_t *link); void destroy_link_manager(link_manager_t *); diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 7bd5d4eea9..280ef5c31a 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -205,7 +205,6 @@ socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port) goto error; } ret->socket_fd = socket_server; - ret->peer_port = 0; return ret; error: @@ -251,7 +250,6 @@ socket_link_t *new_link_udp_client(const char *server, int port){ getsockname(s, (struct sockaddr *)&si_other, &slen); ret->socket_fd = s; - ret->peer_port = port; //ntohs(si_other.sin_port); return ret; error: -- GitLab From 44b29d04c3bbce95f60476f0ffdd33f7e5f5992e Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 26 Oct 2018 14:35:53 +0200 Subject: [PATCH 173/308] Read config before starting FlexRAN for node_type and ID --- targets/RT/USER/lte-softmodem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 34ac829f5c..c6e53c9f12 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1047,6 +1047,10 @@ int main( int argc, char **argv ) } LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity); #endif + + /* Read configuration */ + if (RC.nb_inst > 0) + read_config_and_init(); /* Start the agent. If it is turned off in the configuration, it won't start */ RCconfig_flexran(); @@ -1055,7 +1059,6 @@ int main( int argc, char **argv ) } if (RC.nb_inst > 0) { - read_config_and_init(); if (create_tasks(1) < 0) { printf("cannot create ITTI tasks\n"); -- GitLab From eaff77695b381583b2813428202be3e59c2d4ab6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 26 Oct 2018 21:55:36 +0200 Subject: [PATCH 174/308] Correct malloc in proto_agent_async_channel_info --- openair2/LAYER2/PROTO_AGENT/proto_agent_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 660c21e75e..94532b1942 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -39,7 +39,7 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bi const char* peer_ip, uint16_t peer_port) { proto_agent_async_channel_t *channel; - channel = malloc(sizeof(proto_agent_channel_t)); + channel = malloc(sizeof(proto_agent_async_channel_t)); if (channel == NULL) goto error; -- GitLab From 54da66eeac52260ad9a26aa9e1ef7d496c35537f Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 28 Oct 2018 13:28:41 +0100 Subject: [PATCH 175/308] Bugfix: Rename proto_agent global channel variable The PROTO_AGENT variable holding the channel for various was named as the same one for FlexRAN. In C, global variables with the same name are merged into one, which had the effect that the same queues where used for PROTO_AGENT and FlexRAN, locking the FlexRAN RX thread. Renaming the PROTO_AGENT variable (it was introduced second) resolves this issue. --- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index 591a7ac288..99b1a0b79b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -37,7 +37,7 @@ #include "proto_agent_net_comm.h" #include "common/utils/LOG/log.h" -proto_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; +proto_agent_channel_t *proto_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; proto_agent_channel_instance_t channel_instance; int proto_agent_channel_id = 0; @@ -47,7 +47,7 @@ int proto_agent_msg_send(mod_id_t mod_id, proto_agent_id_t agent_id, void *data, goto error; } proto_agent_channel_t *channel; - channel = agent_channel[mod_id][agent_id]; + channel = proto_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ if (channel == NULL) { @@ -67,7 +67,7 @@ int proto_agent_msg_recv(mod_id_t mod_id, proto_agent_id_t agent_id, void **data goto error; } proto_agent_channel_t *channel; - channel = agent_channel[mod_id][agent_id]; + channel = proto_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ if (channel == NULL) { @@ -90,10 +90,10 @@ int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel if (agent_id == ENB_AGENT_MAX) { for (i = 0; i < ENB_AGENT_MAX; i++) { - agent_channel[mod_id][i] = channel; + proto_channel[mod_id][i] = channel; } } else { - agent_channel[mod_id][agent_id] = channel; + proto_channel[mod_id][agent_id] = channel; } return 0; } @@ -103,10 +103,10 @@ void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id) if (agent_id == ENB_AGENT_MAX) { for (i = 0; i < ENB_AGENT_MAX; i++) { - agent_channel[mod_id][i] = NULL; + proto_channel[mod_id][i] = NULL; } } else { - agent_channel[mod_id][agent_id] = NULL; + proto_channel[mod_id][agent_id] = NULL; } } @@ -148,9 +148,9 @@ int proto_agent_destroy_channel(int channel_id) { /*Unregister the channel from all agents*/ for (i = 0; i < NUM_MAX_ENB; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { - if (agent_channel[i][j] != NULL) { - if (agent_channel[i][j]->channel_id == e->channel_id) { - agent_channel[i][j] = NULL; + if (proto_channel[i][j] != NULL) { + if (proto_channel[i][j]->channel_id == e->channel_id) { + proto_channel[i][j] = NULL; } } } @@ -172,7 +172,7 @@ err_code_t proto_agent_init_channel_container(void) { for (i = 0; i < NUM_MAX_ENB; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { - agent_channel[i][j] = NULL; + proto_channel[i][j] = NULL; } } -- GitLab From 129055264776f9c2cf56e425c6ac8cfb4a38fa42 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 28 Oct 2018 13:31:03 +0100 Subject: [PATCH 176/308] Introduce LOG_W logger for PROTO_AGENT --- common/utils/T/T_messages.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 3ef08bc510..40297ff25d 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -869,6 +869,11 @@ ID = LEGACY_PROTO_AGENT_INFO GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_INFO:LEGACY FORMAT = string,log +ID = LEGACY_PROTO_AGENT_WARNING + DESC = PROTO AGENT WARNING LEVEL + GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log + ID = LEGACY_PROTO_AGENT_ERROR DESC = PROTO AGENT ERROR LEVEL GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_ERROR:LEGACY -- GitLab From f01c78e5329254f00004014c12118a9f2716b7ae Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 28 Oct 2018 13:36:42 +0100 Subject: [PATCH 177/308] Set thread names for FlexRAN and PROTO rx_thread --- openair2/ENB_APP/flexran_agent.c | 4 +++- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index 79cb6ea97f..d6402658a9 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -26,11 +26,12 @@ * \version 0.1 */ +#define _GNU_SOURCE #include "flexran_agent.h" +#include <pthread.h> #include <arpa/inet.h> -void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); Protocol__FlexranMessage *flexran_agent_timeout(void* args); @@ -110,6 +111,7 @@ void *receive_thread(void *args) { err_code_t err_code=0; Protocol__FlexranMessage *msg; + pthread_setname_np(pthread_self(), "flexran_rx_thr"); while (1) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 38c7c32b52..60640d4872 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -33,6 +33,7 @@ * \date 2016 * \version 0.1 */ +#define _GNU_SOURCE #include "proto_agent_common.h" #include "common/utils/LOG/log.h" #include "proto_agent.h" @@ -40,6 +41,8 @@ #include "proto_agent_net_comm.h" #include "proto_agent_async.h" +#include <pthread.h> + #define ENB_AGENT_MAX 9 proto_agent_instance_t proto_agent[MAX_DU]; @@ -250,6 +253,7 @@ proto_agent_receive(void *args) int priority; err_code_t err_code; + pthread_setname_np(pthread_self(), "proto_rx"); Protocol__FlexsplitMessage *msg; uint8_t *ser_msg; -- GitLab From e71adffcfd9a08338d1322a977dc8df9a12562a8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 28 Oct 2018 13:37:52 +0100 Subject: [PATCH 178/308] Correct logging messages in FlexRAN & PROTO_AGENT --- openair2/ENB_APP/flexran_agent_handler.c | 2 +- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index dd8a569dc0..1f13b69e92 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -687,7 +687,7 @@ void flexran_agent_send_update_stats(mid_t mod_id) { return; } error: - LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n"); + LOG_W(FLEXRAN_AGENT, "Could not send update stats message\n"); } err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 60640d4872..0b53f366bc 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -284,8 +284,8 @@ proto_agent_receive(void *args) if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; - LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } + LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } -- GitLab From 920a4abb6d40ce2387fc8c3f69a4a07083d98ce9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 28 Oct 2018 13:59:38 +0100 Subject: [PATCH 179/308] Make link_manager threads joinable This makes it possible to stop the link_manager by joining its threads. --- openair2/UTIL/ASYNC_IF/link_manager.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 973f155422..9ac06b8ad5 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -124,9 +124,6 @@ link_manager_t *create_link_manager( pthread_attr_setschedpolicy(&attr, SCHED_RR); //#endif - if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) - goto error; - if (pthread_create(&t, &attr, link_manager_sender_thread, ret)) goto error; ret->sender = t; -- GitLab From 70f74777f36df51e9b404e1f62b65530883cb6fb Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 28 Oct 2018 13:59:12 +0100 Subject: [PATCH 180/308] Correctly implement proto_agent_stop(), call it --- openair2/F1AP/f1ap_cu_task.c | 4 ++++ openair2/LAYER2/PROTO_AGENT/proto_agent.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index e631362226..dc482e7061 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -73,6 +73,10 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat .remote_ipv4_address = RC.rrc[instance]->eth_params_s.remote_addr, .remote_port = RC.rrc[instance]->eth_params_s.remote_portd }; + /* stop, then start the PROTO_AGENT. If it is already stopped, stopping it + * again will do nothing, therefore it is safe to call here. + * TODO: call proto_agent_stop() when CU_TASK is informed about conn release */ + proto_agent_stop(instance); AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %d!\n", instance); } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 0b53f366bc..00441aeed5 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -137,7 +137,11 @@ error: void proto_agent_stop(mod_id_t mod_id) { + if (!proto_agent[mod_id].channel) return; + proto_agent_async_release(proto_agent[mod_id].channel); proto_agent_destroy_channel(proto_agent[mod_id].channel->channel_id); + free(proto_agent[mod_id].channel); + proto_agent[mod_id].channel = NULL; } //void -- GitLab From 328448e87536c9e8e505e1c71502944c9ec27111 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 29 Oct 2018 09:04:08 +0100 Subject: [PATCH 181/308] Remove flexran_agent_send_update_stats() which is unnecessary --- openair2/ENB_APP/flexran_agent_common.h | 2 - openair2/ENB_APP/flexran_agent_handler.c | 57 ------------------------ openair2/LAYER2/MAC/eNB_scheduler.c | 3 -- 3 files changed, 62 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index 057c5b9489..29dd6fe61d 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -162,8 +162,6 @@ int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg); err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id); -void flexran_agent_send_update_stats(mid_t mod_id); - err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id, xid_t xid, stats_request_config_t *stats_req) ; err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id); diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 1f13b69e92..046f608b44 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -633,63 +633,6 @@ int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg) { return -1; } -/* - Top Level Update - */ - -void flexran_agent_send_update_stats(mid_t mod_id) { - - Protocol__FlexranMessage *current_report = NULL; - void *data; - int size; - err_code_t err_code; - int priority = 0; - - if (pthread_mutex_lock(stats_context[mod_id].mutex)) { - goto error; - } - - if (stats_context[mod_id].cont_update == 1) { - - /*Create a fresh report with the required flags*/ - err_code = flexran_agent_handle_stats(mod_id, (void *) stats_context[mod_id].stats_req, ¤t_report); - if (err_code < 0) { - goto error; - } - } - /* /\*TODO:Check if a previous reports exists and if yes, generate a report */ - /* *that is the diff between the old and the new report, */ - /* *respecting the thresholds. Otherwise send the new report*\/ */ - /* if (stats_context[mod_id].prev_stats_reply != NULL) { */ - - /* msg = flexran_agent_generate_diff_mac_stats_report(current_report, stats_context[mod_id].prev_stats_reply); */ - - /* /\*Destroy the old stats*\/ */ - /* flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply); */ - /* } */ - /* /\*Use the current report for future comparissons*\/ */ - /* stats_context[mod_id].prev_stats_reply = current_report; */ - - - if (pthread_mutex_unlock(stats_context[mod_id].mutex)) { - goto error; - } - - if (current_report != NULL){ - data=flexran_agent_pack_message(current_report, &size); - /*Send any stats updates using the MAC channel of the eNB*/ - if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); - return; - } - error: - LOG_W(FLEXRAN_AGENT, "Could not send update stats message\n"); -} - err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id) { /*Disable the continuous updates for the MAC*/ if (pthread_mutex_lock(stats_context[mod_id].mutex)) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 5461bf66aa..04a7859b42 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -694,9 +694,6 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, schedule_ue_spec_phy_test(module_idP,frameP,subframeP,mbsfn_status); } - if (RC.flexran[module_idP]->enabled) - flexran_agent_send_update_stats(module_idP); - // Allocate CCEs for good after scheduling is done for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { if(cc[CC_id].tdd_Config == NULL || !(is_UL_sf(&cc[CC_id],subframeP))) -- GitLab From 3b3c9daefb982729b891f0cbc7b5b5b43ac43dd5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 29 Oct 2018 09:05:04 +0100 Subject: [PATCH 182/308] Reformat flexran_agent_handle_stats() for better readability --- openair2/ENB_APP/flexran_agent_handler.c | 155 ++++++++++++----------- 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 046f608b44..c1153a29f8 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -242,89 +242,90 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr //Set the number of UEs and create list with their RNTIs stats configs report_config.nr_ue = flexran_get_mac_num_ues(mod_id); - report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); + report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue); if (report_config.ue_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; + // TODO: Add appropriate error code + err_code = -100; + goto error; } for (i = 0; i < report_config.nr_ue; i++) { - report_config.ue_report_type[i].ue_rnti = flexran_get_mac_ue_crnti(enb_id, i); - report_config.ue_report_type[i].ue_report_flags = ue_flags; + report_config.ue_report_type[i].ue_rnti = flexran_get_mac_ue_crnti(enb_id, i); + report_config.ue_report_type[i].ue_report_flags = ue_flags; } //Set the number of CCs and create a list with the cell stats configs report_config.nr_cc = MAX_NUM_CCs; - report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc); + report_config.cc_report_type = malloc(sizeof(cc_report_type_t) * report_config.nr_cc); if (report_config.cc_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; + // TODO: Add appropriate error code + err_code = -100; + goto error; } for (i = 0; i < report_config.nr_cc; i++) { - //TODO: Must fill in the proper cell ids - report_config.cc_report_type[i].cc_id = i; - report_config.cc_report_type[i].cc_report_flags = c_flags; + //TODO: Must fill in the proper cell ids + report_config.cc_report_type[i].cc_id = i; + report_config.cc_report_type[i].cc_report_flags = c_flags; } /* Check if request was periodical */ if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL) { - /* Create a one off flexran message as an argument for the periodical task */ - Protocol__FlexranMessage *timer_msg; - stats_request_config_t request_config; - request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; - request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; - request_config.period = 0; - /* Need to make sure that the ue flags are saved (Bug) */ - if (report_config.nr_ue == 0) { - report_config.nr_ue = 1; - report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t)); - if (report_config.ue_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; - } - report_config.ue_report_type[0].ue_rnti = 0; // Dummy value - report_config.ue_report_type[0].ue_report_flags = ue_flags; - } - request_config.config = &report_config; - flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg); - /* Create a timer */ - long timer_id = 0; - flexran_agent_timer_args_t *timer_args; - timer_args = malloc(sizeof(flexran_agent_timer_args_t)); - memset (timer_args, 0, sizeof(flexran_agent_timer_args_t)); - timer_args->mod_id = enb_id; - timer_args->msg = timer_msg; - /*Convert subframes to usec time*/ - usec_interval = 1000*comp_req->sf; - sec_interval = 0; - /*add seconds if required*/ - if (usec_interval >= 1000*1000) { - sec_interval = usec_interval/(1000*1000); - usec_interval = usec_interval%(1000*1000); - } - flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, flexran_agent_handle_timed_task,(void*) timer_args, &timer_id); + /* Create a one off flexran message as an argument for the periodical task */ + Protocol__FlexranMessage *timer_msg; + stats_request_config_t request_config; + request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; + request_config.period = 0; + /* Need to make sure that the ue flags are saved (Bug) */ + if (report_config.nr_ue == 0) { + report_config.nr_ue = 1; + report_config.ue_report_type = malloc(sizeof(ue_report_type_t)); + if (report_config.ue_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + report_config.ue_report_type[0].ue_rnti = 0; // Dummy value + report_config.ue_report_type[0].ue_report_flags = ue_flags; + } + request_config.config = &report_config; + flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg); + /* Create a timer */ + long timer_id = 0; + flexran_agent_timer_args_t *timer_args = malloc(sizeof(flexran_agent_timer_args_t)); + memset (timer_args, 0, sizeof(flexran_agent_timer_args_t)); + timer_args->mod_id = enb_id; + timer_args->msg = timer_msg; + /*Convert subframes to usec time*/ + usec_interval = 1000*comp_req->sf; + sec_interval = 0; + /*add seconds if required*/ + if (usec_interval >= 1000*1000) { + sec_interval = usec_interval/(1000*1000); + usec_interval = usec_interval%(1000*1000); + } + flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, + enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, + flexran_agent_handle_timed_task,(void*) timer_args, &timer_id); } else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) { - /*If request was for continuous updates, disable the previous configuration and - set up a new one*/ - flexran_agent_disable_cont_stats_update(mod_id); - stats_request_config_t request_config; - request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; - request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; - request_config.period = 0; - /* Need to make sure that the ue flags are saved (Bug) */ - if (report_config.nr_ue == 0) { - report_config.nr_ue = 1; - report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t)); - if (report_config.ue_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; - } - report_config.ue_report_type[0].ue_rnti = 0; // Dummy value - report_config.ue_report_type[0].ue_report_flags = ue_flags; - } - request_config.config = &report_config; - flexran_agent_enable_cont_stats_update(enb_id, xid, &request_config); + /*If request was for continuous updates, disable the previous configuration and + set up a new one*/ + flexran_agent_disable_cont_stats_update(mod_id); + stats_request_config_t request_config; + request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; + request_config.period = 0; + /* Need to make sure that the ue flags are saved (Bug) */ + if (report_config.nr_ue == 0) { + report_config.nr_ue = 1; + report_config.ue_report_type = malloc(sizeof(ue_report_type_t)); + if (report_config.ue_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + report_config.ue_report_type[0].ue_rnti = 0; // Dummy value + report_config.ue_report_type[0].ue_report_flags = ue_flags; + } + request_config.config = &report_config; + flexran_agent_enable_cont_stats_update(enb_id, xid, &request_config); } } break; @@ -334,14 +335,14 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr report_config.nr_ue = 0; report_config.ue_report_type = NULL; report_config.nr_cc = cell_req->n_cell; - report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc); + report_config.cc_report_type = malloc(sizeof(cc_report_type_t) * report_config.nr_cc); if (report_config.cc_report_type == NULL) { // TODO: Add appropriate error code err_code = -100; goto error; } for (i = 0; i < report_config.nr_cc; i++) { - //TODO: Must fill in the proper cell ids + //TODO: Must fill in the proper cell ids report_config.cc_report_type[i].cc_id = cell_req->cell[i]; report_config.cc_report_type[i].cc_report_flags = cell_req->flags; } @@ -352,7 +353,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr report_config.nr_cc = 0; report_config.cc_report_type = NULL; report_config.nr_ue = ue_req->n_rnti; - report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); + report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue); if (report_config.ue_report_type == NULL) { // TODO: Add appropriate error code err_code = -100; @@ -369,10 +370,10 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr goto error; } - if (flexran_agent_stats_reply(enb_id, xid, &report_config, msg )){ - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } + if (flexran_agent_stats_reply(enb_id, xid, &report_config, msg )) { + err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + goto error; + } free(report_config.ue_report_type); free(report_config.cc_report_type); -- GitLab From 23650bdea3216869144fcf0771626537ab8d79d4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 29 Oct 2018 10:44:52 +0100 Subject: [PATCH 183/308] Make flexran_agent_handle_stats() respect presence of MAC, RRC CMs --- openair2/ENB_APP/flexran_agent_handler.c | 38 +++++++++++++++++++----- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index c1153a29f8..26bf89d867 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -204,7 +204,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr // TODO: Must resolve conflicts among stats requests int i; - err_code_t err_code; + err_code_t err_code = 0; xid_t xid; uint32_t usec_interval, sec_interval; @@ -241,16 +241,36 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr //Create a list of all eNB RNTIs and cells //Set the number of UEs and create list with their RNTIs stats configs - report_config.nr_ue = flexran_get_mac_num_ues(mod_id); + report_config.nr_ue = 0; + if (flexran_agent_get_rrc_xface(mod_id)) + report_config.nr_ue = flexran_get_rrc_num_ues(mod_id); + else if (flexran_agent_get_mac_xface(mod_id)) + report_config.nr_ue = flexran_get_mac_num_ues(mod_id); + + if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id) + && flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) { + LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC and MAC\n"); + goto error; + } report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue); if (report_config.ue_report_type == NULL) { // TODO: Add appropriate error code err_code = -100; goto error; } - for (i = 0; i < report_config.nr_ue; i++) { - report_config.ue_report_type[i].ue_rnti = flexran_get_mac_ue_crnti(enb_id, i); - report_config.ue_report_type[i].ue_report_flags = ue_flags; + if (flexran_agent_get_rrc_xface(mod_id)) { + rnti_t rntis[report_config.nr_ue]; + flexran_get_rrc_rnti_list(mod_id, rntis, report_config.nr_ue); + for (i = 0; i < report_config.nr_ue; i++) { + report_config.ue_report_type[i].ue_rnti = rntis[mod_id]; + report_config.ue_report_type[i].ue_report_flags = ue_flags; + } + } + if (flexran_agent_get_mac_xface(mod_id) && !flexran_agent_get_rrc_xface(mod_id)) { + for (i = 0; i < report_config.nr_ue; i++) { + report_config.ue_report_type[i].ue_rnti = flexran_get_mac_ue_crnti(enb_id, i); + report_config.ue_report_type[i].ue_report_flags = ue_flags; + } } //Set the number of CCs and create a list with the cell stats configs report_config.nr_cc = MAX_NUM_CCs; @@ -375,13 +395,15 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr goto error; } - free(report_config.ue_report_type); - free(report_config.cc_report_type); + if (report_config.ue_report_type) + free(report_config.ue_report_type); + if (report_config.cc_report_type) + free(report_config.cc_report_type); return 0; error : - LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code); + LOG_E(FLEXRAN_AGENT, "%s(): errno %d occured\n", __func__, err_code); return err_code; } -- GitLab From 86d8e214450168cb78d446b0844c9435aefe865f Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 29 Oct 2018 11:21:13 +0100 Subject: [PATCH 184/308] Test for CMs before taking CM-specific stats --- openair2/ENB_APP/flexran_agent_handler.c | 44 ++++++++++-------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 26bf89d867..bdcd7bff7b 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -477,34 +477,26 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re } - /* - MAC reply split - */ - - - if (flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } - - /* - RRC reply split - */ + /* MAC reply split */ + if (flexran_agent_get_mac_xface(enb_id) + && flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { + err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + goto error; + } - if (flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } - + /* RRC reply split */ + if (flexran_agent_get_rrc_xface(enb_id) + && flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { + err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + goto error; + } - /* - PDCP reply split - */ - - if (flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } + /* PDCP reply split */ + if (flexran_agent_get_pdcp_xface(enb_id) + && flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { + err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + goto error; + } stats_reply_msg->cell_report = cell_report; -- GitLab From 2cf406068072e3bf1fa8585ea2c26e690beb0cba Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 29 Oct 2018 11:21:52 +0100 Subject: [PATCH 185/308] Implement stats_reply-specific destroy function --- openair2/ENB_APP/flexran_agent_common.h | 1 + openair2/ENB_APP/flexran_agent_handler.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index 29dd6fe61d..76f9e3ce5c 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -155,6 +155,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr /* Function to be used to handle reply message . */ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_stats_reply(Protocol__FlexranMessage *msg); /* Top level Statistics request protocol message constructor and destructor */ int flexran_agent_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index bdcd7bff7b..40c09ddef9 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -63,7 +63,7 @@ flexran_agent_message_destruction_callback message_destruction_callback[] = { flexran_agent_destroy_echo_request, flexran_agent_destroy_echo_reply, flexran_agent_destroy_stats_request, - flexran_agent_mac_destroy_stats_reply, + flexran_agent_destroy_stats_reply, flexran_agent_mac_destroy_sf_trigger, flexran_agent_mac_destroy_sr_info, flexran_agent_destroy_enb_config_request, @@ -648,6 +648,26 @@ int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg) { return -1; } +int flexran_agent_destroy_stats_reply(Protocol__FlexranMessage *msg) +{ + if (msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG) { + LOG_E(FLEXRAN_AGENT, "%s(): message is not a msg_stats_reply\n", __func__); + return -1; + } + + flexran_agent_mac_destroy_stats_reply((Protocol__FlexranMessage *)msg->stats_reply_msg); + // TODO implement rrc_destroy_stats_reply() + //flexran_agent_rrc_destroy_stats_reply(msg->stats_reply_msg); + // TODO implement pdcp_destroy_stats_reply() + //flexran_agent_pdcp_destroy_stats_reply(msg->stats_reply_msg); + free(msg->stats_reply_msg->header); + free(msg->stats_reply_msg->cell_report); + free(msg->stats_reply_msg->ue_report); + free(msg->stats_reply_msg); + free(msg); + return 0; +} + err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id) { /*Disable the continuous updates for the MAC*/ if (pthread_mutex_lock(stats_context[mod_id].mutex)) { -- GitLab From f02b53923462d923a1326a42edee83e0e4da23f8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 29 Oct 2018 11:23:08 +0100 Subject: [PATCH 186/308] Correct init_cont_stats_update(), test for result --- openair2/ENB_APP/flexran_agent.c | 7 +++++-- openair2/ENB_APP/flexran_agent_handler.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index d6402658a9..ff91d711d9 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -235,8 +235,11 @@ int flexran_agent_start(mid_t mod_id) */ /*Initialize the continuous stats update mechanism*/ - flexran_agent_init_cont_stats_update(mod_id); - + if (flexran_agent_init_cont_stats_update(mod_id) < 0) { + LOG_E(FLEXRAN_AGENT, "could not initialize continuous stats updates\n"); + goto error; + } + new_thread(receive_thread, flexran); /* Register and initialize the control modules depending on capabilities. diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 40c09ddef9..5e1cf7809a 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -730,7 +730,7 @@ err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id) { stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t)); if (stats_context[mod_id].mutex == NULL) goto error; - if (pthread_mutex_init(stats_context[mod_id].mutex, NULL)) + if (pthread_mutex_init(stats_context[mod_id].mutex, NULL) != 0) goto error; return 0; -- GitLab From 836f6c6374020ac5f13e1ee567aa94134daa6e20 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 29 Oct 2018 17:12:43 +0100 Subject: [PATCH 187/308] Include statistics flag only when values are written --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 14 +++++++++----- .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.c | 2 +- .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 2 ++ openair2/ENB_APP/flexran_agent_handler.c | 6 ++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 9890b2b0a2..f656bfb469 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -84,12 +84,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } ue_report[i]->bsr = elem; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR; } /* Check flag for creation of PHR report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) { ue_report[i]->phr = flexran_get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; ue_report[i]->has_phr = 1; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR; } @@ -130,7 +132,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, // Add RLC buffer status reports to the full report if (ue_report[i]->n_rlc_report > 0) ue_report[i]->rlc_report = rlc_reports; - + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS; } @@ -143,7 +145,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, // found in stats_common.pb-c.h. See // flex_ce_type in FlexRAN specification ue_report[i]->has_pending_mac_ces = 1; - + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS; } /* Check flag for creation of DL CQI report */ @@ -368,7 +370,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, dl_report->csi_report = csi_reports; //Add the DL CQI report to the stats report ue_report[i]->dl_cqi_report = dl_report; - + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI; } /* Check flag for creation of paging buffer status report */ @@ -413,6 +415,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, paging_report->paging_info = p_info; //Add the paging report to the UE report ue_report[i]->pbr = paging_report; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS; } /* Check flag for creation of UL CQI report */ @@ -484,7 +487,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } // Add full UL CQI report to the UE report ue_report[i]->ul_cqi_report = full_ul_report; - + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI; } if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) { @@ -580,7 +583,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ue_report[i]->mac_stats = macstats; - + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS; } @@ -622,6 +625,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0); ni_report->has_p0_nominal_pucch = 1; cell_report[i]->noise_inter_report = ni_report; + cell_report[i]->flags |= PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE; } } diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c index 34f3f414cc..85d5342c5f 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c @@ -116,7 +116,7 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, pdcp_aggr_stats->has_sfn =1; ue_report[i]->pdcp_stats = pdcp_aggr_stats; - + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS; } } } else { diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index ad5990b70f..ecffc27002 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -441,6 +441,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, } ue_report[i]->rrc_measurements = rrc_measurements; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS; } @@ -477,6 +478,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, // ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0); // ni_report->has_p0_nominal_pucch = 1; // cell_report[i]->noise_inter_report = ni_report; + // cell_report[i]->flags |= PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE; // } // } diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 5e1cf7809a..aabf817c2c 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -449,8 +449,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re protocol__flex_ue_stats_report__init(ue_report[i]); ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti; ue_report[i]->has_rnti = 1; - ue_report[i]->flags = report_config->ue_report_type[i].ue_report_flags; - ue_report[i]->has_flags = 1; + ue_report[i]->has_flags = 1; /* actual flags are filled in the CMs below */ } @@ -472,8 +471,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re protocol__flex_cell_stats_report__init(cell_report[i]); cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id; cell_report[i]->has_carrier_index = 1; - cell_report[i]->flags = report_config->cc_report_type[i].cc_report_flags; - cell_report[i]->has_flags = 1; + cell_report[i]->has_flags = 1; /* actual flags are filled in the CMs below */ } -- GitLab From c1e680dd89f8412f4f269daa3ac7e1d3d4e70eb6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 30 Oct 2018 19:38:06 +0100 Subject: [PATCH 188/308] FlexRAN: free memory of statistics reports --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 24 +++++++++---------- .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 2 +- .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.c | 8 +++++++ .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.h | 1 + .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 18 +++++++++++++- .../CONTROL_MODULES/RRC/flexran_agent_rrc.h | 2 +- openair2/ENB_APP/flexran_agent_handler.c | 16 +++++++------ 7 files changed, 48 insertions(+), 23 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index f656bfb469..c4afc852d5 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -646,14 +646,9 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, return -1; } -int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { - //TODO: Need to deallocate memory for the stats reply message - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG) - goto error; - free(msg->stats_reply_msg->header); +int flexran_agent_mac_destroy_stats_reply(Protocol__FlexStatsReply *reply) { int i, j, k; - Protocol__FlexStatsReply *reply = msg->stats_reply_msg; Protocol__FlexDlCqiReport *dl_report; Protocol__FlexUlCqiReport *ul_report; Protocol__FlexPagingBufferReport *paging_report; @@ -744,20 +739,23 @@ int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { free(ul_report->pucch_dbm[j]); } free(ul_report->pucch_dbm); + free(ul_report); + } + if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) { + for (j = 0; j < reply->ue_report[i]->mac_stats->n_mac_sdus_dl; j++) + free(reply->ue_report[i]->mac_stats->mac_sdus_dl[j]); + free(reply->ue_report[i]->mac_stats->mac_sdus_dl); + free(reply->ue_report[i]->mac_stats); } - free(reply->ue_report[i]); } - free(reply->ue_report); // Free memory for all Cell reports for (i = 0; i < reply->n_cell_report; i++) { - free(reply->cell_report[i]->noise_inter_report); - free(reply->cell_report[i]); + if (reply->cell_report[i]->flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { + free(reply->cell_report[i]->noise_inter_report); + } } - free(reply->cell_report); - free(reply); - free(msg); return 0; error: diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h index 24f00fa66f..f7886778dc 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -53,7 +53,7 @@ int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); /* Statistics reply protocol message constructor and destructor */ int flexran_agent_mac_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); -int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); +int flexran_agent_mac_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c index 85d5342c5f..de16757fa2 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c @@ -136,6 +136,14 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, return -1; } +int flexran_agent_pdcp_destroy_stats_reply(Protocol__FlexStatsReply *reply) +{ + for (int i = 0; i < reply->n_ue_report; ++i) { + if (reply->ue_report[i]->pdcp_stats) + free(reply->ue_report[i]->pdcp_stats); + } + return 0; +} int flexran_agent_register_pdcp_xface(mid_t mod_id) diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h index be952326e8..d1b2ee1a0a 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h @@ -51,6 +51,7 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); +int flexran_agent_pdcp_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* Get the stats from RAN API and aggregate them per USER*/ void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id, diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index ecffc27002..b6d5b18e04 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -493,7 +493,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, for (int i = 0; i < report_config->nr_ue; i++){ - if (ue_report[i]->rrc_measurements->neigh_meas != NULL){ + if (ue_report[i]->rrc_measurements && ue_report[i]->rrc_measurements->neigh_meas != NULL){ for (int j = 0; j < ue_report[i]->rrc_measurements->neigh_meas->n_eutra_meas; j++){ free(ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]); @@ -510,6 +510,22 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, return -1; } +int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply) +{ + for (int i = 0; i < reply->n_ue_report; i++){ + if (reply->ue_report[i]->rrc_measurements && reply->ue_report[i]->rrc_measurements->neigh_meas){ + for (int j = 0; j < reply->ue_report[i]->rrc_measurements->neigh_meas->n_eutra_meas; j++){ + free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->meas_result); + free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]); + } + free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas); + free(reply->ue_report[i]->rrc_measurements->neigh_meas); + free(reply->ue_report[i]->rrc_measurements); + } + } + return 0; +} + void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, Protocol__FlexUeConfig *ue_conf) { diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h index f65174cb4e..6007da2cf4 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h @@ -58,7 +58,7 @@ void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t *); /* Statistics reply protocol message constructor and destructor */ int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); -int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexranMessage *msg); +int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* Fill the RRC part of a ue_config message */ void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index aabf817c2c..f8af051201 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -113,7 +113,7 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); if ( err_code < 0 ){ goto error; - } else if (err_code == 1) { //If err_code > 1, we do not want to dispose the message yet + } else if (err_code == 0) { //If err_code > 1, we do not want to dispose the message yet protocol__flexran_message__free_unpacked(decoded_message, NULL); } return reply_message; @@ -653,14 +653,16 @@ int flexran_agent_destroy_stats_reply(Protocol__FlexranMessage *msg) return -1; } - flexran_agent_mac_destroy_stats_reply((Protocol__FlexranMessage *)msg->stats_reply_msg); - // TODO implement rrc_destroy_stats_reply() - //flexran_agent_rrc_destroy_stats_reply(msg->stats_reply_msg); - // TODO implement pdcp_destroy_stats_reply() - //flexran_agent_pdcp_destroy_stats_reply(msg->stats_reply_msg); - free(msg->stats_reply_msg->header); + flexran_agent_mac_destroy_stats_reply(msg->stats_reply_msg); + flexran_agent_rrc_destroy_stats_reply(msg->stats_reply_msg); + flexran_agent_pdcp_destroy_stats_reply(msg->stats_reply_msg); + for (int i = 0; i < msg->stats_reply_msg->n_cell_report; ++i) + free(msg->stats_reply_msg->cell_report[i]); + for (int i = 0; i < msg->stats_reply_msg->n_ue_report; ++i) + free(msg->stats_reply_msg->ue_report[i]); free(msg->stats_reply_msg->cell_report); free(msg->stats_reply_msg->ue_report); + free(msg->stats_reply_msg->header); free(msg->stats_reply_msg); free(msg); return 0; -- GitLab From 6bd69d6eaa22e74772d3b2cc1ea8de45b915f761 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 30 Oct 2018 09:03:32 +0100 Subject: [PATCH 189/308] Leave OER support in asn1c enabled OER can be disable with the switch -DASN_DISABLE_OER_SUPPORT. In F1AP, disabling OER leads to a typedef void a_type; leading to lots of compilation errors because of illegal void variable declarations. This commit leaves OER support enabled, avoiding this error. --- cmake_targets/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index ddba2fc772..ba5dc1607b 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -175,7 +175,6 @@ set(CMAKE_C_FLAGS set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'" ) -add_definitions("-DASN_DISABLE_OER_SUPPORT") ######################### -- GitLab From 07d9c6a3bed42556826fad8b1b4bcfab54bff84a Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 30 Oct 2018 09:06:36 +0100 Subject: [PATCH 190/308] Cast malloc() to type --- openair2/UTIL/LISTS/list.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/UTIL/LISTS/list.h b/openair2/UTIL/LISTS/list.h index 0fce126f22..b88c581dea 100644 --- a/openair2/UTIL/LISTS/list.h +++ b/openair2/UTIL/LISTS/list.h @@ -114,7 +114,7 @@ typedef struct { } varArray_t; static inline varArray_t * initVarArray(size_t increment, size_t atomSize) { - varArray_t * tmp=malloc(sizeof(varArray_t)+increment*atomSize); + varArray_t * tmp=(varArray_t *)malloc(sizeof(varArray_t)+increment*atomSize); tmp->size=0; tmp->atomSize=atomSize; tmp->mallocedSize=increment; @@ -129,7 +129,7 @@ static inline void * dataArray(varArray_t * input) { static inline void appendVarArray(varArray_t * input, void* data) { if (input->size>=input->mallocedSize) { input->mallocedSize+=input->increment; - input=realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize); + input=(varArray_t *)realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize); } memcpy((uint8_t*)(input+1)+input->atomSize*input->size++, data, input->atomSize); } -- GitLab From 04126f7bdce64ddf45c099a12b96c5ed06204342 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 7 Nov 2018 11:40:27 +0100 Subject: [PATCH 191/308] Do not compile with mem_block.c --- cmake_targets/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index ba5dc1607b..3e17f5a8f9 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1029,7 +1029,7 @@ set(UTIL_SRC ${OPENAIR_DIR}/common/utils/LOG/log.c # ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c ${OPENAIR2_DIR}/UTIL/MATH/oml.c - ${OPENAIR2_DIR}/UTIL/MEM/mem_block.c + #${OPENAIR2_DIR}/UTIL/MEM/mem_block.c # ${OPENAIR2_DIR}/UTIL/OCG/OCG.c # ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c # ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c -- GitLab From 6c33f790954b8047524ec6d03fc1b7c0de0a3dca Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 7 Nov 2018 11:45:24 +0100 Subject: [PATCH 192/308] Fix bugs after merge * F1AP has to read MCC/MNC from list * Do not stop if MACRLC list is not present in conf, it might be a CU --- openair2/ENB_APP/enb_config.c | 24 +++++++++++++++++------- openair2/RRC/LTE/rrc_eNB.c | 12 ++++++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 207776dd6f..89fbac9301 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -272,10 +272,10 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) { printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr)); } }// j=0..num_inst - } else {// MacRLC_ParamList.numelt > 0 + } /*else {// MacRLC_ParamList.numelt > 0 // ignore it AssertFatal (0, "No " CONFIG_STRING_MACRLC_LIST " configuration found"); - } + }*/ } int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { @@ -2013,8 +2013,18 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { for (k=0; k <num_enbs ; k++) { if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) { - paramdef_t SCTPParams[] = SCTPPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + sprintf(aprefix,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k); + paramdef_t PLMNParams[] = PLMNPARAMS_DESC; + paramlist_def_t PLMNParamList = {ENB_CONFIG_STRING_PLMN_LIST, NULL, 0}; + /* map parameter checking array instances to parameter definition array instances */ + checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK; + + for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) + PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); + config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix); + + paramdef_t SCTPParams[] = SCTPPARAMS_DESC; F1AP_SETUP_REQ (msg_p).num_cells_available++; @@ -2024,16 +2034,16 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr)); LOG_I(ENB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name); - F1AP_SETUP_REQ (msg_p).tac[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr)); + F1AP_SETUP_REQ (msg_p).tac[k] = *ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].uptr; LOG_I(ENB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).tac[k]); - F1AP_SETUP_REQ (msg_p).mcc[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr)); + F1AP_SETUP_REQ (msg_p).mcc[k] = *PLMNParamList.paramarray[0][ENB_MOBILE_COUNTRY_CODE_IDX].uptr; LOG_I(ENB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mcc[k]); - F1AP_SETUP_REQ (msg_p).mnc[k] = (uint16_t)atoi(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + F1AP_SETUP_REQ (msg_p).mnc[k] = *PLMNParamList.paramarray[0][ENB_MOBILE_NETWORK_CODE_IDX].uptr; LOG_I(ENB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc[k]); - F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = *PLMNParamList.paramarray[0][ENB_MNC_DIGIT_LENGTH].u8ptr; LOG_I(ENB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); AssertFatal((F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 2) || diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index daff5210b0..c072eb9250 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7452,8 +7452,8 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { int found_cell=0; for (int j=0;j<RC.nb_inst;j++) { eNB_RRC_INST *rrc = RC.rrc[j]; - if (rrc->configuration.mcc == f1_setup_req->mcc[i] && - rrc->configuration.mnc == f1_setup_req->mnc[i] && + if (rrc->configuration.mcc[0] == f1_setup_req->mcc[i] && + rrc->configuration.mnc[0] == f1_setup_req->mnc[i] && rrc->nr_cellid == f1_setup_req->nr_cellid[i]) { // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case) @@ -7504,9 +7504,9 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_RESP); } F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; - F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->configuration.mcc; - F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->configuration.mnc; - F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->configuration.mnc_digit_length; + F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->configuration.mcc[0]; + F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->configuration.mnc[0]; + F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->configuration.mnc_digit_length[0]; F1AP_SETUP_RESP (msg_p).nr_cellid[cu_cell_ind] = rrc->nr_cellid; F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i]; int num_SI= 0; @@ -7530,7 +7530,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { } else {// setup_req mcc/mnc match rrc internal list element LOG_W(RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d \n", - j, rrc->configuration.mcc, f1_setup_req->mcc[i],rrc->configuration.mnc, f1_setup_req->mnc[i]); + j, rrc->configuration.mcc[0], f1_setup_req->mcc[i],rrc->configuration.mnc[0], f1_setup_req->mnc[i]); } }// for (int j=0;j<RC.nb_inst;j++) -- GitLab From a477043a2497b9d564621e6c3d8fdb09b259e5c7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 7 Nov 2018 11:47:19 +0100 Subject: [PATCH 193/308] Add some useful LOG statements --- openair2/ENB_APP/enb_config.c | 6 ++++-- openair2/ENB_APP/flexran_agent_common.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 89fbac9301..f39bf330bf 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2939,13 +2939,13 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { int i,j,si_ind; - printf("cells_to_activated %d, RRC instances %d\n", + LOG_I(ENB_APP, "cells_to_activated %d, RRC instances %d\n", resp->num_cells_to_activate,RC.nb_inst); for (j=0;j<resp->num_cells_to_activate;j++) { for (i=0;i<RC.nb_inst;i++) { rrc_eNB_carrier_data_t *carrier = &RC.rrc[i]->carrier[0]; // identify local index of cell j by nr_cellid, plmn identity and physical cell ID - printf("Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n", + LOG_I(ENB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n", j,i,RC.rrc[i]->nr_cellid,resp->nr_cellid[j]); if (RC.rrc[i]->nr_cellid == resp->nr_cellid[j] && (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && @@ -2962,6 +2962,8 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { } // perform MAC/L1 common configuration configure_du_mac(i); + } else { + LOG_E(ENB_APP, "F1 Setup Response not matching\n"); } } } diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index c540e69051..b3da5a8520 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -601,7 +601,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl free(ue_config_reply_msg); if(*msg != NULL) free(*msg); - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -- GitLab From c32094685e8bb2a90e50a412f686c51f03c7ada6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 7 Nov 2018 11:48:17 +0100 Subject: [PATCH 194/308] Deliver SCTP ITTI messages with instance I --- openair3/SCTP/sctp_eNB_itti_messaging.c | 5 +++-- openair3/SCTP/sctp_eNB_itti_messaging.h | 3 ++- openair3/SCTP/sctp_eNB_task.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.c b/openair3/SCTP/sctp_eNB_itti_messaging.c index d2064c74c0..789af3f8ed 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.c +++ b/openair3/SCTP/sctp_eNB_itti_messaging.c @@ -38,7 +38,8 @@ int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, in return itti_send_msg_to_task(task_id, instance, message_p); } -int sctp_itti_send_new_message_ind(task_id_t task_id, uint32_t assoc_id, uint8_t *buffer, +int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, + uint32_t assoc_id, uint8_t *buffer, uint32_t buffer_length, uint16_t stream) { MessageDef *message_p; @@ -57,7 +58,7 @@ int sctp_itti_send_new_message_ind(task_id_t task_id, uint32_t assoc_id, uint8_t sctp_data_ind_p->buffer_length = buffer_length; sctp_data_ind_p->assoc_id = assoc_id; - return itti_send_msg_to_task(task_id, INSTANCE_DEFAULT, message_p); + return itti_send_msg_to_task(task_id, instance, message_p); } int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.h b/openair3/SCTP/sctp_eNB_itti_messaging.h index 49d2056a3c..a35dc2219a 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.h +++ b/openair3/SCTP/sctp_eNB_itti_messaging.h @@ -24,7 +24,8 @@ int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, int multi_sd); -int sctp_itti_send_new_message_ind(task_id_t task_id, uint32_t assoc_id, uint8_t *buffer, +int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, + uint32_t assoc_id, uint8_t *buffer, uint32_t buffer_length, uint16_t stream); int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 205e318d45..ff54c47255 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -1000,7 +1000,8 @@ sctp_eNB_read_from_socket( sinfo.sinfo_assoc_id, sctp_cnx->sd, n, ntohs(addr.sin_port), sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid)); - sctp_itti_send_new_message_ind(sctp_cnx->instance, + sctp_itti_send_new_message_ind(sctp_cnx->task_id, + sctp_cnx->instance, sinfo.sinfo_assoc_id, buffer, n, sinfo.sinfo_stream); } -- GitLab From f0c5f57159ec9875052078588e46eea699b48e5c Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 7 Nov 2018 11:50:05 +0100 Subject: [PATCH 195/308] Do not free mem_block in PDCP, it is freed in F1 or RLC --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 95ada28cf0..6923e09114 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -452,7 +452,6 @@ boolean_t pdcp_data_req( } // switch case } /* end if node_type is CU */ - free_mem_block(pdcp_pdu_p, __FUNCTION__); rlc_status = ack_result; } else // SRB -- GitLab From f3a5720dd94460262ad52f0c9f67d8f148960956 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 30 Oct 2018 22:03:31 +0100 Subject: [PATCH 196/308] FlexRAN: Apply slicing configuration if MAC CM present --- openair2/ENB_APP/flexran_agent_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index b3da5a8520..f31f40b074 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -763,10 +763,10 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Prot if (enb_config->n_cell_config > 1) LOG_W(FLEXRAN_AGENT, "ignoring slice configs for other cell except cell 0\n"); - if (enb_config->cell_config[0]->slice_config) { + if (flexran_agent_get_mac_xface(mod_id) && enb_config->cell_config[0]->slice_config) { prepare_update_slice_config(mod_id, enb_config->cell_config[0]->slice_config); - } else { - initiate_soft_restart(mod_id, enb_config->cell_config[0]); + //} else { + // initiate_soft_restart(mod_id, enb_config->cell_config[0]); } *msg = NULL; @@ -779,7 +779,7 @@ int flexran_agent_handle_ue_config_reply(mid_t mod_id, const void *params, Proto Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; Protocol__FlexUeConfigReply *ue_config_reply = input->ue_config_reply_msg; - for (i = 0; i < ue_config_reply->n_ue_config; i++) + for (i = 0; flexran_agent_get_mac_xface(mod_id) && i < ue_config_reply->n_ue_config; i++) prepare_ue_slice_assoc_update(mod_id, ue_config_reply->ue_config[i]); *msg = NULL; -- GitLab From 8d862dace45fbc3997af5505dc8d219cb100df30 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 2 Nov 2018 14:27:54 +0100 Subject: [PATCH 197/308] F1 test: fixes after merge --- cmake_targets/CMakeLists.txt | 4 ++-- openair2/LAYER2/PROTO_AGENT/cu_test.c | 2 +- openair2/LAYER2/PROTO_AGENT/du_test.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 3e17f5a8f9..f540084cb9 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2085,7 +2085,7 @@ add_executable(cu_test ) target_link_libraries(cu_test ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB} - ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl + ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB} ) add_executable(du_test @@ -2099,7 +2099,7 @@ add_executable(du_test ) target_link_libraries(du_test ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB} - ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl + ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB} ) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) diff --git a/openair2/LAYER2/PROTO_AGENT/cu_test.c b/openair2/LAYER2/PROTO_AGENT/cu_test.c index 2abb85c941..a611c0edf1 100644 --- a/openair2/LAYER2/PROTO_AGENT/cu_test.c +++ b/openair2/LAYER2/PROTO_AGENT/cu_test.c @@ -38,7 +38,7 @@ pdcp_data_ind( fflush(stdout); free_mem_block(sdu_buffer_pP, __func__); /* cannot free because of const */ - free(ctxt_pP); + //free(ctxt_pP); recv_client = 1; return 0; } diff --git a/openair2/LAYER2/PROTO_AGENT/du_test.c b/openair2/LAYER2/PROTO_AGENT/du_test.c index b455ba43d0..2084db3298 100644 --- a/openair2/LAYER2/PROTO_AGENT/du_test.c +++ b/openair2/LAYER2/PROTO_AGENT/du_test.c @@ -40,7 +40,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, fwrite(sdu_pP->data, sdu_sizeP, 1, stdout); fflush(stdout); free_mem_block(sdu_pP, __func__); - free(ctxt_pP); + //free(ctxt_pP); return 0; } -- GitLab From 62b89f828aeb74d8f3c412e4be10c5c5dd220268 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 5 Dec 2018 11:44:01 +0100 Subject: [PATCH 198/308] FlexRAN: Circumvent different RRC/MAC layer user ID sorting * RRC and MAC might sort users differently * therefore, we have to "reverse lookup" the MAC ID from the RNTI when filling user info * For this purpose, add RAN API function flexran_get_mac_ue_id_rnti() --- openair2/ENB_APP/flexran_agent_common.c | 5 +++-- openair2/ENB_APP/flexran_agent_handler.c | 3 ++- openair2/ENB_APP/flexran_agent_ran_api.c | 15 +++++++++++++++ openair2/ENB_APP/flexran_agent_ran_api.h | 2 ++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index f31f40b074..39ffd3579b 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -558,7 +558,8 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id) && flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) { - LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC and MAC\n"); + LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC (%d) and MAC (%d)\n", + flexran_get_rrc_num_ues(mod_id), flexran_get_mac_num_ues(mod_id)); goto error; } @@ -578,7 +579,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl if (flexran_agent_get_rrc_xface(mod_id)) flexran_agent_fill_rrc_ue_config(mod_id, rnti, ue_config[i]); if (flexran_agent_get_mac_xface(mod_id)) { - const int UE_id = flexran_get_mac_ue_id(mod_id, i); + const int UE_id = flexran_get_mac_ue_id_rnti(mod_id, rnti); flexran_agent_fill_mac_ue_config(mod_id, UE_id, ue_config[i]); } } diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index aafa8a4b4c..a1f6aea97d 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -249,7 +249,8 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id) && flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) { - LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC and MAC\n"); + LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC (%d) and MAC (%d)\n", + flexran_get_rrc_num_ues(mod_id), flexran_get_mac_num_ues(mod_id)); goto error; } report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue); diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index d2f9c6345e..3625d98793 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -129,6 +129,21 @@ int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id) return 3; } +int flexran_get_mac_ue_id_rnti(mid_t mod_id, rnti_t rnti) +{ + int n; + if (!mac_is_present(mod_id)) return 0; + /* get the (active) UE with RNTI i */ + for (n = 0; n < MAX_MOBILES_PER_ENB; ++n) { + if (RC.mac[mod_id]->UE_list.active[n] == TRUE + && rnti == UE_RNTI(mod_id, n)) { + return n; + } + } + return 0; + +} + int flexran_get_mac_ue_id(mid_t mod_id, int i) { int n; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index ab21872a65..75c2908a24 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -80,6 +80,8 @@ int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id); /* Get the rnti of a UE with id ue_id from MAC */ rnti_t flexran_get_mac_ue_crnti(mid_t mod_id, mid_t ue_id); +int flexran_get_mac_ue_id_rnti(mid_t mod_id, rnti_t rnti); + /* Return the UE id of attached UE as opposed to the index [0,NUM UEs] (i.e., * the i'th active UE). Returns 0 if the i'th active UE could not be found. */ int flexran_get_mac_ue_id(mid_t mod_id, int i); -- GitLab From d9bf26b9e8cce3f3e0b13d69323afe3c276ca7ae Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 5 Dec 2018 11:46:02 +0100 Subject: [PATCH 199/308] Sort FlexRAN statistics by user before sending --- openair2/ENB_APP/flexran_agent_common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 39ffd3579b..106fe15a85 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -531,6 +531,18 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl * ************************************ */ +int sort_ue_config(const void *a, const void *b) +{ + const Protocol__FlexUeConfig *fa = a; + const Protocol__FlexUeConfig *fb = b; + + if (fa->rnti < fb->rnti) + return -1; + else if (fa->rnti < fb->rnti) + return 1; + return 0; +} + int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; @@ -583,6 +595,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl flexran_agent_fill_mac_ue_config(mod_id, UE_id, ue_config[i]); } } + qsort(ue_config, ue_config_reply_msg->n_ue_config, sizeof(ue_config[0]), sort_ue_config); ue_config_reply_msg->ue_config = ue_config; } *msg = malloc(sizeof(Protocol__FlexranMessage)); -- GitLab From f3f2bc584f5de2175b86d7706e003e2614c747c8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 5 Dec 2018 18:16:27 +0100 Subject: [PATCH 200/308] F1AP_UE_CONTEXT_RELEASE_REQ: implement in DU * MAC differentiates between DU/eNB * sends ITTI message to DU task for F1AP_UE_CONTEXT_RELEASE_REQ * message is dispatched to correctly in DU_TASK * sender correctly fills IDs and cause and sends --- openair2/COMMON/f1ap_messages_def.h | 1 + openair2/COMMON/f1ap_messages_types.h | 16 +++++++ openair2/F1AP/f1ap_du_rrc_message_transfer.c | 4 +- openair2/F1AP/f1ap_du_task.c | 7 ++++ openair2/F1AP/f1ap_du_ue_context_management.c | 42 +++++++++++-------- openair2/F1AP/f1ap_du_ue_context_management.h | 3 +- .../LAYER2/MAC/eNB_scheduler_primitives.c | 31 ++++++++++---- openair2/LAYER2/MAC/mac_proto.h | 1 + 8 files changed, 74 insertions(+), 31 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 80da410fac..ec92ecbc32 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -34,6 +34,7 @@ MESSAGE_DEF(F1AP_INITIAL_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_i MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_rrc_message_t , f1ap_ul_rrc_message) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_resp_t, f1ap_initial_context_setup_resp) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_FAILURE, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_failure_t, f1ap_initial_context_setup_failure) +MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_release_req_t, f1ap_ue_context_release_req) /* RRC -> F1AP messages */ diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 5498ebadcb..c083acef13 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -289,4 +289,20 @@ typedef struct f1ap_ue_context_setup_req_s { int rrc_container_length; } f1ap_ue_context_setup_req_t; +typedef enum F1ap_Cause_e { + F1AP_CAUSE_NOTHING, /* No components present */ + F1AP_CAUSE_RADIO_NETWORK, + F1AP_CAUSE_TRANSPORT, + F1AP_CAUSE_PROTOCOL, + F1AP_CAUSE_MISC, +} f1ap_Cause_t; + +typedef struct f1ap_ue_context_release_s { + uint16_t rnti; + f1ap_Cause_t cause; + long cause_value; + uint8_t *rrc_container; + int rrc_container_length; +} f1ap_ue_context_release_req_t, f1ap_ue_context_release_cmd_t; + #endif /* F1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index b0ab66f2ed..5a612f6d92 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -57,9 +57,7 @@ extern f1ap_setup_req_t *f1ap_du_data; extern RAN_CONTEXT_t RC; - - -f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; +extern f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 0c94fc283a..589d994d18 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -39,6 +39,7 @@ extern RAN_CONTEXT_t RC; f1ap_setup_req_t *f1ap_du_data; +f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { @@ -179,6 +180,12 @@ void *F1AP_DU_task(void *arg) { // &F1AP_UL_RRC_MESSAGE(received_msg)); break; + case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC + LOG_I(DU_F1AP, "DU Task Received F1AP_UE_CONTEXT_RELEASE_REQ\n"); + DU_send_UE_CONTEXT_RELEASE_REQUEST(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_UE_CONTEXT_RELEASE_REQ(received_msg)); + break; + case TERMINATE_MESSAGE: LOG_W(DU_F1AP, " *** Exiting DU_F1AP thread\n"); itti_exit_task(); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 4477a1cd48..335b024e21 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -44,6 +44,7 @@ #undef C_RNTI extern f1ap_setup_req_t *f1ap_du_data; +extern f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, @@ -554,9 +555,8 @@ int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance) { } -// note: is temporary with f1ap_ue_context_setup_req_t int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { + f1ap_ue_context_release_req_t *req) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextReleaseRequest_t *out; F1AP_UEContextReleaseRequestIEs_t *ie; @@ -581,7 +581,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_ue[instance], req->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -590,7 +590,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_ue[instance], req->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -600,25 +600,27 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_Cause; - // dummy value - ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; - - switch(ie->value.choice.Cause.present) + switch (req->cause) { - case F1AP_Cause_PR_radioNetwork: - ie->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + case F1AP_CAUSE_RADIO_NETWORK: + ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + ie->value.choice.Cause.choice.radioNetwork = req->cause_value; break; - case F1AP_Cause_PR_transport: - ie->value.choice.Cause.choice.transport = F1AP_CauseTransport_unspecified; + case F1AP_CAUSE_TRANSPORT: + ie->value.choice.Cause.present = F1AP_Cause_PR_transport; + ie->value.choice.Cause.choice.transport = req->cause_value; break; - case F1AP_Cause_PR_protocol: - ie->value.choice.Cause.choice.protocol = F1AP_CauseProtocol_unspecified; + case F1AP_CAUSE_PROTOCOL: + ie->value.choice.Cause.present = F1AP_Cause_PR_protocol; + ie->value.choice.Cause.choice.protocol = req->cause_value; break; - case F1AP_Cause_PR_misc: - ie->value.choice.Cause.choice.misc = F1AP_CauseMisc_unspecified; + case F1AP_CAUSE_MISC: + ie->value.choice.Cause.present = F1AP_Cause_PR_misc; + ie->value.choice.Cause.choice.misc = req->cause_value; break; - case F1AP_Cause_PR_NOTHING: + case F1AP_CAUSE_NOTHING: default: + ie->value.choice.Cause.present = F1AP_Cause_PR_NOTHING; break; } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -629,7 +631,11 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, return -1; } - // send + du_f1ap_itti_send_sctp_data_req(instance, + f1ap_du_data->assoc_id, + buffer, + len, + f1ap_du_data->default_sctp_stream_id); return 0; } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index 4035f2da64..f1bc5562f7 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -47,9 +47,8 @@ int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance); /* * UE Context Release Request (gNB-DU initiated) */ -// note: is temporary with f1ap_ue_context_setup_req_t int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req); + f1ap_ue_context_release_req_t *req); /* diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 81520ed8fb..9e35964a4a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2059,16 +2059,33 @@ int rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP) cancel_ra_proc(mod_idP, pCC_id, 0, rntiP); } + if (RC.rrc[mod_idP]->node_type == ngran_eNB_DU + && RC.rrc[mod_idP]->node_type == ngran_gNB_DU) { + MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); + F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rntiP; + F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure + F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container = NULL; + F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container_length = 0; + itti_send_msg_to_task(TASK_DU_F1, mod_idP, m); + } + + rrc_mac_signal_ue_release(mod_idP, rntiP); + + return 0; +} + +void rrc_mac_signal_ue_release(module_id_t mod_idP, rnti_t rntiP) +{ pthread_mutex_lock(&rrc_release_freelist); - if(rrc_release_info.num_UEs > 0){ + if (rrc_release_info.num_UEs > 0) { uint16_t release_total = 0; - for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){ + for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { + if (rrc_release_info.RRC_release_ctrl[release_num].flag > 0) release_total++; - }else{ + else continue; - } - if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rntiP){ + if (rrc_release_info.RRC_release_ctrl[release_num].rnti == rntiP) { rrc_release_info.RRC_release_ctrl[release_num].flag = 0; rrc_release_info.num_UEs--; release_total--; @@ -2079,8 +2096,6 @@ int rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP) } } pthread_mutex_unlock(&rrc_release_freelist); - - return 0; } int prev(UE_list_t * listP, int nodeP, int ul_flag) diff --git a/openair2/LAYER2/MAC/mac_proto.h b/openair2/LAYER2/MAC/mac_proto.h index e0fdade419..cff9309864 100644 --- a/openair2/LAYER2/MAC/mac_proto.h +++ b/openair2/LAYER2/MAC/mac_proto.h @@ -699,6 +699,7 @@ int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti, int harq_pid #endif ); int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP); +void rrc_mac_signal_ue_release(module_id_t Mod_id, rnti_t rntiP); void store_dlsch_buffer(module_id_t Mod_id, int slice_idx, frame_t frameP, sub_frame_t subframeP); void assign_rbs_required(module_id_t Mod_id, int slice_idx, frame_t frameP, sub_frame_t subframe, uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], int min_rb_unit[NFAPI_CC_MAX]); -- GitLab From 707048c55134d0132c53aed3c2c2549d856182b3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 6 Dec 2018 14:28:06 +0100 Subject: [PATCH 201/308] F1AP_UE_CONTEXT_RELEASE_REQUEST: Handle in CU, don't send CMD --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_cu_task.c | 1 + openair2/F1AP/f1ap_cu_ue_context_management.c | 27 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 9727e3d5d7..54f15933a1 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -51,7 +51,7 @@ uint32_t f1ap_assoc_id = 0; uint32_t f1ap_stream = 0; -f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; +extern f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; /* Initial UL RRC Message Transfer diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index dc482e7061..3b64e5b228 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -40,6 +40,7 @@ extern RAN_CONTEXT_t RC; f1ap_setup_req_t *f1ap_du_data_from_du; +f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { // Nothing diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 4b6d12d4aa..dc3dbfa818 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -37,7 +37,10 @@ #include "f1ap_cu_ue_context_management.h" #include <string.h> +#include "openair2/LAYER2/MAC/mac_proto.h" + extern f1ap_setup_req_t *f1ap_du_data_from_du; +extern f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { @@ -766,38 +769,31 @@ int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, } -// note: is temporary with F1AP_UE_CONTEXT_SETUP_REQ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - MessageDef *msg_p; // message to RRC F1AP_UEContextReleaseRequest_t *container; F1AP_UEContextReleaseRequestIEs_t *ie; - //int i; + rnti_t rnti; DevAssert(pdu); - msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ); - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; - f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); - container = &pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest; - /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); - AssertFatal(f1ap_ue_context_setup_req->gNB_DU_ue_id, - "can not allocate memory for f1ap_ue_context_setup_req->gNB_DU_ue_id\n"); - *f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + AssertFatal(rnti == f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], + ie->value.choice.GNB_DU_UE_F1AP_ID), + "RNTI obtained through DU ID is different from CU ID\n"); /* Cause */ + /* We don't care for the moment F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_Cause, true); @@ -819,9 +815,12 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, default: break; } + */ - AssertFatal(0, "check configuration, send to appropriate handler\n"); + LOG_I(CU_F1AP, "Received UE_CONTEXT_RELEASE_REQUEST for RNTI %x, signalling to RRC\n", rnti); + rrc_mac_signal_ue_release(instance, rnti); + return 0; } -- GitLab From 956fafb51c464ff4edfe5cebceb4589d2b8067ef Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 6 Dec 2018 15:11:38 +0100 Subject: [PATCH 202/308] F1AP_UE_CONTEXT_RELEASE_REQUEST/COMPLETE: Implement in CU --- openair2/COMMON/f1ap_messages_def.h | 1 + openair2/COMMON/f1ap_messages_types.h | 1 + openair2/F1AP/f1ap_cu_task.c | 7 ++ openair2/F1AP/f1ap_cu_ue_context_management.c | 66 +++++++++---------- openair2/F1AP/f1ap_cu_ue_context_management.h | 3 +- openair2/RRC/LTE/rrc_eNB.c | 55 ++++++++++++---- 6 files changed, 81 insertions(+), 52 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index ec92ecbc32..9e341f9bcb 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -35,6 +35,7 @@ MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_r //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_resp_t, f1ap_initial_context_setup_resp) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_FAILURE, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_failure_t, f1ap_initial_context_setup_failure) MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_release_req_t, f1ap_ue_context_release_req) +MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_CMD, MESSAGE_PRIORITY_MED, f1ap_ue_context_release_cmd_t, f1ap_ue_context_release_cmd) /* RRC -> F1AP messages */ diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index c083acef13..9c69b74a87 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -42,6 +42,7 @@ #define F1AP_DL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_dl_rrc_message #define F1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_req +#define F1AP_UE_CONTEXT_RELEASE_CMD(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_req #define F1AP_UE_CONTEXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_req /* Length of the transport layer address string diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 3b64e5b228..f9f27e2653 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -34,6 +34,7 @@ #include "f1ap_handlers.h" #include "f1ap_cu_interface_management.h" #include "f1ap_cu_rrc_message_transfer.h" +#include "f1ap_cu_ue_context_management.h" #include "f1ap_cu_task.h" #include "proto_agent.h" @@ -170,6 +171,12 @@ void *F1AP_CU_task(void *arg) { &F1AP_DL_RRC_MESSAGE(received_msg)); break; + case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc + LOG_I(CU_F1AP, "CU Task Received F1AP_UE_CONTEXT_RELEASE_CMD\n"); + CU_send_UE_CONTEXT_RELEASE_COMMAND(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_UE_CONTEXT_RELEASE_CMD(received_msg)); + break; + // case F1AP_SETUP_RESPONSE: // This is from RRC // CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) // break; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index dc3dbfa818..8a0ed86416 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -790,7 +790,7 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); AssertFatal(rnti == f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], ie->value.choice.GNB_DU_UE_F1AP_ID), - "RNTI obtained through DU ID is different from CU ID\n"); + "RNTI obtained through DU ID is different from CU ID\n"); /* Cause */ /* We don't care for the moment @@ -825,14 +825,13 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { + f1ap_ue_context_release_cmd_t *cmd) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextReleaseCommand_t *out; F1AP_UEContextReleaseCommandIEs_t *ie; uint8_t *buffer; uint32_t len; - //int i = 0, j = 0; /* Create */ /* 0. Message Type */ @@ -850,7 +849,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_ue[instance], cmd->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -859,7 +858,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_ue[instance], cmd->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -869,25 +868,26 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_Cause; - // dummy value - ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; - - switch(ie->value.choice.Cause.present) - { - case F1AP_Cause_PR_radioNetwork: - ie->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + switch (cmd->cause) { + case F1AP_CAUSE_RADIO_NETWORK: + ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + ie->value.choice.Cause.choice.radioNetwork = cmd->cause_value; break; - case F1AP_Cause_PR_transport: - ie->value.choice.Cause.choice.transport = F1AP_CauseTransport_unspecified; + case F1AP_CAUSE_TRANSPORT: + ie->value.choice.Cause.present = F1AP_Cause_PR_transport; + ie->value.choice.Cause.choice.transport = cmd->cause_value; break; - case F1AP_Cause_PR_protocol: - ie->value.choice.Cause.choice.protocol = F1AP_CauseProtocol_unspecified; + case F1AP_CAUSE_PROTOCOL: + ie->value.choice.Cause.present = F1AP_Cause_PR_protocol; + ie->value.choice.Cause.choice.protocol = cmd->cause_value; break; - case F1AP_Cause_PR_misc: - ie->value.choice.Cause.choice.misc = F1AP_CauseMisc_unspecified; + case F1AP_CAUSE_MISC: + ie->value.choice.Cause.present = F1AP_Cause_PR_misc; + ie->value.choice.Cause.choice.misc = cmd->cause_value; break; - case F1AP_Cause_PR_NOTHING: + case F1AP_CAUSE_NOTHING: default: + ie->value.choice.Cause.present = F1AP_Cause_PR_NOTHING; break; } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -899,8 +899,8 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char *)cmd->rrc_container, + cmd->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ @@ -909,41 +909,33 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, return -1; } - // send + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); return 0; } -// note: is temporary with F1AP_UE_CONTEXT_SETUP_REQ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - MessageDef *msg_p; // message to RRC F1AP_UEContextReleaseComplete_t *container; F1AP_UEContextReleaseCompleteIEs_t *ie; - //int i; + rnti_t rnti; DevAssert(pdu); - msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ); - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; - f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); - container = &pdu->choice.successfulOutcome->value.choice.UEContextReleaseComplete; - /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); - AssertFatal(f1ap_ue_context_setup_req->gNB_DU_ue_id, - "can not allocate memory for f1ap_ue_context_setup_req->gNB_DU_ue_id\n"); - *f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + AssertFatal(rnti == f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], + ie->value.choice.GNB_DU_UE_F1AP_ID), + "RNTI obtained through DU ID is different from CU ID\n"); /* Optional*/ /* CriticalityDiagnostics */ @@ -958,7 +950,9 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, // F1AP_CriticalityDiagnostics_IE_List } - AssertFatal(0, "check configuration, send to appropriate handler\n"); + LOG_I(CU_F1AP, "Received UE CONTEXT RELEASE COMPLETE: Removing CU UE entry for RNTI %x\n", rnti); + f1ap_remove_ue(&f1ap_cu_ue[instance], rnti); + return 0; } diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h index 77c3abea72..cc4ca3e35f 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.h +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -61,9 +61,8 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* * UE Context Release (gNB-CU initiated) */ -// note: is temporary with f1ap_ue_context_setup_req_t int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req); + f1ap_ue_context_release_cmd_t *cmd); int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, uint32_t assoc_id, diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index c072eb9250..2302e3f9da 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1068,8 +1068,13 @@ void release_UE_in_freeList(module_id_t mod_id) rrc_rlc_remove_ue(&ctxt); } else if (RC.rrc[mod_id]->node_type == ngran_eNB_CU || RC.rrc[mod_id]->node_type == ngran_ng_eNB_CU) { - // send UE_CONTEXT_RELEASE - AssertFatal(1==0,"Need to added context removal\n"); + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = rnti; + F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0; + itti_send_msg_to_task(TASK_CU_F1, mod_id, m); } pdcp_remove_UE(&ctxt); @@ -2176,14 +2181,24 @@ rrc_eNB_generate_RRCConnectionRelease( } } pthread_mutex_unlock(&rrc_release_freelist); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU + || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) { + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; + F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = buffer; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = size; + itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m); + } else { + rrc_data_req(ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + } } uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9}; @@ -6487,8 +6502,13 @@ rrc_eNB_decode_ccch( rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); } else { - // send message to DU to remove context - AssertFatal(1==0,"Need to added context removal\n"); + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; + F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0; + itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m); } stmsi_received=1; /* replace rnti in the context */ @@ -6590,8 +6610,15 @@ rrc_eNB_decode_ccch( if (RC.rrc[ctxt_pP->module_id] == ngran_eNB) rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || - RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) - AssertFatal(1==0,"Need to added context removal\n"); + RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) { + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; + F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0; + itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m); + } return -1; } -- GitLab From 412caafd3180476827ea5944ca95d11ec6288ad9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 7 Dec 2018 14:14:15 +0100 Subject: [PATCH 203/308] F1AP_UE_CONTEXT_RELEASE_COMMAND: Implement in DU, don't send COMPLETE --- openair2/F1AP/f1ap_decoder.c | 3 + openair2/F1AP/f1ap_du_ue_context_management.c | 127 +++++++++++------- openair2/F1AP/f1ap_handlers.c | 2 +- 3 files changed, 83 insertions(+), 49 deletions(-) diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 5fad54cf77..6dcf9d6507 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -63,6 +63,9 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; + case F1AP_ProcedureCode_id_UEContextRelease: + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__); + break; // case F1AP_ProcedureCode_id_InitialContextSetup: // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); // message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 335b024e21..4fd823b9f0 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -36,6 +36,9 @@ #include "f1ap_itti_messaging.h" #include "f1ap_du_ue_context_management.h" +#include "rrc_extern.h" +#include "rrc_eNB_UE_context.h" + // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which // replaces in ie->value.choice.C_RNTI, causing @@ -45,6 +48,7 @@ extern f1ap_setup_req_t *f1ap_du_data; extern f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; +extern RAN_CONTEXT_t RC; int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, @@ -641,75 +645,102 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, } -// note: is temporary with F1AP_UE_CONTEXT_SETUP_REQ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - MessageDef *msg_p; // message to RRC - F1AP_UEContextReleaseRequest_t *container; - F1AP_UEContextReleaseRequestIEs_t *ie; + F1AP_UEContextReleaseCommand_t *container; + F1AP_UEContextReleaseCommandIEs_t *ie; + protocol_ctxt_t ctxt; DevAssert(pdu); - msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ); - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; - f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); - - container = &pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest; + container = &pdu->choice.initiatingMessage->value.choice.UEContextReleaseCommand; /* GNB_CU_UE_F1AP_ID */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_du_ue[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; /* GNB_DU_UE_F1AP_ID */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); - if (f1ap_ue_context_setup_req->gNB_DU_ue_id) - *f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + AssertFatal(ctxt.rnti == f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance], + ie->value.choice.GNB_DU_UE_F1AP_ID), + "RNTI obtained through DU ID is different from CU ID\n"); - /* Cause */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_Cause, true); + /* We don't need the Cause */ - switch(ie->value.choice.Cause.present) - { - case F1AP_Cause_PR_radioNetwork: - //ie->value.choice.Cause.choice.radioNetwork - break; - case F1AP_Cause_PR_transport: - //ie->value.choice.Cause.choice.transport - break; - case F1AP_Cause_PR_protocol: - //ie->value.choice.Cause.choice.protocol - break; - case F1AP_Cause_PR_misc: - //ie->value.choice.Cause.choice.misc - break; - case F1AP_Cause_PR_NOTHING: - default: - break; - } - - /* Optional */ - /* RRC Container */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + /* Optional RRC Container: if present, send to UE */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, false); if (ie) { - // message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); - // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - // ccch_sdu_len = ie->value.choice.RRCContainer.size; - // memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, - // ccch_sdu_len); - // LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); - // for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + /*pstruct rrc_eNB_ue_context_s* ue_context_p; + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id], ctxt.rnti); + + thread_mutex_lock(&rrc_release_freelist); + for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { + if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { + if (ue_context_p->ue_context.ue_release_timer_s1 > 0) + rrc_release_info.RRC_release_ctrl[release_num].flag = 1; + else + rrc_release_info.RRC_release_ctrl[release_num].flag = 2; + rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; + // TODO: how to provide the correct MUI? + rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; + rrc_release_info.num_UEs++; + LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, + ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); + break; + } + } + pthread_mutex_unlock(&rrc_release_freelist);*/ + + const sdu_size_t sdu_len = ie->value.choice.RRCContainer.size; + mem_block_t *pdu_p = NULL; + pdu_p = get_free_mem_block(sdu_len, __func__); + memcpy(&pdu_p->data[0], ie->value.choice.RRCContainer.buf, sdu_len); + rlc_op_status_t rlc_status = rlc_data_req(&ctxt + , 1 + , MBMS_FLAG_NO + , 1 // SRB 1 correct? + , 0 + , 0 + , sdu_len + , pdu_p +#ifdef Rel14 + ,NULL + ,NULL +#endif + ); + switch (rlc_status) { + case RLC_OP_STATUS_OK: + break; + case RLC_OP_STATUS_BAD_PARAMETER: + LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + break; + case RLC_OP_STATUS_INTERNAL_ERROR: + LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + break; + case RLC_OP_STATUS_OUT_OF_RESSOURCES: + LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + break; + default: + LOG_W(DU_F1AP, "RLC returned an unknown status code after DU_F1AP placed " + "the order to send some data (Status Code:%d)\n", rlc_status); + break; + } } - AssertFatal(0, "check configuration, send to appropriate handler\n"); + rrc_mac_remove_ue(instance, ctxt.rnti); + rrc_rlc_remove_ue(&ctxt); + /* DU_send_UE_CONTEXT_RELEASE_COMPLETE() */ + return 0; } diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index b192cde0de..97f7b25138 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -52,7 +52,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* gNBDUConfigurationUpdate */ { 0, 0, 0 }, /* gNBCUConfigurationUpdate */ { DU_handle_UE_CONTEXT_SETUP_REQUEST, CU_handle_UE_CONTEXT_SETUP_RESPONSE, 0 }, /* UEContextSetup */ - { 0, 0, 0 }, /* UEContextRelease */ + { DU_handle_UE_CONTEXT_RELEASE_COMMAND, 0, 0 }, /* UEContextRelease */ { 0, 0, 0 }, /* UEContextModification */ { 0, 0, 0 }, /* UEContextModificationRequired */ { 0, 0, 0 }, /* UEMobilityCommand */ -- GitLab From ae3ef270591dec5ac9be6ae279ae4e96d7e1a058 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 7 Dec 2018 15:01:52 +0100 Subject: [PATCH 204/308] Move F1 UE ctxt release req to function mac_eNB_rrc_ul_failure() --- openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 11 ----------- openair2/RRC/LTE/L2_interface.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 9e35964a4a..817cfd2033 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2059,17 +2059,6 @@ int rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP) cancel_ra_proc(mod_idP, pCC_id, 0, rntiP); } - if (RC.rrc[mod_idP]->node_type == ngran_eNB_DU - && RC.rrc[mod_idP]->node_type == ngran_gNB_DU) { - MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); - F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rntiP; - F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; - F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure - F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container = NULL; - F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container_length = 0; - itti_send_msg_to_task(TASK_DU_F1, mod_idP, m); - } - rrc_mac_signal_ue_release(mod_idP, rntiP); return 0; diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 93cd84b700..095cdcf852 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -390,6 +390,18 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, flexran_agent_get_rrc_xface(Mod_instP)->flexran_agent_notify_ue_state_change(Mod_instP, rntiP, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } + + if (RC.rrc[Mod_instP]->node_type == ngran_eNB_DU + && RC.rrc[Mod_instP]->node_type == ngran_gNB_DU) { + MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); + F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rntiP; + F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure + F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container = NULL; + F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container_length = 0; + itti_send_msg_to_task(TASK_DU_F1, Mod_instP, m); + } + rrc_mac_remove_ue(Mod_instP,rntiP); } -- GitLab From 6f19bc4b8fc9b2cb93c629825a927e89d8a54cd0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 7 Dec 2018 15:49:04 +0100 Subject: [PATCH 205/308] Add F1AP_UE_CONTEXT_RELEASE_COMPLETE, tx in DU, correctly rx in CU --- openair2/COMMON/f1ap_messages_types.h | 3 +- openair2/F1AP/f1ap_decoder.c | 7 +- openair2/F1AP/f1ap_du_ue_context_management.c | 135 +++++++++--------- openair2/F1AP/f1ap_du_ue_context_management.h | 3 +- openair2/F1AP/f1ap_handlers.c | 2 +- 5 files changed, 79 insertions(+), 71 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 9c69b74a87..6afd3f6dfa 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -304,6 +304,7 @@ typedef struct f1ap_ue_context_release_s { long cause_value; uint8_t *rrc_container; int rrc_container_length; -} f1ap_ue_context_release_req_t, f1ap_ue_context_release_cmd_t; +} f1ap_ue_context_release_req_t, f1ap_ue_context_release_cmd_t, + f1ap_ue_context_release_cplt_t; #endif /* F1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 6dcf9d6507..e31565243e 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -96,8 +96,11 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) switch(pdu->choice.successfulOutcome->procedureCode) { case F1AP_ProcedureCode_id_F1Setup: - LOG_I(F1AP, "get F1AP_ProcedureCode_id_F1Setup\n"); - + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__); + break; + + case F1AP_ProcedureCode_id_UEContextRelease: + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__); break; default: diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 4fd823b9f0..aa81ee6815 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -739,22 +739,20 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, rrc_mac_remove_ue(instance, ctxt.rnti); rrc_rlc_remove_ue(&ctxt); - /* DU_send_UE_CONTEXT_RELEASE_COMPLETE() */ + f1ap_ue_context_release_cplt_t cplt; + cplt.rnti = ctxt.rnti; + DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); + return 0; } -// note: is temporary with f1ap_ue_context_setup_req_t int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { - F1AP_F1AP_PDU_t pdu; + f1ap_ue_context_release_cplt_t *cplt) { + F1AP_F1AP_PDU_t pdu; F1AP_UEContextReleaseComplete_t *out; F1AP_UEContextReleaseCompleteIEs_t *ie; - uint8_t *buffer; - uint32_t len; - int i = 0;//, j = 0; - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -771,7 +769,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_ue[instance], cplt->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -780,73 +778,80 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_ue[instance], cplt->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* optional */ + /* optional -> currently not used */ /* c3. CriticalityDiagnostics */ - if (0) { - ie = (F1AP_UEContextReleaseCompleteIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCompleteIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_CriticalityDiagnostics; - - // dummy value - /* optional */ - /* procedureCode */ - if (0) { - ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - ie->value.choice.CriticalityDiagnostics.procedureCode = 0L; - } - - /* optional */ - /* triggeringMessage */ - if (0) { - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)F1AP_TriggeringMessage_successful_outcome; - } - - /* optional */ - /* procedureCriticality */ - if (0) { - ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); - ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; - } - - /* optional */ - /* transactionID */ - if (0) { - ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - ie->value.choice.CriticalityDiagnostics.transactionID = 0L; - } - - /* optional */ - /* F1AP_CriticalityDiagnostics_IE_List */ - if (0) { - for (i=0; - i<0; - i++) { - - F1AP_CriticalityDiagnostics_IE_Item_t *criticalityDiagnostics_ie_item = (F1AP_CriticalityDiagnostics_IE_Item_t *)calloc(1, sizeof(F1AP_CriticalityDiagnostics_IE_Item_t));; - criticalityDiagnostics_ie_item->iECriticality = F1AP_Criticality_reject; - criticalityDiagnostics_ie_item->iE_ID = 0L; - criticalityDiagnostics_ie_item->typeOfError = F1AP_TypeOfError_not_understood; - - ASN_SEQUENCE_ADD(&ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics->list, - criticalityDiagnostics_ie_item); - } - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } + //if (0) { + // ie = (F1AP_UEContextReleaseCompleteIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCompleteIEs_t)); + // ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + // ie->criticality = F1AP_Criticality_ignore; + // ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_CriticalityDiagnostics; + + // // dummy value + // /* optional */ + // /* procedureCode */ + // if (0) { + // ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + // ie->value.choice.CriticalityDiagnostics.procedureCode = 0L; + // } + + // /* optional */ + // /* triggeringMessage */ + // if (0) { + // ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + // ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)F1AP_TriggeringMessage_successful_outcome; + // } + + // /* optional */ + // /* procedureCriticality */ + // if (0) { + // ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + // ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + // } + + // /* optional */ + // /* transactionID */ + // if (0) { + // ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + // ie->value.choice.CriticalityDiagnostics.transactionID = 0L; + // } + + // /* optional */ + // /* F1AP_CriticalityDiagnostics_IE_List */ + // if (0) { + // for (i=0; + // i<0; + // i++) { + + // F1AP_CriticalityDiagnostics_IE_Item_t *criticalityDiagnostics_ie_item = (F1AP_CriticalityDiagnostics_IE_Item_t *)calloc(1, sizeof(F1AP_CriticalityDiagnostics_IE_Item_t));; + // criticalityDiagnostics_ie_item->iECriticality = F1AP_Criticality_reject; + // criticalityDiagnostics_ie_item->iE_ID = 0L; + // criticalityDiagnostics_ie_item->typeOfError = F1AP_TypeOfError_not_understood; + + // ASN_SEQUENCE_ADD(&ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics->list, + // criticalityDiagnostics_ie_item); + // } + // } + // ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + //} /* encode */ + uint8_t *buffer; + uint32_t len; if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(DU_F1AP, "Failed to encode F1 context release complete\n"); return -1; } - // send + du_f1ap_itti_send_sctp_data_req(instance, + f1ap_du_data->assoc_id, + buffer, + len, + f1ap_du_data->default_sctp_stream_id); + f1ap_remove_ue(&f1ap_du_ue[instance], cplt->rnti); return 0; } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index f1bc5562f7..2bb3ca95b9 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -62,9 +62,8 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, /* * UE Context Release Complete (gNB-DU initiated) */ -// note: is temporary with f1ap_ue_context_setup_req_t int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req); + f1ap_ue_context_release_cplt_t *cplt); /* diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 97f7b25138..2068c743a8 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -52,7 +52,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* gNBDUConfigurationUpdate */ { 0, 0, 0 }, /* gNBCUConfigurationUpdate */ { DU_handle_UE_CONTEXT_SETUP_REQUEST, CU_handle_UE_CONTEXT_SETUP_RESPONSE, 0 }, /* UEContextSetup */ - { DU_handle_UE_CONTEXT_RELEASE_COMMAND, 0, 0 }, /* UEContextRelease */ + { DU_handle_UE_CONTEXT_RELEASE_COMMAND, CU_handle_UE_CONTEXT_RELEASE_COMPLETE, 0 }, /* UEContextRelease */ { 0, 0, 0 }, /* UEContextModification */ { 0, 0, 0 }, /* UEContextModificationRequired */ { 0, 0, 0 }, /* UEMobilityCommand */ -- GitLab From 58850e3c868e6844323a61db30da5b753c557ddd Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 7 Dec 2018 16:31:36 +0100 Subject: [PATCH 206/308] Send F1 UE CONTEXT RELEASE REQ when RRC detects radio failure --- openair2/RRC/LTE/rrc_eNB.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 2302e3f9da..77ad8dac7c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -942,7 +942,23 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* if((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP,rnti) >= RRC_CONNECTED)) { LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); - rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost + if (RC.rrc[enb_mod_idP]->node_type == ngran_eNB + || RC.rrc[enb_mod_idP]->node_type == ngran_eNB_CU + || RC.rrc[enb_mod_idP]->node_type == ngran_gNB_CU) { + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ( + enb_mod_idP, + ue_context_pP, + S1AP_CAUSE_RADIO_NETWORK, + 21); // send cause 21: connection with ue lost + } else { // DU + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); + F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = ue_context_pP->ue_context.rnti; + F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure + F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container = NULL; + F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container_length = 0; + itti_send_msg_to_task(TASK_DU_F1, enb_mod_idP, m); + } /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before * triggering the S1 UE Context Release Request procedure -- GitLab From e389b7981874cc7f50b2115522c113817bd54f50 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 7 Dec 2018 16:32:42 +0100 Subject: [PATCH 207/308] F1 handlers: Improve error message if RNTI obtained through CU/DU ID differ --- openair2/F1AP/f1ap_cu_ue_context_management.c | 22 ++++++++++--------- openair2/F1AP/f1ap_du_ue_context_management.c | 8 ++++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 8a0ed86416..2c97e93f09 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -775,7 +775,6 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextReleaseRequest_t *container; F1AP_UEContextReleaseRequestIEs_t *ie; - rnti_t rnti; DevAssert(pdu); @@ -783,14 +782,16 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); + const rnti_t rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], + ie->value.choice.GNB_CU_UE_F1AP_ID); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - AssertFatal(rnti == f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], - ie->value.choice.GNB_DU_UE_F1AP_ID), - "RNTI obtained through DU ID is different from CU ID\n"); + const rnti_t rnti2 = f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], + ie->value.choice.GNB_DU_UE_F1AP_ID); + AssertFatal(rnti == rnti2, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", + rnti2, rnti); /* Cause */ /* We don't care for the moment @@ -920,7 +921,6 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextReleaseComplete_t *container; F1AP_UEContextReleaseCompleteIEs_t *ie; - rnti_t rnti; DevAssert(pdu); @@ -928,14 +928,16 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); + const rnti_t rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], + ie->value.choice.GNB_CU_UE_F1AP_ID); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - AssertFatal(rnti == f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], - ie->value.choice.GNB_DU_UE_F1AP_ID), - "RNTI obtained through DU ID is different from CU ID\n"); + const rnti_t rnti2 = f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], + ie->value.choice.GNB_DU_UE_F1AP_ID); + AssertFatal(rnti == rnti2, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", + rnti2, rnti); /* Optional*/ /* CriticalityDiagnostics */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index aa81ee6815..15b8004991 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -669,9 +669,11 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - AssertFatal(ctxt.rnti == f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance], - ie->value.choice.GNB_DU_UE_F1AP_ID), - "RNTI obtained through DU ID is different from CU ID\n"); + const rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance], + ie->value.choice.GNB_DU_UE_F1AP_ID); + AssertFatal(ctxt.rnti == rnti, + "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", + rnti, ctxt.rnti); /* We don't need the Cause */ -- GitLab From 29f23e161ed66549cceaaa76f35af7ec7eb2c9e8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 10 Jan 2019 14:28:16 +0100 Subject: [PATCH 208/308] Fix socket type to IPv4 in case of no-multi usage sctp_create_new_listener() takes a parameter server_type which is NOT the IP version but whether it is an SCTP multihoming server. There was a bug that when multihoming is not wanted, it created an IPv6 socket instead of IPv4. This commit fixes this. IPv6 is not supported yet. --- openair3/SCTP/sctp_eNB_task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index ff54c47255..4a44dfa2cf 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -745,7 +745,7 @@ static int sctp_create_new_listener( } } else { - if ((sd = socket(AF_INET6, SOCK_STREAM, IPPROTO_SCTP)) < 0) { + if ((sd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP)) < 0) { SCTP_ERROR("socket: %s:%d\n", strerror(errno), errno); return -1; } -- GitLab From be17b9b6556dc0451f8465c9bf29d2cd6cf0baf9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 10 Jan 2019 14:32:05 +0100 Subject: [PATCH 209/308] Correctly handle UE RELEASE COMPLETE in CU * remove PDCP/RRC contexts * inform the FlexRAN controller --- openair2/F1AP/f1ap_cu_ue_context_management.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 2c97e93f09..8b15ede8c5 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -38,9 +38,12 @@ #include <string.h> #include "openair2/LAYER2/MAC/mac_proto.h" +#include "rrc_extern.h" +#include "rrc_eNB_UE_context.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; extern f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; +extern RAN_CONTEXT_t RC; int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { @@ -952,6 +955,23 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, // F1AP_CriticalityDiagnostics_IE_List } + /* The following is normally done in the function release_UE_in_freeList() */ + /* remove PDCP entry */ + protocol_ctxt_t ctxt; + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, instance, ENB_FLAG_YES, rnti, 0, 0, instance); + pdcp_remove_UE(&ctxt); + + /* trigger UE release in RRC */ + struct rrc_eNB_ue_context_s *ue_context_pP; + ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); + if (ue_context_pP) + rrc_eNB_remove_ue_context(&ctxt, RC.rrc[instance], ue_context_pP); + + /* notify the agent */ + if (flexran_agent_get_rrc_xface(instance)) + flexran_agent_get_rrc_xface(instance)->flexran_agent_notify_ue_state_change( + instance, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + LOG_I(CU_F1AP, "Received UE CONTEXT RELEASE COMPLETE: Removing CU UE entry for RNTI %x\n", rnti); f1ap_remove_ue(&f1ap_cu_ue[instance], rnti); return 0; -- GitLab From 05e08d50948ad02081a9cb5d9b4f82b0e703034a Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 10 Jan 2019 14:34:24 +0100 Subject: [PATCH 210/308] Remove DU's UE RRC, MAC, RLC contexts correctly on UE RELEASE COMMAND --- openair2/F1AP/f1ap_du_ue_context_management.c | 9 +++------ openair2/RRC/LTE/rrc_eNB.c | 4 +++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 15b8004991..e043572e4f 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -681,10 +681,10 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, false); if (ie) { - /*pstruct rrc_eNB_ue_context_s* ue_context_p; + struct rrc_eNB_ue_context_s* ue_context_p; ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id], ctxt.rnti); - thread_mutex_lock(&rrc_release_freelist); + pthread_mutex_lock(&rrc_release_freelist); for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { if (ue_context_p->ue_context.ue_release_timer_s1 > 0) @@ -700,7 +700,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, break; } } - pthread_mutex_unlock(&rrc_release_freelist);*/ + pthread_mutex_unlock(&rrc_release_freelist); const sdu_size_t sdu_len = ie->value.choice.RRCContainer.size; mem_block_t *pdu_p = NULL; @@ -738,9 +738,6 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, } } - rrc_mac_remove_ue(instance, ctxt.rnti); - rrc_rlc_remove_ue(&ctxt); - f1ap_ue_context_release_cplt_t cplt; cplt.rnti = ctxt.rnti; DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 77ad8dac7c..45d40079b5 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1079,7 +1079,9 @@ void release_UE_in_freeList(module_id_t mod_id) } } } - if (RC.rrc[mod_id]->node_type == ngran_eNB) { + if (RC.rrc[mod_id]->node_type != ngran_eNB_CU + && RC.rrc[mod_id]->node_type != ngran_ng_eNB_CU + && RC.rrc[mod_id]->node_type != ngran_gNB_CU) { rrc_mac_remove_ue(mod_id,rnti); rrc_rlc_remove_ue(&ctxt); } -- GitLab From a26fad9e47fb649ef4b84dc9fb8119d6adf1a1b5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 16 Jan 2019 14:45:06 +0100 Subject: [PATCH 211/308] F1AP: Correct UEContextReleaseReq path, send corresp. S1AP message --- openair2/F1AP/f1ap_cu_ue_context_management.c | 11 +++++++++-- openair2/F1AP/f1ap_decoder.c | 3 +++ openair2/F1AP/f1ap_du_ue_context_management.c | 2 +- openair2/F1AP/f1ap_handlers.c | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 8b15ede8c5..8535934d36 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -40,6 +40,7 @@ #include "openair2/LAYER2/MAC/mac_proto.h" #include "rrc_extern.h" #include "rrc_eNB_UE_context.h" +#include "rrc_eNB_S1AP.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; extern f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; @@ -821,8 +822,14 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, } */ - LOG_I(CU_F1AP, "Received UE_CONTEXT_RELEASE_REQUEST for RNTI %x, signalling to RRC\n", rnti); - rrc_mac_signal_ue_release(instance, rnti); + LOG_I(CU_F1AP, "Received UE CONTEXT RELEASE REQUEST: Trigger RRC for RNTI %x\n", rnti); + struct rrc_eNB_ue_context_s *ue_context_pP; + ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ( + instance, + ue_context_pP, + S1AP_CAUSE_RADIO_NETWORK, + 21); // send cause 21: connection with ue lost return 0; } diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index e31565243e..b26c943292 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -66,6 +66,9 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) case F1AP_ProcedureCode_id_UEContextRelease: LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__); break; + case F1AP_ProcedureCode_id_UEContextReleaseRequest: + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextReleaseRequest\n", __func__); + break; // case F1AP_ProcedureCode_id_InitialContextSetup: // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); // message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index e043572e4f..bde5e5809c 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -574,7 +574,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; + pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextReleaseRequest; pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest; out = &pdu.choice.initiatingMessage->value.choice.UEContextReleaseRequest; diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 2068c743a8..a5b6a09963 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -56,7 +56,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* UEContextModification */ { 0, 0, 0 }, /* UEContextModificationRequired */ { 0, 0, 0 }, /* UEMobilityCommand */ - { 0, 0, 0 }, /* UEContextReleaseRequest */ + { CU_handle_UE_CONTEXT_RELEASE_REQUEST, 0, 0 }, /* UEContextReleaseRequest */ { CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* InitialULRRCMessageTransfer */ { DU_handle_DL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* DLRRCMessageTransfer */ { CU_handle_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* ULRRCMessageTransfer */ -- GitLab From 0699e539fe840dcbfdb126ab197b2f5241ebf5ba Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 17 Jan 2019 18:21:47 +0100 Subject: [PATCH 212/308] Put RRC S1AP UEContextReleaseReq message inside corresponding if --- openair2/RRC/LTE/rrc_eNB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 45d40079b5..7333333c6b 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -941,10 +941,10 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* if((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP,rnti) >= RRC_CONNECTED)) { - LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); if (RC.rrc[enb_mod_idP]->node_type == ngran_eNB || RC.rrc[enb_mod_idP]->node_type == ngran_eNB_CU || RC.rrc[enb_mod_idP]->node_type == ngran_gNB_CU) { + LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ( enb_mod_idP, ue_context_pP, -- GitLab From 7df8257526fb9dab0def4c3dec444beb7d2e5de7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 17 Jan 2019 18:24:54 +0100 Subject: [PATCH 213/308] F1AP: when UL_sync failure, send UEContextRelReq When a phone loses connection, it should not simply be removed but first CU should be informed which will send a ContextRelCmd. Correspondingly, when the RRC releases the UE, it does not send a UE Context Release Req --- openair2/LAYER2/MAC/eNB_scheduler.c | 28 ++++++++++++++++------------ openair2/RRC/LTE/L2_interface.c | 11 ----------- openair2/RRC/LTE/rrc_eNB.c | 8 -------- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 17f1a53d50..8989d43f1b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -407,20 +407,24 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id, // check threshold if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 4000) { // note: probably ul_failure_timer should be less than UE radio link failure time(see T310/N310/N311) - // inform RRC of failure and clear timer - LOG_I(MAC, - "UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n", - UE_id, rnti); - mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti); + if (RC.rrc[module_idP]->node_type == ngran_eNB_DU + || RC.rrc[module_idP]->node_type == ngran_gNB_DU) { + MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); + F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rnti; + F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; + F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure + F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container = NULL; + F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container_length = 0; + itti_send_msg_to_task(TASK_DU_F1, module_idP, m); + } else { + // inform RRC of failure and clear timer + LOG_I(MAC, + "UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n", + UE_id, rnti); + mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti); + } UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0; UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1; - - //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future - if (flexran_agent_get_rrc_xface(module_idP)) { - LOG_W(MAC, "notify flexran Agent of UE state change\n"); - flexran_agent_get_rrc_xface(module_idP)->flexran_agent_notify_ue_state_change(module_idP, - rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } } } // ul_failure_timer>0 } diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 095cdcf852..f008b0698c 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -391,17 +391,6 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, rntiP, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } - if (RC.rrc[Mod_instP]->node_type == ngran_eNB_DU - && RC.rrc[Mod_instP]->node_type == ngran_gNB_DU) { - MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); - F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rntiP; - F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; - F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure - F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container = NULL; - F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container_length = 0; - itti_send_msg_to_task(TASK_DU_F1, Mod_instP, m); - } - rrc_mac_remove_ue(Mod_instP,rntiP); } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 7333333c6b..af091c312b 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -950,14 +950,6 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost - } else { // DU - MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); - F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = ue_context_pP->ue_context.rnti; - F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; - F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure - F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container = NULL; - F1AP_UE_CONTEXT_RELEASE_REQ(m).rrc_container_length = 0; - itti_send_msg_to_task(TASK_DU_F1, enb_mod_idP, m); } /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before -- GitLab From ca2f91072a122ef81727e8e761629e102734e4f9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 17 Jan 2019 18:26:42 +0100 Subject: [PATCH 214/308] F1AP: on UEContextRelCmd, DU distinguishes whether UE is out of sync --- openair2/F1AP/f1ap_du_ue_context_management.c | 65 ++++++++++++------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index bde5e5809c..b118ac904f 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -675,33 +675,22 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", rnti, ctxt.rnti); + int UE_out_of_sync = 0; + for (int n = 0; n < MAX_MOBILES_PER_ENB; ++n) { + if (RC.mac[instance]->UE_list.active[n] == TRUE + && rnti == UE_RNTI(instance, n)) { + UE_out_of_sync = RC.mac[instance]->UE_list.UE_sched_ctrl[n].ul_out_of_sync; + break; + } + } + /* We don't need the Cause */ /* Optional RRC Container: if present, send to UE */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, false); - if (ie) { - struct rrc_eNB_ue_context_s* ue_context_p; - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id], ctxt.rnti); - - pthread_mutex_lock(&rrc_release_freelist); - for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { - if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { - if (ue_context_p->ue_context.ue_release_timer_s1 > 0) - rrc_release_info.RRC_release_ctrl[release_num].flag = 1; - else - rrc_release_info.RRC_release_ctrl[release_num].flag = 2; - rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; - // TODO: how to provide the correct MUI? - rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; - rrc_release_info.num_UEs++; - LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, - ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); - break; - } - } - pthread_mutex_unlock(&rrc_release_freelist); - + if (ie && !UE_out_of_sync) { + /* RRC message and UE is reachable, send message */ const sdu_size_t sdu_len = ie->value.choice.RRCContainer.size; mem_block_t *pdu_p = NULL; pdu_p = get_free_mem_block(sdu_len, __func__); @@ -737,7 +726,39 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, break; } } + + struct rrc_eNB_ue_context_s* ue_context_p; + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id], ctxt.rnti); + if (ue_context_p && !UE_out_of_sync) { + /* UE exists and is in sync so we start a timer before releasing the + * connection */ + pthread_mutex_lock(&rrc_release_freelist); + for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { + if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { + if (ue_context_p->ue_context.ue_release_timer_s1 > 0) + rrc_release_info.RRC_release_ctrl[release_num].flag = 1; + else + rrc_release_info.RRC_release_ctrl[release_num].flag = 2; + rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; + LOG_W(DU_F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); + // TODO: how to provide the correct MUI? + rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; + rrc_release_info.num_UEs++; + LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, + ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); + break; + } + } + pthread_mutex_unlock(&rrc_release_freelist); + ue_context_p->ue_context.ue_release_timer_s1 = 0; + } else if (ue_context_p && UE_out_of_sync) { + /* UE exists and is out of sync, drop the connection */ + mac_eNB_rrc_ul_failure(instance, 0, 0, 0, rnti); + } else { + LOG_E(DU_F1AP, "no ue_context for RNTI %x, acknowledging release\n", rnti); + } + /* TODO send this once the connection has really been released */ f1ap_ue_context_release_cplt_t cplt; cplt.rnti = ctxt.rnti; DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); -- GitLab From ad9778be76452716bf0bb2956a7a0fac5feb85d7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 19 Jan 2019 16:13:38 +0100 Subject: [PATCH 215/308] FlexRAN fix: correct array index var in loop --- openair2/ENB_APP/flexran_agent_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index a1f6aea97d..84ccb54068 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -263,7 +263,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr rnti_t rntis[report_config.nr_ue]; flexran_get_rrc_rnti_list(mod_id, rntis, report_config.nr_ue); for (i = 0; i < report_config.nr_ue; i++) { - report_config.ue_report_type[i].ue_rnti = rntis[mod_id]; + report_config.ue_report_type[i].ue_rnti = rntis[i]; report_config.ue_report_type[i].ue_report_flags = ue_flags; } } -- GitLab From 6f9f2d89924dd8f9979ebce2c61e5b8c019e881a Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 19 Jan 2019 16:59:33 +0100 Subject: [PATCH 216/308] Correct PDCP stats defining constant to MAX_eNB from CC --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 56 ++++++++++++++--------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 6923e09114..be74d8b837 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -2193,7 +2193,7 @@ void pdcp_layer_init(void) memset(Pdcp_stats_tx_window_ms, 0, sizeof(Pdcp_stats_tx_window_ms)); memset(Pdcp_stats_rx_window_ms, 0, sizeof(Pdcp_stats_rx_window_ms)); - for (i =0; i< MAX_NUM_CCs ; i ++){ + for (i =0; i< MAX_eNB ; i ++){ for (j=0; j< MAX_MOBILES_PER_ENB;j++){ Pdcp_stats_tx_window_ms[i][j]=100; Pdcp_stats_rx_window_ms[i][j]=100; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 054bb5fac4..63cbf11944 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -66,34 +66,34 @@ extern int pdcp_instance_cnt; int init_pdcp_thread(void); void cleanup_pdcp_thread(void); -uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; - -uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_rx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + +uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; void pdcp_update_perioidical_stats(const protocol_ctxt_t* const ctxt_pP); -- GitLab From 767eaf5ba2cb9156d8c056b31ee5c66f1f96ee58 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 19 Jan 2019 17:00:11 +0100 Subject: [PATCH 217/308] Initialize PDCP stats when UE is added --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index be74d8b837..d92d339d59 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -1186,6 +1186,41 @@ pdcp_run ( VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT); } +void pdcp_init_stats_UE(module_id_t mod, uint16_t uid) +{ + Pdcp_stats_tx_window_ms[mod][uid] = 100; + Pdcp_stats_rx_window_ms[mod][uid] = 100; + + for (int i = 0; i < NB_RB_MAX; ++i) { + Pdcp_stats_tx_bytes[mod][uid][i] = 0; + Pdcp_stats_tx_bytes_w[mod][uid][i] = 0; + Pdcp_stats_tx_bytes_tmp_w[mod][uid][i] = 0; + Pdcp_stats_tx[mod][uid][i] = 0; + Pdcp_stats_tx_w[mod][uid][i] = 0; + Pdcp_stats_tx_tmp_w[mod][uid][i] = 0; + Pdcp_stats_tx_sn[mod][uid][i] = 0; + Pdcp_stats_tx_throughput_w[mod][uid][i] = 0; + Pdcp_stats_tx_aiat[mod][uid][i] = 0; + Pdcp_stats_tx_aiat_w[mod][uid][i] = 0; + Pdcp_stats_tx_aiat_tmp_w[mod][uid][i] = 0; + Pdcp_stats_tx_iat[mod][uid][i] = 0; + + Pdcp_stats_rx[mod][uid][i] = 0; + Pdcp_stats_rx_w[mod][uid][i] = 0; + Pdcp_stats_rx_tmp_w[mod][uid][i] = 0; + Pdcp_stats_rx_bytes[mod][uid][i] = 0; + Pdcp_stats_rx_bytes_w[mod][uid][i] = 0; + Pdcp_stats_rx_bytes_tmp_w[mod][uid][i] = 0; + Pdcp_stats_rx_sn[mod][uid][i] = 0; + Pdcp_stats_rx_goodput_w[mod][uid][i] = 0; + Pdcp_stats_rx_aiat[mod][uid][i] = 0; + Pdcp_stats_rx_aiat_w[mod][uid][i] = 0; + Pdcp_stats_rx_aiat_tmp_w[mod][uid][i] = 0; + Pdcp_stats_rx_iat[mod][uid][i] = 0; + Pdcp_stats_rx_outoforder[mod][uid][i] = 0; + } +} + void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP){ int i, ue_flag=1; //, ret=-1; to be decied later for (i=0; i < MAX_MOBILES_PER_ENB; i++){ @@ -1201,6 +1236,7 @@ void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP){ pdcp_enb[ctxt_pP->module_id].uid[i]=i; pdcp_enb[ctxt_pP->module_id].num_ues++; LOG_I(PDCP,"add new uid is %d %x\n\n", i, ctxt_pP->rnti); + pdcp_init_stats_UE(ctxt_pP->module_id, i); // ret=1; break; } -- GitLab From 03b52216a06d93aec8cffe9f713776ee2c37a90a Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 19 Jan 2019 18:22:11 +0100 Subject: [PATCH 218/308] FlexRAN: Access PDCP stats through RNTI --- .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.c | 40 +++--- .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.h | 2 +- openair2/ENB_APP/flexran_agent_ran_api.c | 132 ++++++++++-------- openair2/ENB_APP/flexran_agent_ran_api.h | 36 ++--- 4 files changed, 116 insertions(+), 94 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c index f35277ce4d..293ebab7a8 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c @@ -34,30 +34,30 @@ AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB]; // MAX_MOBILES_PER_ENB void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id, - const mid_t ue_id, + uint16_t uid, Protocol__FlexPdcpStats *pdcp_aggr_stats){ int lcid=0; /* only calculate the DRBs */ - //LOG_I(FLEXRAN_AGENT, "enb %d ue %d \n", mod_id, ue_id); + //LOG_I(FLEXRAN_AGENT, "enb %d ue %d \n", mod_id, uid); for (lcid=NUM_MAX_SRB ; lcid < NUM_MAX_SRB + NUM_MAX_DRB; lcid++){ - pdcp_aggr_stats->pkt_tx += flexran_get_pdcp_tx(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_tx_bytes += flexran_get_pdcp_tx_bytes(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_tx_w += flexran_get_pdcp_tx_w(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_tx_bytes_w += flexran_get_pdcp_tx_bytes_w(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_tx_aiat += flexran_get_pdcp_tx_aiat(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_tx_aiat_w += flexran_get_pdcp_tx_aiat_w(mod_id,ue_id,lcid); + pdcp_aggr_stats->pkt_tx += flexran_get_pdcp_tx(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_tx_bytes += flexran_get_pdcp_tx_bytes(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_tx_w += flexran_get_pdcp_tx_w(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_tx_bytes_w += flexran_get_pdcp_tx_bytes_w(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_tx_aiat += flexran_get_pdcp_tx_aiat(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_tx_aiat_w += flexran_get_pdcp_tx_aiat_w(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_rx += flexran_get_pdcp_rx(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_rx_bytes += flexran_get_pdcp_rx_bytes(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_rx_w += flexran_get_pdcp_rx_w(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_rx_bytes_w += flexran_get_pdcp_rx_bytes_w(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_rx_aiat += flexran_get_pdcp_rx_aiat(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_rx_aiat_w += flexran_get_pdcp_rx_aiat_w(mod_id,ue_id,lcid); - pdcp_aggr_stats->pkt_rx_oo += flexran_get_pdcp_rx_oo(mod_id,ue_id,lcid); + pdcp_aggr_stats->pkt_rx += flexran_get_pdcp_rx(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_rx_bytes += flexran_get_pdcp_rx_bytes(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_rx_w += flexran_get_pdcp_rx_w(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_rx_bytes_w += flexran_get_pdcp_rx_bytes_w(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_rx_aiat += flexran_get_pdcp_rx_aiat(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_rx_aiat_w += flexran_get_pdcp_rx_aiat_w(mod_id, uid, lcid); + pdcp_aggr_stats->pkt_rx_oo += flexran_get_pdcp_rx_oo(mod_id, uid, lcid); } @@ -72,7 +72,6 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, // Protocol__FlexHeader *header; int i; - int UE_id; // int cc_id = 0; @@ -80,7 +79,8 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, if (report_config->nr_ue > 0) { for (i = 0; i < report_config->nr_ue; i++) { - UE_id = flexran_get_mac_ue_id(mod_id, i); + const rnti_t rnti = report_config->ue_report_type[i].ue_rnti; + const uint16_t uid = flexran_get_pdcp_uid_from_rnti(mod_id, rnti); /* Check flag for creation of buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS) { @@ -91,7 +91,7 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, goto error; protocol__flex_pdcp_stats__init(pdcp_aggr_stats); - flexran_agent_pdcp_aggregate_stats(mod_id, UE_id, pdcp_aggr_stats); + flexran_agent_pdcp_aggregate_stats(mod_id, uid, pdcp_aggr_stats); pdcp_aggr_stats->has_pkt_tx=1; pdcp_aggr_stats->has_pkt_tx_bytes =1; @@ -100,7 +100,7 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, pdcp_aggr_stats->has_pkt_tx_aiat =1; pdcp_aggr_stats->has_pkt_tx_aiat_w =1; - pdcp_aggr_stats->pkt_tx_sn = flexran_get_pdcp_tx_sn(mod_id, UE_id, DEFAULT_DRB); + pdcp_aggr_stats->pkt_tx_sn = flexran_get_pdcp_tx_sn(mod_id, uid, DEFAULT_DRB); pdcp_aggr_stats->has_pkt_tx_sn =1; pdcp_aggr_stats->has_pkt_rx =1; @@ -111,7 +111,7 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, pdcp_aggr_stats->has_pkt_rx_aiat_w =1; pdcp_aggr_stats->has_pkt_rx_oo =1; - pdcp_aggr_stats->pkt_rx_sn = flexran_get_pdcp_rx_sn(mod_id, UE_id, DEFAULT_DRB); + pdcp_aggr_stats->pkt_rx_sn = flexran_get_pdcp_rx_sn(mod_id, uid, DEFAULT_DRB); pdcp_aggr_stats->has_pkt_rx_sn =1; pdcp_aggr_stats->sfn = flexran_get_pdcp_sfn(mod_id); diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h index d1b2ee1a0a..246f9709b5 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h @@ -55,7 +55,7 @@ int flexran_agent_pdcp_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* Get the stats from RAN API and aggregate them per USER*/ void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id, - const mid_t ue_id, + uint16_t uid, Protocol__FlexPdcpStats *pdcp_aggr_stats); /*Register technology specific interface callbacks*/ diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 3625d98793..04381ea795 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -1250,16 +1250,12 @@ void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_fra } /*********** PDCP *************/ -/*PDCP super frame counter flexRAN*/ -/* TODO the following is a hack. all the functions below should instead already - * receive the PDCP's uid and operate on it and the caller has the obligation - * to get the ID for this layer. - */ -static inline uint16_t flexran_get_pdcp_uid(mid_t mod_id, mid_t ue_id) +uint16_t flexran_get_pdcp_uid_from_rnti(mid_t mod_id, rnti_t rnti) { - rnti_t rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); if (rnti == NOT_A_RNTI) return 0; + if (mod_id < 0 || mod_id >= RC.nb_inst) + return 0; for (uint16_t pdcp_uid = 0; pdcp_uid < MAX_MOBILES_PER_ENB; ++pdcp_uid) { if (pdcp_enb[mod_id].rnti[pdcp_uid] == rnti) @@ -1268,140 +1264,164 @@ static inline uint16_t flexran_get_pdcp_uid(mid_t mod_id, mid_t ue_id) return 0; } +/*PDCP super frame counter flexRAN*/ uint32_t flexran_get_pdcp_sfn(mid_t mod_id) { + if (mod_id < 0 || mod_id >= RC.nb_inst) + return 0; return pdcp_enb[mod_id].sfn; } /*PDCP super frame counter flexRAN*/ -void flexran_set_pdcp_tx_stat_window(mid_t mod_id, mid_t ue_id, uint16_t obs_window) +void flexran_set_pdcp_tx_stat_window(mid_t mod_id, uint16_t uid, uint16_t obs_window) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); - if (obs_window > 0 ){ - Pdcp_stats_tx_window_ms[mod_id][uid]=obs_window; - } - else{ - Pdcp_stats_tx_window_ms[mod_id][uid]=1000; - } + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB) + return; + Pdcp_stats_tx_window_ms[mod_id][uid] = obs_window > 0 ? obs_window : 1000; } /*PDCP super frame counter flexRAN*/ -void flexran_set_pdcp_rx_stat_window(mid_t mod_id, mid_t ue_id, uint16_t obs_window) +void flexran_set_pdcp_rx_stat_window(mid_t mod_id, uint16_t uid, uint16_t obs_window) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); - if (obs_window > 0 ){ - Pdcp_stats_rx_window_ms[mod_id][uid]=obs_window; - } - else{ - Pdcp_stats_rx_window_ms[mod_id][uid]=1000; - } + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB) + return; + Pdcp_stats_rx_window_ms[mod_id][uid] = obs_window > 0 ? obs_window : 1000; } /*PDCP num tx pdu status flexRAN*/ -uint32_t flexran_get_pdcp_tx(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_tx(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id > MAX_NUM_CCs || ue_id < 0 || ue_id > MAX_MOBILES_PER_ENB - || lcid < 0 || lcid > NB_RB_MAX) - return -1; - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_tx[mod_id][uid][lcid]; } /*PDCP num tx bytes status flexRAN*/ -uint32_t flexran_get_pdcp_tx_bytes(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_tx_bytes(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_tx_bytes[mod_id][uid][lcid]; } /*PDCP number of transmit packet / second status flexRAN*/ -uint32_t flexran_get_pdcp_tx_w(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_tx_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_tx_w[mod_id][uid][lcid]; } /*PDCP throughput (bit/s) status flexRAN*/ -uint32_t flexran_get_pdcp_tx_bytes_w(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_tx_bytes_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_tx_bytes_w[mod_id][uid][lcid]; } /*PDCP tx sequence number flexRAN*/ -uint32_t flexran_get_pdcp_tx_sn(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_tx_sn(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_tx_sn[mod_id][uid][lcid]; } /*PDCP tx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_tx_aiat(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_tx_aiat(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_tx_aiat[mod_id][uid][lcid]; } /*PDCP tx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_tx_aiat_w(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_tx_aiat_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_tx_aiat_w[mod_id][uid][lcid]; } /*PDCP num rx pdu status flexRAN*/ -uint32_t flexran_get_pdcp_rx(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_rx(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_rx[mod_id][uid][lcid]; } /*PDCP num rx bytes status flexRAN*/ -uint32_t flexran_get_pdcp_rx_bytes(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_rx_bytes(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_rx_bytes[mod_id][uid][lcid]; } /*PDCP number of received packet / second flexRAN*/ -uint32_t flexran_get_pdcp_rx_w(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_rx_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_rx_w[mod_id][uid][lcid]; } /*PDCP gootput (bit/s) status flexRAN*/ -uint32_t flexran_get_pdcp_rx_bytes_w(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_rx_bytes_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_rx_bytes_w[mod_id][uid][lcid]; } /*PDCP rx sequence number flexRAN*/ -uint32_t flexran_get_pdcp_rx_sn(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_rx_sn(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_rx_sn[mod_id][uid][lcid]; } /*PDCP rx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_rx_aiat(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_rx_aiat(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_rx_aiat[mod_id][uid][lcid]; } /*PDCP rx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_rx_aiat_w(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_rx_aiat_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_rx_aiat_w[mod_id][uid][lcid]; } /*PDCP num of received outoforder pdu status flexRAN*/ -uint32_t flexran_get_pdcp_rx_oo(mid_t mod_id, mid_t ue_id, lcid_t lcid) +uint32_t flexran_get_pdcp_rx_oo(mid_t mod_id, uint16_t uid, lcid_t lcid) { - uint16_t uid = flexran_get_pdcp_uid(mod_id, ue_id); + if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 + || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) + return 0; return Pdcp_stats_rx_outoforder[mod_id][uid][lcid]; } diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index 75c2908a24..ba2ab818c9 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -439,61 +439,63 @@ uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti); /***************************** PDCP ***********************/ +/* PDCP uid obtained through the RNTI */ +uint16_t flexran_get_pdcp_uid_from_rnti(mid_t mod_id, rnti_t rnti); /*PDCP superframe numberflexRAN*/ uint32_t flexran_get_pdcp_sfn(mid_t mod_id); /*PDCP pdcp tx stats window*/ -void flexran_set_pdcp_tx_stat_window(mid_t mod_id, mid_t ue_id, uint16_t obs_window); +void flexran_set_pdcp_tx_stat_window(mid_t mod_id, uint16_t uid, uint16_t obs_window); /*PDCP pdcp rx stats window*/ -void flexran_set_pdcp_rx_stat_window(mid_t mod_id, mid_t ue_id, uint16_t obs_window); +void flexran_set_pdcp_rx_stat_window(mid_t mod_id, uint16_t uid, uint16_t obs_window); /*PDCP num tx pdu status flexRAN*/ -uint32_t flexran_get_pdcp_tx(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_tx(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP num tx bytes status flexRAN*/ -uint32_t flexran_get_pdcp_tx_bytes(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_tx_bytes(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP number of transmit packet / second status flexRAN*/ -uint32_t flexran_get_pdcp_tx_w(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_tx_w(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP pdcp tx bytes in a given window flexRAN*/ -uint32_t flexran_get_pdcp_tx_bytes_w(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_tx_bytes_w(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP tx sequence number flexRAN*/ -uint32_t flexran_get_pdcp_tx_sn(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_tx_sn(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP tx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_tx_aiat(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_tx_aiat(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP tx aggregated packet arrival per second flexRAN*/ -uint32_t flexran_get_pdcp_tx_aiat_w(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_tx_aiat_w(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP num rx pdu status flexRAN*/ -uint32_t flexran_get_pdcp_rx(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_rx(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP num rx bytes status flexRAN*/ -uint32_t flexran_get_pdcp_rx_bytes(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_rx_bytes(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP number of received packet / second flexRAN*/ -uint32_t flexran_get_pdcp_rx_w(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_rx_w(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP gootput (bit/s) status flexRAN*/ -uint32_t flexran_get_pdcp_rx_bytes_w(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_rx_bytes_w(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP rx sequence number flexRAN*/ -uint32_t flexran_get_pdcp_rx_sn(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_rx_sn(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP rx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_rx_aiat(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_rx_aiat(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP rx aggregated packet arrival per second flexRAN*/ -uint32_t flexran_get_pdcp_rx_aiat_w(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_rx_aiat_w(mid_t mod_id, uint16_t uid, lcid_t lcid); /*PDCP num of received outoforder pdu status flexRAN*/ -uint32_t flexran_get_pdcp_rx_oo(mid_t mod_id, mid_t ue_id, lcid_t lcid); +uint32_t flexran_get_pdcp_rx_oo(mid_t mod_id, uint16_t uid, lcid_t lcid); /*********************RRC**********************/ /*Get primary cell measuremeant id flexRAN*/ -- GitLab From 2cdcb6466bc205f8818fe79ea9aa5ca028fd3147 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 22 Jan 2019 16:11:37 +0100 Subject: [PATCH 219/308] Move PDCP stats recording out from non-applying packet_forwarded FALSE case --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index d92d339d59..076b5c3c69 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -952,11 +952,17 @@ pdcp_data_ind( //util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset); //util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset); - /* - * Update PDCP statistics - * XXX Following two actions are identical, is there a merge error? - */ +#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) + else { + AssertFatal(0, PROTOCOL_PDCP_CTXT_FMT" PDCP_DATA_IND SDU DROPPED, OUT OF MEMORY \n", + PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p)); + } +#endif + + } + + /* Update PDCP statistics */ for (pdcp_uid=0; pdcp_uid< MAX_MOBILES_PER_ENB;pdcp_uid++){ if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ){ break; @@ -977,16 +983,6 @@ pdcp_data_ind( Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn; - -#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) - else { - AssertFatal(0, PROTOCOL_PDCP_CTXT_FMT" PDCP_DATA_IND SDU DROPPED, OUT OF MEMORY \n", - PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p)); - } -#endif - - } - free_mem_block(sdu_buffer_pP, __func__); if (ctxt_pP->enb_flag) { -- GitLab From d9d6ce374f15d474768db8147336c4541bfa14d5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 25 Jan 2019 16:37:57 +0100 Subject: [PATCH 220/308] Perform S1 UE Context Release Complete after corresponding F1 message This commits isolates the S1 UE Ctxt Rel Complete and GTP Tunnel Delete Requests in functions and calls these function in the original place (rrc_rx_tx()). The same functions are then used in the F1 UE Ctxt Rel Complete handler to perform the same functionality, i.e. forward the UE Ctxt Rel Complete message to the MME and free outstanding resources (RRC context, GTP tunnels, S1 context). --- openair2/F1AP/f1ap_cu_ue_context_management.c | 29 ++++++++++++--- openair2/RRC/LTE/rrc_eNB.c | 36 ++++++------------- openair2/RRC/LTE/rrc_eNB_GTPV1U.c | 28 +++++++++++++++ openair2/RRC/LTE/rrc_eNB_GTPV1U.h | 10 ++++++ openair2/RRC/LTE/rrc_eNB_S1AP.c | 17 +++++++++ openair2/RRC/LTE/rrc_eNB_S1AP.h | 10 ++++++ 6 files changed, 101 insertions(+), 29 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 8535934d36..660683a4c5 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -41,6 +41,7 @@ #include "rrc_extern.h" #include "rrc_eNB_UE_context.h" #include "rrc_eNB_S1AP.h" +#include "rrc_eNB_GTPV1U.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; extern f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; @@ -962,6 +963,28 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, // F1AP_CriticalityDiagnostics_IE_List } + struct rrc_eNB_ue_context_s *ue_context_p = + rrc_eNB_get_ue_context(RC.rrc[instance], rnti); + + /* The following is normally done in the function rrc_rx_tx() */ + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(instance, + ue_context_p->ue_context.eNB_ue_s1ap_id); + + rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(instance, ue_context_p); + // erase data of GTP tunnels in UE context + for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], + 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; + } + + struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = + rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, + ue_context_p->ue_context.eNB_ue_s1ap_id); + if (rrc_ue_s1ap_ids) + rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); + /* The following is normally done in the function release_UE_in_freeList() */ /* remove PDCP entry */ protocol_ctxt_t ctxt; @@ -969,10 +992,8 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, pdcp_remove_UE(&ctxt); /* trigger UE release in RRC */ - struct rrc_eNB_ue_context_s *ue_context_pP; - ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); - if (ue_context_pP) - rrc_eNB_remove_ue_context(&ctxt, RC.rrc[instance], ue_context_pP); + if (ue_context_p) + rrc_eNB_remove_ue_context(&ctxt, RC.rrc[instance], ue_context_p); /* notify the agent */ if (flexran_agent_get_rrc_xface(instance)) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index af091c312b..5afa0c1134 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -8226,40 +8226,26 @@ rrc_rx_tx( #if defined(ENABLE_USE_MME) #if defined(ENABLE_ITTI) if (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) { - int e_rab; - MessageDef *msg_complete_p = NULL; - MessageDef *msg_delete_tunnels_p = NULL; - uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id; if(rrc_release_info.RRC_release_ctrl[release_num].flag == 4){ - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); - msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); - S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_complete_p); + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(ctxt_pP->module_id, + ue_context_p->ue_context.eNB_ue_s1ap_id); } - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id); - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - // do not wait response - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = - ue_context_p->ue_context.enb_gtp_ebi[e_rab]; - // erase data + + rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(ctxt_pP->module_id, + ue_context_p); + // erase data of GTP tunnels in UE context + for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], + 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); + struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids( RC.rrc[ctxt_pP->module_id], 0, - eNB_ue_s1ap_id); + ue_context_p->ue_context.eNB_ue_s1ap_id); if (NULL != rrc_ue_s1ap_ids) { rrc_eNB_S1AP_remove_ue_ids( RC.rrc[ctxt_pP->module_id], diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index 135c6fea8d..2587ac9436 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -98,4 +98,32 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( return -1; } } + +void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( + module_id_t enb_mod_idP, + const rrc_eNB_ue_context_t* const ue_context_pP +) +{ + if (!ue_context_pP) { + LOG_W(RRC, "[eNB] In %s: invalid UE\n", __func__); + return; + } + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_GTPU_ENB, + NULL, + 0, + "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", ue_context_pP->ue_context.rnti); + + MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg))); + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).rnti = ue_context_pP->ue_context.rnti; + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).num_erab = ue_context_pP->ue_context.nb_of_e_rabs; + for (int e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) { + const rb_id_t gtp_ebi = ue_context_pP->ue_context.enb_gtp_ebi[e_rab]; + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).eps_bearer_id[e_rab] = gtp_ebi; + } + itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg); +} #endif diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.h b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h index aedbdeac5e..2c97801359 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.h +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h @@ -47,6 +47,16 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( uint8_t *inde_list ); +/*! \fn rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(module_id_t enb_mod_idP, const rrc_eNB_ue_context_t* const ue_context_pP) + *\brief Send GTPV1U_ENB_DELETE_TUNNEL_REQ message to GTPV1U to destroy all UE-related tunnels. + *\param module_id Instance ID of eNB. + *\param ue_context_pP UE context in the eNB. + */ +void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( + module_id_t enb_mod_idP, + const rrc_eNB_ue_context_t* const ue_context_pP +); + # endif # endif /* defined(ENABLE_USE_MME) */ #endif /* RRC_ENB_GTPV1U_H_ */ diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index db6b10c877..bd4db2ca14 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1229,6 +1229,23 @@ void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ ( } } +void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT( + module_id_t enb_mod_idP, + uint32_t eNB_ue_s1ap_id +) +{ + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_S1AP_ENB, + NULL,0, + "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", + eNB_ue_s1ap_id); + + MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); + S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg).eNB_ue_s1ap_id = eNB_ue_s1ap_id; + itti_send_msg_to_task(TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg); +} + /*------------------------------------------------------------------------------*/ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const char *msg_name, instance_t instance) diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.h b/openair2/RRC/LTE/rrc_eNB_S1AP.h index a924caf254..f16fa30408 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.h +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.h @@ -151,6 +151,16 @@ void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ ( const long cause_valueP ); +/*! \fn rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(const module_id_t enb_mod_idP, const struct rrc_eNB_ue_context_s *const ue_context_pP) + *\brief create a S1AP_UE_CONTEXT_RELEASE_COMPLETE message, the message is sent by the eNB to S1AP task to acknowledge/complete the release of the UE-associated S1-logical connection over the S1 interface. . + *\param enb_mod_idP Instance ID of eNB. + *\param eNB_ue_s1ap_id UE's S1AP ID in the eNB. + */ +void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT( + module_id_t enb_mod_idP, + uint32_t eNB_ue_s1ap_id +); + /* Down link procedures */ /*! \fn rrc_eNB_process_S1AP_DOWNLINK_NAS(MessageDef *msg_p, const char *msg_name, instance_t instance, mui_t *rrc_eNB_mui) -- GitLab From 8c0ebfaddaa98a9d3e0694af670e6dc8b993a911 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 27 Jan 2019 20:02:23 +0100 Subject: [PATCH 221/308] Add FlexRAN PLMN ID list and remove defunct cell_id --- .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 20 ++++++++++++++-- .../ENB_APP/MESSAGES/V2/config_common.proto | 6 +++++ .../ENB_APP/MESSAGES/V2/config_messages.proto | 2 +- .../ENB_APP/flexran_agent_common_internal.c | 2 +- openair2/ENB_APP/flexran_agent_ran_api.c | 24 +++++++++++++++++++ openair2/ENB_APP/flexran_agent_ran_api.h | 12 ++++++++++ 6 files changed, 62 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index 0633e5bdc0..4717bcbc1e 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -647,8 +647,6 @@ int flexran_agent_register_rrc_xface(mid_t mod_id) void flexran_agent_fill_rrc_cell_config(mid_t mod_id, uint8_t cc_id, Protocol__FlexCellConfig *conf) { - conf->cell_id = cc_id; - conf->has_cell_id = 1; if (!conf->si_config) { conf->si_config = malloc(sizeof(Protocol__FlexSiConfig)); @@ -696,6 +694,24 @@ void flexran_agent_fill_rrc_cell_config(mid_t mod_id, uint8_t cc_id, conf->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (mod_id, cc_id); conf->has_ul_pusch_power = 1; + + conf->n_plmn_id = flexran_get_rrc_num_plmn_ids(mod_id); + conf->plmn_id = calloc(conf->n_plmn_id, sizeof(Protocol__FlexPlmn *)); + if (conf->plmn_id) { + for (int i = 0; i < conf->n_plmn_id; i++) { + conf->plmn_id[i] = malloc(sizeof(Protocol__FlexPlmn)); + if (!conf->plmn_id[i]) continue; + protocol__flex_plmn__init(conf->plmn_id[i]); + conf->plmn_id[i]->mcc = flexran_get_rrc_mcc(mod_id, i); + conf->plmn_id[i]->has_mcc = 1; + conf->plmn_id[i]->mnc = flexran_get_rrc_mnc(mod_id, i); + conf->plmn_id[i]->has_mnc = 1; + conf->plmn_id[i]->mnc_length = flexran_get_rrc_mnc_digit_length(mod_id, i); + conf->plmn_id[i]->has_mnc_length = 1; + } + } else { + conf->n_plmn_id = 0; + } } int flexran_agent_unregister_rrc_xface(mid_t mod_id) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index 7bdc7b033b..695d7bcdb1 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -262,3 +262,9 @@ enum flex_ue_state_change_type { FLUESC_DEACTIVATED = 2; FLUESC_MOVED = 3; } + +message flex_plmn { + optional uint32 mcc = 1; + optional uint32 mnc = 2; + optional uint32 mnc_length = 3; +} diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto index 1d5da8dd2a..dd983aa09c 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto @@ -5,7 +5,6 @@ import "config_common.proto"; message flex_cell_config { optional uint32 phy_cell_id = 1; // The PCI of this cell - optional uint32 cell_id = 2; // The PLMN cell id of this cell optional uint32 pusch_hopping_offset = 3; // PUSCH resources in RBs for hopping optional uint32 hopping_mode = 4; // One of the FLHM_* enum values optional uint32 n_sb = 5; // The number of subbands @@ -43,6 +42,7 @@ message flex_cell_config { optional uint32 eutra_band= 37; // operating band optional int32 dl_pdsch_power = 38; // operating downlink power optional int32 ul_pusch_power = 39; // operating uplink power + repeated flex_plmn plmn_id = 40; // The PLMN cell id of this cell optional flex_slice_config slice_config = 42; } diff --git a/openair2/ENB_APP/flexran_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c index a1ff3fd23a..9091753f9a 100644 --- a/openair2/ENB_APP/flexran_agent_common_internal.c +++ b/openair2/ENB_APP/flexran_agent_common_internal.c @@ -542,7 +542,7 @@ int apply_parameter_modification(void *parameter, yaml_parser_t *parser) { void initiate_soft_restart(module_id_t mod_id, Protocol__FlexCellConfig *c) { - uint8_t cc_id = c->has_cell_id ? c->cell_id : 0; + const uint8_t cc_id = 0; if (c->has_eutra_band) { flexran_agent_set_operating_eutra_band(mod_id, cc_id, c->eutra_band); LOG_I(ENB_APP, "Setting eutra_band to %d\n", c->eutra_band); diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 04381ea795..fbf43cc25a 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -1503,6 +1503,30 @@ float flexran_get_rrc_neigh_rsrq(mid_t mod_id, rnti_t rnti, long cell_id) return RSRQ_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult)]; } +uint8_t flexran_get_rrc_num_plmn_ids(mid_t mod_id) +{ + if (!rrc_is_present(mod_id)) return 0; + return RC.rrc[mod_id]->configuration.num_plmn; +} + +uint16_t flexran_get_rrc_mcc(mid_t mod_id, uint8_t index) +{ + if (!rrc_is_present(mod_id)) return 0; + return RC.rrc[mod_id]->configuration.mcc[index]; +} + +uint16_t flexran_get_rrc_mnc(mid_t mod_id, uint8_t index) +{ + if (!rrc_is_present(mod_id)) return 0; + return RC.rrc[mod_id]->configuration.mnc[index]; +} + +uint8_t flexran_get_rrc_mnc_digit_length(mid_t mod_id, uint8_t index) +{ + if (!rrc_is_present(mod_id)) return 0; + return RC.rrc[mod_id]->configuration.mnc_digit_length[index]; +} + /**************************** SLICING ****************************/ int flexran_get_ue_dl_slice_id(mid_t mod_id, mid_t ue_id) { diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index ba2ab818c9..8419435179 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -527,6 +527,18 @@ int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, rnti_t rnti, int cell_id); */ /* currently not implemented int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, mid_t ue_id, int cell_id); */ +/* Get number of PLMNs that is broadcasted in SIB1 */ +uint8_t flexran_get_rrc_num_plmn_ids(mid_t mod_id); + +/* Get index'th MCC broadcasted in SIB1 */ +uint16_t flexran_get_rrc_mcc(mid_t mod_id, uint8_t index); + +/* Get index'th MNC broadcasted in SIB1 */ +uint16_t flexran_get_rrc_mnc(mid_t mod_id, uint8_t index); + +/* Get index'th MNC's digit length broadcasted in SIB1 */ +uint8_t flexran_get_rrc_mnc_digit_length(mid_t mod_id, uint8_t index); + /************************** Slice configuration **************************/ /* Get the DL slice ID for a UE */ -- GitLab From 63c4a90eb76a030e5af2209b26f7e95b3bb7b531 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 25 Jan 2019 19:04:15 +0100 Subject: [PATCH 222/308] Remove unused PROTO_AGENT code --- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.c | 40 ------------------- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.h | 4 -- 2 files changed, 44 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index 99b1a0b79b..5788bd0830 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -41,46 +41,6 @@ proto_agent_channel_t *proto_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; proto_agent_channel_instance_t channel_instance; int proto_agent_channel_id = 0; -int proto_agent_msg_send(mod_id_t mod_id, proto_agent_id_t agent_id, void *data, int size, int priority) { - /*Check if agent id is valid*/ - if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { - goto error; - } - proto_agent_channel_t *channel; - channel = proto_channel[mod_id][agent_id]; - - /*Check if agent has a channel registered*/ - if (channel == NULL) { - goto error; - } - - return channel->msg_send(data, size, priority, channel->channel_info); - - error: - LOG_E(PROTO_AGENT, "No channel registered for agent with id %d\n", agent_id); - return -1; -} - -int proto_agent_msg_recv(mod_id_t mod_id, proto_agent_id_t agent_id, void **data, int *size, int *priority) { - /*Check if agent id is valid*/ - if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { - goto error; - } - proto_agent_channel_t *channel; - channel = proto_channel[mod_id][agent_id]; - - /*Check if agent has a channel registered*/ - if (channel == NULL) { - goto error; - } - - return channel->msg_recv(data, size, priority, channel->channel_info); - - error: - LOG_E(PROTO_AGENT, "No channel registered for agent with id %d\n", agent_id); - return -1; -} - int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) { int i; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h index 6647de6e1b..c88ba35b13 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h @@ -59,10 +59,6 @@ typedef struct proto_agent_channel_instance_s{ RB_HEAD(proto_agent_channel_map, proto_agent_channel_s) proto_agent_head; } proto_agent_channel_instance_t; -/*Send and receive messages using the channel registered for a specific agent*/ -int proto_agent_msg_send(mod_id_t mod_id, proto_agent_id_t agent_id, void *data, int size, int priority); - -int proto_agent_msg_recv(mod_id_t mod_id, proto_agent_id_t agent_id, void **data, int *size, int *priority); /*Register a channel to an agent. Use ENB_AGENT_MAX to register the *same channel to all agents*/ -- GitLab From 0643d6b56118340cf007f3b7a2c2ca835ccdba1c Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 25 Jan 2019 19:08:22 +0100 Subject: [PATCH 223/308] Make queue_recv() functions return size, not as out-param --- openair2/ENB_APP/flexran_agent.c | 2 +- openair2/ENB_APP/flexran_agent_async.c | 4 ++-- openair2/ENB_APP/flexran_agent_async.h | 2 +- openair2/ENB_APP/flexran_agent_net_comm.c | 6 +++--- openair2/ENB_APP/flexran_agent_net_comm.h | 6 +++--- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 2 +- openair2/LAYER2/PROTO_AGENT/proto_agent_async.c | 4 ++-- openair2/LAYER2/PROTO_AGENT/proto_agent_async.h | 2 +- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.c | 2 +- .../LAYER2/PROTO_AGENT/proto_agent_net_comm.h | 4 ++-- openair2/UTIL/ASYNC_IF/link_manager.c | 6 +++--- openair2/UTIL/ASYNC_IF/message_queue.c | 15 ++++++++------- openair2/UTIL/ASYNC_IF/message_queue.h | 2 +- openair2/UTIL/ASYNC_IF/ringbuffer_queue.c | 10 ++++++---- openair2/UTIL/ASYNC_IF/ringbuffer_queue.h | 2 +- 15 files changed, 36 insertions(+), 33 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index ff91d711d9..24ed07ac92 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -115,7 +115,7 @@ void *receive_thread(void *args) { while (1) { - while (flexran_agent_msg_recv(d->mod_id, FLEXRAN_AGENT_DEFAULT, &data, &size, &priority) == 0) { + while ((size = flexran_agent_msg_recv(d->mod_id, FLEXRAN_AGENT_DEFAULT, &data, &priority)) > 0) { LOG_D(FLEXRAN_AGENT,"received message with size %d\n", size); diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c index 34d2f5b1e8..fa2e0c9ff5 100644 --- a/openair2/ENB_APP/flexran_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -94,11 +94,11 @@ int flexran_agent_async_msg_send(void *data, int size, int priority, void *chann return message_put(channel->send_queue, data, size, priority); } -int flexran_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { +int flexran_agent_async_msg_recv(void **data, int *priority, void *channel_info) { flexran_agent_async_channel_t *channel; channel = (flexran_agent_async_channel_t *)channel_info; - return message_get(channel->receive_queue, data, size, priority); + return message_get(channel->receive_queue, data, priority); } void flexran_agent_async_release(flexran_agent_channel_t *channel) { diff --git a/openair2/ENB_APP/flexran_agent_async.h b/openair2/ENB_APP/flexran_agent_async.h index 03aebd0058..1ebc565f62 100644 --- a/openair2/ENB_APP/flexran_agent_async.h +++ b/openair2/ENB_APP/flexran_agent_async.h @@ -46,7 +46,7 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info); /* Receive a message from a given channel */ -int flexran_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); +int flexran_agent_async_msg_recv(void **data, int *priority, void *channel_info); /* Release a channel */ void flexran_agent_async_release(flexran_agent_channel_t *channel); diff --git a/openair2/ENB_APP/flexran_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c index d5142e5456..0d1c52096d 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.c +++ b/openair2/ENB_APP/flexran_agent_net_comm.c @@ -53,7 +53,7 @@ int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int si return -1; } -int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) { +int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *priority) { /*Check if agent id is valid*/ if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) { goto error; @@ -66,7 +66,7 @@ int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int * goto error; } - return channel->msg_recv(data, size, priority, channel->channel_info); + return channel->msg_recv(data, priority, channel->channel_info); error: LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id); @@ -104,7 +104,7 @@ void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { int flexran_agent_create_channel(void *channel_info, int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + int (*msg_recv)(void **data, int *priority, void *channel_info), void (*release)(flexran_agent_channel_t *channel)) { int channel_id = ++flexran_agent_channel_id; diff --git a/openair2/ENB_APP/flexran_agent_net_comm.h b/openair2/ENB_APP/flexran_agent_net_comm.h index 2f59b0f7a3..4d012989fd 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.h +++ b/openair2/ENB_APP/flexran_agent_net_comm.h @@ -39,7 +39,7 @@ int channel_id; void *channel_info; /*Callbacks for channel message Tx and Rx*/ int (*msg_send)(void *data, int size, int priority, void *channel_info); -int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); +int (*msg_recv)(void **data, int *priority, void *channel_info); void (*release)(struct flexran_agent_channel_s *channel); } flexran_agent_channel_t; @@ -49,7 +49,7 @@ typedef struct flexran_agent_channel_instance_s{ /*Send and receive messages using the channel registered for a specific agent*/ int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); -int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority); +int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *priority); /*Register a channel to an agent. Use FLEXRAN_AGENT_MAX to register the *same channel to all agents*/ @@ -61,7 +61,7 @@ void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id); /*Create a new channel. Returns the id of the new channel or negative number otherwise*/ int flexran_agent_create_channel(void *channel_info, int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + int (*msg_recv)(void **data, int *priority, void *channel_info), void (*release)(flexran_agent_channel_t *channel)); /*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 00441aeed5..148392280b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -266,7 +266,7 @@ proto_agent_receive(void *args) msg = NULL; ser_msg = NULL; - if (proto_agent_async_msg_recv(&data, &size, &priority, inst->channel->channel_info)){ + if ((size = proto_agent_async_msg_recv(&data, &priority, inst->channel->channel_info)) <= 0){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 94532b1942..476ecac90d 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -78,10 +78,10 @@ int proto_agent_async_msg_send(void *data, int size, int priority, void *channel return message_put(channel->send_queue, data, size, priority); } -int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) +int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info) { proto_agent_async_channel_t *channel = channel_info; - return message_get(channel->receive_queue, data, size, priority); + return message_get(channel->receive_queue, data, priority); } void proto_agent_async_release(proto_agent_channel_t *channel) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h index 7658e1d98f..1205048052 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h @@ -53,7 +53,7 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bi int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info); -int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); +int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info); void proto_agent_async_release(proto_agent_channel_t *channel); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index 5788bd0830..d396748d76 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -72,7 +72,7 @@ void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id) int proto_agent_create_channel(void *channel_info, int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + int (*msg_recv)(void **data, int *priority, void *channel_info), void (*release)(proto_agent_channel_t *channel)) { int channel_id = ++proto_agent_channel_id; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h index c88ba35b13..c956bf48b1 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h @@ -51,7 +51,7 @@ typedef struct proto_agent_channel_s { struct proto_agent_async_channel_s *channel_info; /*Callbacks for channel message Tx and Rx*/ int (*msg_send)(void *data, int size, int priority, void *channel_info); - int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); + int (*msg_recv)(void **data, int *priority, void *channel_info); void (*release)(struct proto_agent_channel_s *channel); } proto_agent_channel_t; @@ -70,7 +70,7 @@ void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id); /*Create a new channel. Returns the id of the new channel or negative number otherwise*/ int proto_agent_create_channel(void *channel_info, int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + int (*msg_recv)(void **data, int *priority, void *channel_info), void (*release)(proto_agent_channel_t *channel)); /*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 9ac06b8ad5..110b9edb7e 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -46,7 +46,7 @@ static void *link_manager_sender_thread(void *_manager) LOG_D(MAC, "starting link manager sender thread\n"); while (manager->run) { - while (message_get(manager->send_queue, &data, &size, &priority) == 0) { + while ((size = message_get(manager->send_queue, &data, &priority)) > 0) { link_send_packet(manager->socket_link, data, size, manager->peer_addr, manager->peer_port); free(data); } @@ -184,7 +184,7 @@ int main(void) data = strdup("hello"); if (data == NULL) goto error; if (message_put(send_queue, data, 6, 100)) goto error; - if (message_get(receive_queue, &data, &size, &priority)) goto error; + if ((size = message_get(receive_queue, &data, &priority)) <= 0) goto error; printf("received message:\n"); printf(" data: %s\n", (char *)data); printf(" size: %d\n", size); @@ -228,7 +228,7 @@ int main(void) manager = create_link_manager(send_queue, receive_queue, link); if (manager == NULL) goto error; - if (message_get(receive_queue, &data, &size, &priority)) goto error; + if ((size = message_get(receive_queue, &data, &priority)) <= 0) goto error; printf("received message:\n"); printf(" data: %s\n", (char *)data); printf(" size: %d\n", size); diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c index 5a33fbfabe..42790bdaaa 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.c +++ b/openair2/UTIL/ASYNC_IF/message_queue.c @@ -72,6 +72,8 @@ error: int message_put(message_queue_t *queue, void *data, int size, int priority) { message_t *m = NULL; + if (size <= 0) + goto error; m = calloc(1, sizeof(message_t)); if (m == NULL) @@ -106,12 +108,12 @@ int message_put(message_queue_t *queue, void *data, int size, int priority) return 0; error: - free(m); + if (m) free(m); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } -int message_get(message_queue_t *queue, void **data, int *size, int *priority) +int message_get(message_queue_t *queue, void **data, int *priority) { message_t *m; @@ -136,12 +138,11 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority) goto error; *data = m->data; - *size = m->size; + const int size = m->size; *priority = m->priority; free(m); - return 0; - + return size; error: LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; @@ -181,10 +182,10 @@ int main(void) if (message_put(q, "hello", 6, 0)) goto error; if (message_put(q, "world", 6, 1)) goto error; - if (message_get(q, &data, &size, &priority)) goto error; + if ((size = message_get(q, &data, &priority)) <= 0) goto error; printf("message:\n data: '%s'\n size: %d\n priority: %d\n", (char *)data, size, priority); - if (message_get(q, &data, &size, &priority)) goto error; + if ((size = message_get(q, &data, &priority)) <= 0) goto error; printf("message:\n data: '%s'\n size: %d\n priority: %d\n", (char *)data, size, priority); diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h index e5fc36ecd5..6d8d2a591a 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.h +++ b/openair2/UTIL/ASYNC_IF/message_queue.h @@ -55,7 +55,7 @@ typedef struct { message_queue_t *new_message_queue(void); int message_put(message_queue_t *queue, void *data, int size, int priority); -int message_get(message_queue_t *queue, void **data, int *size, int *priority); +int message_get(message_queue_t *queue, void **data, int *priority); void destroy_message_queue(message_queue_t *queue); #ifdef __cplusplus diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c index 201603e0c5..f46ca41d78 100644 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c @@ -67,6 +67,9 @@ int message_put(message_queue_t *queue, void *data, int size, int priority) { message_t *overwritten_msg; message_t *m = NULL; + if (size <= 0) + goto error; + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; lfds700_misc_prng_init(&ls); @@ -94,12 +97,11 @@ int message_put(message_queue_t *queue, void *data, int size, int priority) { return 0; error: - free(m); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } -int message_get(message_queue_t *queue, void **data, int *size, int *priority) { +int message_get(message_queue_t *queue, void **data, int *priority) { message_t *m; struct lfds700_misc_prng_state ls; @@ -111,10 +113,10 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority) { } *data = m->data; - *size = m->size; + const int size = m->size; *priority = m->priority; free(m); - return 0; + return size; } void destroy_message_queue(message_queue_t *queue) { diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h index 04414cbbb2..344187fe5c 100644 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h @@ -47,7 +47,7 @@ typedef struct { message_queue_t * new_message_queue(int size); int message_put(message_queue_t *queue, void *data, int size, int priority); -int message_get(message_queue_t *queue, void **data, int *size, int *priority); +int message_get(message_queue_t *queue, void **data, int *priority); void destroy_message_queue(message_queue_t *queue); #endif /* RINGBUFFER_QUEUE_H */ -- GitLab From beec74b01a19b7ccdf6a6f249fc680f4886ed3b2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 29 Jan 2019 16:41:51 +0100 Subject: [PATCH 224/308] Correctly stop link_manager sender and receiver threads This changes the destroy_link_manager() function to: * call a new function message_get_unlock() to unlock the sending thread from its blocking message_get() * calls pthread_cancel() on the receiving thread, because this unlocks any blocking read from a file descriptor The same message_get_unlock() function has been added ringbuffer_queue to keep the interfaces the same (it does nothing, because ringbuffer_queue is non-blocking). --- openair2/UTIL/ASYNC_IF/link_manager.c | 10 +++------- openair2/UTIL/ASYNC_IF/message_queue.c | 19 ++++++++++++++++++- openair2/UTIL/ASYNC_IF/message_queue.h | 2 ++ openair2/UTIL/ASYNC_IF/ringbuffer_queue.c | 5 +++++ openair2/UTIL/ASYNC_IF/ringbuffer_queue.h | 1 + 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 110b9edb7e..e9a8e98e07 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -50,11 +50,6 @@ static void *link_manager_sender_thread(void *_manager) link_send_packet(manager->socket_link, data, size, manager->peer_addr, manager->peer_port); free(data); } - // if (message_get(manager->send_queue, &data, &size, &priority)) - // goto error; - //if (link_send_packet(manager->socket_link, data, size)) - // goto error; - //free(data); } LOG_D(MAC, "link manager sender thread quits\n"); @@ -148,10 +143,11 @@ error: void destroy_link_manager(link_manager_t *manager) { - LOG_D(MAC, "destroying link manager\n"); manager->run = 0; + message_get_unlock(manager->send_queue); pthread_join(manager->sender, NULL); - pthread_join(manager->receiver, NULL); + /* cancel aborts the read performed in the receiver, then cancels the thread */ + pthread_cancel(manager->receiver); } #ifdef SERVER_TEST diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c index 42790bdaaa..460c58bcd1 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.c +++ b/openair2/UTIL/ASYNC_IF/message_queue.c @@ -56,6 +56,10 @@ message_queue_t *new_message_queue(void) if (pthread_cond_init(ret->cond, NULL)) goto error; + ret->head = NULL; + ret->tail = NULL; + ret->exit = 0; + return ret; error: @@ -121,10 +125,15 @@ int message_get(message_queue_t *queue, void **data, int *priority) goto error; while (queue->count == 0) { - if (pthread_cond_wait(queue->cond, queue->mutex)) { + int rc = pthread_cond_wait(queue->cond, queue->mutex); + if (rc != 0) { pthread_mutex_unlock(queue->mutex); goto error; } + if (queue->exit) { + pthread_mutex_unlock(queue->mutex); + return 0; + } } m = queue->head; @@ -148,6 +157,14 @@ error: return -1; } +void message_get_unlock(message_queue_t *queue) +{ + pthread_mutex_lock(queue->mutex); + queue->exit = 1; + pthread_mutex_unlock(queue->mutex); + pthread_cond_signal(queue->cond); +} + /* when calling this function, the queue must not be used anymore (we don't lock it) */ /* we suppose that the data pointer in messages was allocated by malloc/calloc/realloc */ void destroy_message_queue(message_queue_t *queue) diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h index 6d8d2a591a..656f3db28e 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.h +++ b/openair2/UTIL/ASYNC_IF/message_queue.h @@ -51,11 +51,13 @@ typedef struct { volatile int count; pthread_mutex_t *mutex; pthread_cond_t *cond; + int exit; } message_queue_t; message_queue_t *new_message_queue(void); int message_put(message_queue_t *queue, void *data, int size, int priority); int message_get(message_queue_t *queue, void **data, int *priority); +void message_get_unlock(message_queue_t *queue); void destroy_message_queue(message_queue_t *queue); #ifdef __cplusplus diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c index f46ca41d78..7bcd3b5647 100644 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c @@ -119,6 +119,11 @@ int message_get(message_queue_t *queue, void **data, int *priority) { return size; } +void message_get_unlock(message_queue_t *queue) { + /* don't do anything, this function exists to unlock a message_queue but is + * not needed in the case of the ringbuffer_queue */ +} + void destroy_message_queue(message_queue_t *queue) { struct lfds700_misc_prng_state ls; diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h index 344187fe5c..bb65612e6b 100644 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h @@ -48,6 +48,7 @@ typedef struct { message_queue_t * new_message_queue(int size); int message_put(message_queue_t *queue, void *data, int size, int priority); int message_get(message_queue_t *queue, void **data, int *priority); +void message_get_unlock(message_queue_t *queue); void destroy_message_queue(message_queue_t *queue); #endif /* RINGBUFFER_QUEUE_H */ -- GitLab From 822f9849a238f1618488d081d5df693919d560e7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 29 Jan 2019 16:42:26 +0100 Subject: [PATCH 225/308] Stop CU's PROTO_AGENT when DU disconnects This adds an exit flag as well as the proto_agent_async_msg_recv_unlock() function to unlock and release the proto_agent worker thread correctly. --- openair2/F1AP/f1ap_cu_task.c | 6 ++---- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 8 +++++++- openair2/LAYER2/PROTO_AGENT/proto_agent_async.c | 4 ++++ openair2/LAYER2/PROTO_AGENT/proto_agent_async.h | 3 +++ openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h | 1 + 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index f9f27e2653..39fe1e4d2e 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -57,6 +57,8 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat instance, sctp_new_association_resp->ulp_cnx_id); + if (sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN) + proto_agent_stop(instance); //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); return; // exit -1 for debugging } @@ -75,10 +77,6 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat .remote_ipv4_address = RC.rrc[instance]->eth_params_s.remote_addr, .remote_port = RC.rrc[instance]->eth_params_s.remote_portd }; - /* stop, then start the PROTO_AGENT. If it is already stopped, stopping it - * again will do nothing, therefore it is safe to call here. - * TODO: call proto_agent_stop() when CU_TASK is informed about conn release */ - proto_agent_stop(instance); AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %d!\n", instance); } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 148392280b..4b2c0218ea 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -70,6 +70,7 @@ int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) //DevAssert(p->remote_port > 1024); // "unprivileged" port proto_agent[mod_id].mod_id = mod_id; + proto_agent[mod_id].exit = 0; /* Initialize the channel container */ @@ -138,10 +139,14 @@ error: void proto_agent_stop(mod_id_t mod_id) { if (!proto_agent[mod_id].channel) return; + /* unlock the independent read thread proto_agent_receive() */ + proto_agent[mod_id].exit = 1; + proto_agent_async_msg_recv_unlock(proto_agent[mod_id].channel->channel_info); proto_agent_async_release(proto_agent[mod_id].channel); proto_agent_destroy_channel(proto_agent[mod_id].channel->channel_id); free(proto_agent[mod_id].channel); proto_agent[mod_id].channel = NULL; + LOG_W(PROTO_AGENT, "server stopped\n"); } //void @@ -266,10 +271,11 @@ proto_agent_receive(void *args) msg = NULL; ser_msg = NULL; - if ((size = proto_agent_async_msg_recv(&data, &priority, inst->channel->channel_info)) <= 0){ + if ((size = proto_agent_async_msg_recv(&data, &priority, inst->channel->channel_info)) < 0){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } + if (inst->exit) break; LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 476ecac90d..eef697c5bb 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -84,6 +84,10 @@ int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info) return message_get(channel->receive_queue, data, priority); } +void proto_agent_async_msg_recv_unlock(proto_agent_async_channel_t *channel) { + message_get_unlock(channel->receive_queue); +} + void proto_agent_async_release(proto_agent_channel_t *channel) { proto_agent_async_channel_t *channel_info = channel->channel_info; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h index 1205048052..27030924cd 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h @@ -55,6 +55,9 @@ int proto_agent_async_msg_send(void *data, int size, int priority, void *channel int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info); +/* unlocks a running proto_agent_async_msg_recv() */ +void proto_agent_async_msg_recv_unlock(proto_agent_async_channel_t *channel); + void proto_agent_async_release(proto_agent_channel_t *channel); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h index 8857a498ef..8724906d1a 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h @@ -121,6 +121,7 @@ typedef struct proto_agent_instance_s { proto_agent_info_t agent_info; struct proto_agent_channel_s *channel; pthread_t recv_thread; + uint8_t exit; } proto_agent_instance_t; #endif -- GitLab From 9fd4b452266eb146678eb48fd34c7ae4aa3f864a Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 7 Feb 2019 16:39:21 +0100 Subject: [PATCH 226/308] Remove F1-related flags from build_oai script --- cmake_targets/build_oai | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index f099b0cd37..17e4d7af58 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -105,12 +105,6 @@ Options Specify gen_nvram_path (default \"$gen_nvram_path\") -a | --agent Enables agent for software-defined control of the eNB ---pdcp-split - Enables PDCP-RLC U plane split ---CU - Build the CU entity ---DU - Build the CU entity -r | --3gpp-release default is Rel14, Rel8 limits the implementation to 3GPP Release 8 version @@ -219,12 +213,6 @@ function main() { -a | --agent) echo_info "FlexRAN support is always compiled into the eNB" shift;; - --pdcp-split | --CU | --DU ) - PDCP_SPLIT=1 - CU=1 - DU=1 - echo_info "Will compile for $1 with F1AP support " - shift;; --UE) UE=1 UETARGET="True" @@ -485,7 +473,7 @@ function main() { if [ "$INSTALL_EXTERNAL" = "1" ] ; then echo_info "Installing packages" - check_install_oai_software $PDCP_SPLIT + check_install_oai_software if [ "$HW" == "OAI_USRP" ] ; then echo_info "installing packages for USRP support" check_install_usrp_uhd_driver @@ -505,11 +493,6 @@ function main() { install_protobuf_from_source install_protobuf_c_from_source fi - if [ "$PDCP_SPLIT" == "1" ] ; then - echo_info "installing protobuf/protobuf-c for PDCP/RLC split support" - install_protobuf_from_source - install_protobuf_c_from_source - fi fi if [ "$INSTALL_OPTIONAL" = "1" ] ; then -- GitLab From 36f192e8738fc899b94c3d1e530c2f14de482b42 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 7 Feb 2019 17:53:44 +0100 Subject: [PATCH 227/308] Fix test of socket_link.c after interface change link_send_packet() has been extended to use for multiple protocols (added UDP, SCTP after TCP). The test was not update, though, which is fixed in this commit. --- openair2/UTIL/ASYNC_IF/socket_link.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 280ef5c31a..3c043f85df 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -602,8 +602,8 @@ int main(void) */ sleep(1); printf("... done\n"); - if (link_send_packet(l, "hello\n", 6+1) || - link_send_packet(l, "world\n", 6+1)) return 1; + if (link_send_packet(l, "hello\n", 6+1, NULL, 0) || + link_send_packet(l, "world\n", 6+1, NULL, 0)) return 1; if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); printf("stats:\n"); @@ -631,8 +631,8 @@ int main(void) printf("link is up\n"); if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); - if (link_send_packet(l, "bye\n", 4+1) || - link_send_packet(l, "server\n", 7+1)) return 1; + if (link_send_packet(l, "bye\n", 4+1, NULL, 0) || + link_send_packet(l, "server\n", 7+1, NULL, 0)) return 1; printf("stats:\n"); printf(" sent packets %"PRIu64"\n", l->packets_sent); printf(" sent bytes %"PRIu64"\n", l->bytes_sent); -- GitLab From 032fc48ac0ad3a6f9121316b1b75e09ce1e46e93 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 8 Feb 2019 18:01:56 +0100 Subject: [PATCH 228/308] Remove unused, commented F1AP code --- openair2/F1AP/f1ap_common.c | 147 ------------------------------------ 1 file changed, 147 deletions(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index f00b159e12..0d6de4414b 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -53,153 +53,6 @@ inline void ASN_DEBUG(const char *fmt, ...) } #endif -/* -ssize_t f1ap_generate_initiating_message( - uint8_t **buffer, - uint32_t *length, - e_F1ap_ProcedureCode procedureCode, - F1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr) -{ - S1AP_PDU_t pdu; - ssize_t encoded; - - memset(&pdu, 0, sizeof(S1AP_PDU_t)); - - pdu.present = S1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage.procedureCode = procedureCode; - pdu.choice.initiatingMessage.criticality = criticality; - ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - }*/ - - /* We can safely free list of IE from sptr */ -/* - ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, - (void **)buffer)) < 0) { - return -1; - } - - *length = encoded; - return encoded; -} - -ssize_t f1ap_generate_successfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_F1ap_ProcedureCode procedureCode, - F1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr) -{ - S1AP_PDU_t pdu; - ssize_t encoded; - - memset(&pdu, 0, sizeof(S1AP_PDU_t)); - - pdu.present = S1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome.procedureCode = procedureCode; - pdu.choice.successfulOutcome.criticality = criticality; - ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - }*/ - - /* We can safely free list of IE from sptr */ -/* - ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, - (void **)buffer)) < 0) { - return -1; - } - - *length = encoded; - - return encoded; -} - -ssize_t f1ap_generate_unsuccessfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_F1ap_ProcedureCode procedureCode, - F1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr) -{ - S1AP_PDU_t pdu; - ssize_t encoded; - - memset(&pdu, 0, sizeof(S1AP_PDU_t)); - - pdu.present = S1AP_PDU_PR_unsuccessfulOutcome; - pdu.choice.successfulOutcome.procedureCode = procedureCode; - pdu.choice.successfulOutcome.criticality = criticality; - ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } -*/ - /* We can safely free list of IE from sptr */ -/* - ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, - (void **)buffer)) < 0) { - return -1; - } - - *length = encoded; - - return encoded; -} - -F1ap_IE_t *f1ap_new_ie( - F1ap_ProtocolIE_ID_t id, - F1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *type, - void *sptr) -{ - F1ap_IE_t *buff; - - if ((buff = malloc(sizeof(F1ap_IE_t))) == NULL) { - // Possible error on malloc - return NULL; - } - - memset((void *)buff, 0, sizeof(F1ap_IE_t)); - - buff->id = id; - buff->criticality = criticality; - - if (ANY_fromType_aper(&buff->value, type, sptr) < 0) { - fprintf(stderr, "Encoding of %s failed\n", type->name); - free(buff); - return NULL; - } - - if (asn1_xer_print) - if (xer_fprint(stdout, &asn_DEF_F1ap_IE, buff) < 0) { - free(buff); - return NULL; - } - - return buff; -} - -void f1ap_handle_criticality(F1ap_Criticality_t criticality) -{ - -} -*/ - uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP) { static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; -- GitLab From 2f23047900851d51805eb188dfec9445f861856e Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 8 Feb 2019 19:42:25 +0100 Subject: [PATCH 229/308] Restructure F1AP UE list * Restructure the code handling the UEs F1AP knows * This fixes a bug that only two phones can be connected --- openair2/F1AP/f1ap_common.c | 213 ++++++++---------- openair2/F1AP/f1ap_common.h | 69 +++--- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 18 +- openair2/F1AP/f1ap_cu_task.c | 2 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 16 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 24 +- openair2/F1AP/f1ap_du_task.c | 2 +- openair2/F1AP/f1ap_du_ue_context_management.c | 16 +- 8 files changed, 165 insertions(+), 195 deletions(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 0d6de4414b..e9e69732be 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -62,37 +62,28 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ return transaction_identifier[enb_mod_idP+cu_mod_idP]; } -module_id_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { - static module_id_t UE_identifier[NUMBER_OF_eNB_MAX]; - UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER; - //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]); - return UE_identifier[enb_mod_idP+CC_idP+UE_id]; -} - -int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, +int f1ap_add_ue(f1ap_cudu_inst_t *f1_inst, module_id_t module_idP, int CC_idP, int UE_id, - rnti_t rntiP){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->rnti[i] == rntiP) { - f1_ue_inst->f1ap_uid[i] = i; - f1_ue_inst->mac_uid[i] = UE_id; - LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_ue_inst->rnti[i], f1_ue_inst->du_ue_f1ap_id[i]); - return i; + rnti_t rntiP) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].rnti == rntiP) { + f1_inst->f1ap_ue[i].f1ap_uid = i; + f1_inst->f1ap_ue[i].mac_uid = UE_id; + LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id); + return i; } } - for (i=0; i < MAX_MOBILES_PER_ENB ; i++){ - if (f1_ue_inst->rnti[i] == 0 ){ - f1_ue_inst->rnti[i]=rntiP; - f1_ue_inst->f1ap_uid[i]=i; - f1_ue_inst->mac_uid[i]=UE_id; - f1_ue_inst->du_ue_f1ap_id[i] = F1AP_get_UE_identifier(module_idP, CC_idP, i); - f1_ue_inst->cu_ue_f1ap_id[i] = F1AP_get_UE_identifier(module_idP, CC_idP, i); - f1_ue_inst->num_ues++; - LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %d\n", f1_ue_inst->rnti[i], f1_ue_inst->du_ue_f1ap_id[i]); + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].rnti == 0 ) { + f1_inst->f1ap_ue[i].rnti = rntiP; + f1_inst->f1ap_ue[i].f1ap_uid = i; + f1_inst->f1ap_ue[i].mac_uid = UE_id; + f1_inst->f1ap_ue[i].du_ue_f1ap_id = rntiP; + f1_inst->f1ap_ue[i].cu_ue_f1ap_id = rntiP; + f1_inst->num_ues++; + LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id); return i; } } @@ -100,122 +91,104 @@ int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, } -int f1ap_remove_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, - rnti_t rntiP){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->rnti[i] == rntiP) { - f1_ue_inst->rnti[i] = 0; - break; +int f1ap_remove_ue(f1ap_cudu_inst_t *f1_inst, + rnti_t rntiP) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].rnti == rntiP) { + f1_inst->f1ap_ue[i].rnti = 0; + break; } } - return 0 ; + f1_inst->num_ues--; + return 0; } -int f1ap_get_du_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, - rnti_t rntiP){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->rnti[i] == rntiP) { - return f1_ue_inst->du_ue_f1ap_id[i]; +int f1ap_get_du_ue_f1ap_id(f1ap_cudu_inst_t *f1_inst, + rnti_t rntiP) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].rnti == rntiP) { + return f1_inst->f1ap_ue[i].du_ue_f1ap_id; } - } - return -1; + } + return -1; } -int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, - rnti_t rntiP){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->rnti[i] == rntiP) { - return f1_ue_inst->cu_ue_f1ap_id[i]; +int f1ap_get_cu_ue_f1ap_id(f1ap_cudu_inst_t *f1_inst, + rnti_t rntiP) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].rnti == rntiP) { + return f1_inst->f1ap_ue[i].cu_ue_f1ap_id; } - } - return -1; + } + return -1; } -int f1ap_get_rnti_by_du_id(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t du_ue_f1ap_id ){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->du_ue_f1ap_id[i] == du_ue_f1ap_id) { - return f1_ue_inst->rnti[i]; - } - } - return -1; +int f1ap_get_rnti_by_du_id(f1ap_cudu_inst_t *f1_inst, + module_id_t du_ue_f1ap_id ) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) { + return f1_inst->f1ap_ue[i].rnti; + } + } + return -1; } -int f1ap_get_rnti_by_cu_id(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t cu_ue_f1ap_id ){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->cu_ue_f1ap_id[i] == cu_ue_f1ap_id) { - return f1_ue_inst->rnti[i]; - } - } - return -1; +int f1ap_get_rnti_by_cu_id(f1ap_cudu_inst_t *f1_inst, + module_id_t cu_ue_f1ap_id ) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].cu_ue_f1ap_id == cu_ue_f1ap_id) { + return f1_inst->f1ap_ue[i].rnti; + } + } + return -1; } -int f1ap_get_du_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t du_ue_f1ap_id ){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->du_ue_f1ap_id[i] == du_ue_f1ap_id) { +int f1ap_get_du_uid(f1ap_cudu_inst_t *f1_inst, + module_id_t du_ue_f1ap_id ) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) { return i; - } - } - return -1; + } + } + return -1; } - -int f1ap_get_cu_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t cu_ue_f1ap_id ){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->cu_ue_f1ap_id[i] == cu_ue_f1ap_id) { +int f1ap_get_cu_uid(f1ap_cudu_inst_t *f1_inst, + module_id_t cu_ue_f1ap_id ) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].cu_ue_f1ap_id == cu_ue_f1ap_id) { return i; - } - } - return -1; + } + } + return -1; } -int f1ap_get_uid_by_rnti(f1ap_cudu_ue_inst_t *f1_ue_inst, - rnti_t rntiP ){ - - int i; - for (i=0; i < MAX_MOBILES_PER_ENB; i++){ - if (f1_ue_inst->rnti[i] == rntiP) { +int f1ap_get_uid_by_rnti(f1ap_cudu_inst_t *f1_inst, + rnti_t rntiP ) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].rnti == rntiP) { return i; - } - } - return -1; + } + } + return -1; } -int f1ap_du_add_cu_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t du_ue_f1ap_id, - module_id_t cu_ue_f1ap_id){ - module_id_t f1ap_uid = f1ap_get_du_uid(f1_ue_inst,du_ue_f1ap_id); - if (f1ap_uid < 0 ) - return -1 ; - f1_ue_inst->cu_ue_f1ap_id[f1ap_uid]=cu_ue_f1ap_id; - LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x \n", cu_ue_f1ap_id, f1_ue_inst->rnti[f1ap_uid]); - return 0 ; +int f1ap_du_add_cu_ue_id(f1ap_cudu_inst_t *f1_inst, + module_id_t du_ue_f1ap_id, + module_id_t cu_ue_f1ap_id) { + module_id_t f1ap_uid = f1ap_get_du_uid(f1_inst,du_ue_f1ap_id); + if (f1ap_uid < 0) return -1; + f1_inst->f1ap_ue[f1ap_uid].cu_ue_f1ap_id = cu_ue_f1ap_id; + LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x\n", cu_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti); + return 0; } -int f1ap_cu_add_du_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t cu_ue_f1ap_id, - module_id_t du_ue_f1ap_id){ - module_id_t f1ap_uid = f1ap_get_cu_uid(f1_ue_inst,cu_ue_f1ap_id); - if (f1ap_uid < 0 ) - return -1 ; - f1_ue_inst->du_ue_f1ap_id[f1ap_uid]=du_ue_f1ap_id; - LOG_I(F1AP, "Adding du_ue_f1ap_id %d for UE with RNTI %x \n", du_ue_f1ap_id, f1_ue_inst->rnti[f1ap_uid]); - return 0 ; -} \ No newline at end of file +int f1ap_cu_add_du_ue_id(f1ap_cudu_inst_t *f1_inst, + module_id_t cu_ue_f1ap_id, + module_id_t du_ue_f1ap_id) { + module_id_t f1ap_uid = f1ap_get_cu_uid(f1_inst,cu_ue_f1ap_id); + if (f1ap_uid < 0) return -1; + f1_inst->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; + LOG_I(F1AP, "Adding du_ue_f1ap_id %d for UE with RNTI %x\n", du_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti); + return 0; +} diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 1f6fd03591..ee57a7ec83 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -425,67 +425,64 @@ typedef int (*f1ap_message_decoded_callback)( F1AP_F1AP_PDU_t *message_p ); -// instance and module_id are assumed to be the same typedef struct f1ap_cudu_ue_inst_s { // used for eNB stats generation - rnti_t rnti[MAX_MOBILES_PER_ENB]; - module_id_t f1ap_uid[MAX_MOBILES_PER_ENB]; - module_id_t mac_uid[MAX_MOBILES_PER_ENB]; - module_id_t du_ue_f1ap_id[MAX_MOBILES_PER_ENB]; - module_id_t cu_ue_f1ap_id[MAX_MOBILES_PER_ENB]; - - + rnti_t rnti; + module_id_t f1ap_uid; + module_id_t mac_uid; + module_id_t du_ue_f1ap_id; + module_id_t cu_ue_f1ap_id; +} f1ap_cudu_ue_t; + +typedef struct f1ap_cudu_inst_s { uint16_t num_ues; - -} f1ap_cudu_ue_inst_t; + f1ap_cudu_ue_t f1ap_ue[MAX_MOBILES_PER_ENB]; +} f1ap_cudu_inst_t; uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP); -module_id_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id); - -int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, +int f1ap_add_ue(f1ap_cudu_inst_t *f1_inst, module_id_t module_idP, int CC_idP, int UE_id, rnti_t rntiP); -int f1ap_remove_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, - rnti_t rntiP); +int f1ap_remove_ue(f1ap_cudu_inst_t *f1_inst, + rnti_t rntiP); -int f1ap_get_du_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, - rnti_t rntiP); +int f1ap_get_du_ue_f1ap_id (f1ap_cudu_inst_t *f1_inst, + rnti_t rntiP); -int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, - rnti_t rntiP); -//rnti +int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_inst_t *f1_inst, + rnti_t rntiP); -int f1ap_get_rnti_by_du_id(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t du_ue_f1ap_id ); +int f1ap_get_rnti_by_du_id(f1ap_cudu_inst_t *f1_inst, + module_id_t du_ue_f1ap_id ); -int f1ap_get_rnti_by_cu_id(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t cu_ue_f1ap_id ); +int f1ap_get_rnti_by_cu_id(f1ap_cudu_inst_t *f1_inst, + module_id_t cu_ue_f1ap_id ); -int f1ap_get_du_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t du_ue_f1ap_id ); +int f1ap_get_du_uid(f1ap_cudu_inst_t *f1_inst, + module_id_t du_ue_f1ap_id ); -int f1ap_get_cu_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t cu_ue_f1ap_id ); +int f1ap_get_cu_uid(f1ap_cudu_inst_t *f1_inst, + module_id_t cu_ue_f1ap_id ); -int f1ap_get_uid_by_rnti(f1ap_cudu_ue_inst_t *f1_ue_inst, - rnti_t rntiP ); +int f1ap_get_uid_by_rnti(f1ap_cudu_inst_t *f1_inst, + rnti_t rntiP ); -int f1ap_du_add_cu_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t du_ue_f1ap_id, - module_id_t cu_ue_f1ap_id); +int f1ap_du_add_cu_ue_id(f1ap_cudu_inst_t *f1_inst, + module_id_t du_ue_f1ap_id, + module_id_t cu_ue_f1ap_id); -int f1ap_cu_add_du_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, - module_id_t cu_ue_f1ap_id, - module_id_t du_ue_f1ap_id); +int f1ap_cu_add_du_ue_id(f1ap_cudu_inst_t *f1_inst, + module_id_t cu_ue_f1ap_id, + module_id_t du_ue_f1ap_id); #endif /* F1AP_COMMON_H_ */ diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 54f15933a1..a8e7a020cb 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -51,7 +51,7 @@ uint32_t f1ap_assoc_id = 0; uint32_t f1ap_stream = 0; -extern f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; +extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB]; /* Initial UL RRC Message Transfer @@ -138,12 +138,12 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %llu\n",(unsigned long long int)nr_cellid); - int f1ap_uid = f1ap_add_ue(&f1ap_cu_ue[rrc_inst], rrc_inst, CC_id, 0, rnti); + int f1ap_uid = f1ap_add_ue(&f1ap_cu_inst[rrc_inst], rrc_inst, CC_id, 0, rnti); if (f1ap_uid < 0 ) { LOG_E(CU_F1AP, "Failed to add UE \n"); return -1; } - f1ap_cu_ue[rrc_inst].du_ue_f1ap_id[f1ap_uid] = du_ue_f1ap_id; + f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; @@ -192,7 +192,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); LOG_I(CU_F1AP, "Setting GNB_CU_UE_F1AP_ID %llu associated with UE RNTI %x (instance %d)\n", (unsigned long long int)ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); @@ -204,7 +204,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); //f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); LOG_I(CU_F1AP, "GNB_DU_UE_F1AP_ID %llu associated with UE RNTI %x \n", (unsigned long long int)ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti); @@ -311,14 +311,14 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; - LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu associated with RNTI %x \n", cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id)); + LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu associated with RNTI %x\n", cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id)); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(CU_F1AP, "du_ue_f1ap_id %lu associated with RNTI %x \n", du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],du_ue_f1ap_id)); + LOG_D(CU_F1AP, "du_ue_f1ap_id %lu associated with RNTI %x\n", du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], du_ue_f1ap_id)); /* mandatory */ @@ -351,7 +351,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.choice.RRCContainer.size); RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id; - RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id); + RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id); RRC_DCCH_DATA_IND (message_p).module_id = instance; RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU @@ -360,7 +360,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, protocol_ctxt_t ctxt; ctxt.module_id = instance; ctxt.instance = instance; - ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id); + ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id); ctxt.enb_flag = 1; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 39fe1e4d2e..c12193d1b3 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -41,7 +41,7 @@ extern RAN_CONTEXT_t RC; f1ap_setup_req_t *f1ap_du_data_from_du; -f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; +f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB]; void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { // Nothing diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 660683a4c5..56db18c451 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -44,7 +44,7 @@ #include "rrc_eNB_GTPV1U.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; -extern f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; +extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB]; extern RAN_CONTEXT_t RC; int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, @@ -787,13 +787,13 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - const rnti_t rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], + const rnti_t rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - const rnti_t rnti2 = f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], + const rnti_t rnti2 = f1ap_get_rnti_by_du_id(&f1ap_cu_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID); AssertFatal(rnti == rnti2, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", rnti2, rnti); @@ -861,7 +861,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_ue[instance], cmd->rnti); + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_inst[instance], cmd->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -870,7 +870,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_ue[instance], cmd->rnti); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_inst[instance], cmd->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -939,13 +939,13 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - const rnti_t rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], + const rnti_t rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - const rnti_t rnti2 = f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance], + const rnti_t rnti2 = f1ap_get_rnti_by_du_id(&f1ap_cu_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID); AssertFatal(rnti == rnti2, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", rnti2, rnti); @@ -1001,7 +1001,7 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, instance, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); LOG_I(CU_F1AP, "Received UE CONTEXT RELEASE COMPLETE: Removing CU UE entry for RNTI %x\n", rnti); - f1ap_remove_ue(&f1ap_cu_ue[instance], rnti); + f1ap_remove_ue(&f1ap_cu_inst[instance], rnti); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 5a612f6d92..5ccfebbbd0 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -57,7 +57,7 @@ extern f1ap_setup_req_t *f1ap_du_data; extern RAN_CONTEXT_t RC; -extern f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; +extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; @@ -104,9 +104,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; LOG_D(DU_F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer - if (f1ap_du_add_cu_ue_id(&f1ap_du_ue[instance],du_ue_f1ap_id,cu_ue_f1ap_id) < 0 ) { + if (f1ap_du_add_cu_ue_id(&f1ap_du_inst[instance],du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { LOG_E(DU_F1AP, "Failed to find the F1AP UID \n"); //return -1; } @@ -174,7 +174,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, AssertFatal(srb_id<3,"illegal srb_id\n"); protocol_ctxt_t ctxt; - ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id); + ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id); ctxt.module_id = instance; ctxt.instance = instance; ctxt.enb_flag = 1; @@ -217,7 +217,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(DU_F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance], du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // Get configuration RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; @@ -260,7 +260,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // This should be somewhere in the f1ap_cudu_ue_inst_t /*int macrlc_instance = 0; - rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id); + rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[0], du_ue_f1ap_id); struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); */ eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; @@ -356,7 +356,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(DU_F1AP, "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); RRCConnectionReconfiguration_t* rrcConnectionReconfiguration = &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration; @@ -613,7 +613,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, instance_t instance = ctxt_pP->module_id; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[instance].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], rnti)]; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -623,7 +623,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[instance].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], rnti)]; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -762,7 +762,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, uint8_t *buffer; uint32_t len; - int f1ap_uid = f1ap_add_ue (&f1ap_du_ue[module_idP], module_idP, CC_idP,UE_id, rntiP); + int f1ap_uid = f1ap_add_ue (&f1ap_du_inst[module_idP], module_idP, CC_idP,UE_id, rntiP); if (f1ap_uid < 0 ) { LOG_E(DU_F1AP, "Failed to add UE \n"); @@ -786,7 +786,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[module_idP].du_ue_f1ap_id[f1ap_uid]; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_inst[module_idP].f1ap_ue[f1ap_uid].du_ue_f1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -856,7 +856,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, void init_f1ap_du_ue_inst (void) { - memset(f1ap_du_ue, 0, sizeof(f1ap_du_ue)); + memset(f1ap_du_inst, 0, sizeof(f1ap_du_inst)); } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 589d994d18..95982c2ecc 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -39,7 +39,7 @@ extern RAN_CONTEXT_t RC; f1ap_setup_req_t *f1ap_du_data; -f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; +f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index b118ac904f..3f12bf9505 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -47,7 +47,7 @@ #undef C_RNTI extern f1ap_setup_req_t *f1ap_du_data; -extern f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; +extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; extern RAN_CONTEXT_t RC; int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, @@ -585,7 +585,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_ue[instance], req->rnti); + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], req->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -594,7 +594,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_ue[instance], req->rnti); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], req->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -661,7 +661,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_du_ue[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); + ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_du_inst[instance], ie->value.choice.GNB_CU_UE_F1AP_ID); ctxt.module_id = instance; ctxt.instance = instance; ctxt.enb_flag = 1; @@ -669,7 +669,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - const rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance], + const rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID); AssertFatal(ctxt.rnti == rnti, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", @@ -789,7 +789,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_ue[instance], cplt->rnti); + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], cplt->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -798,7 +798,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_ue[instance], cplt->rnti); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], cplt->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional -> currently not used */ @@ -871,7 +871,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, len, f1ap_du_data->default_sctp_stream_id); - f1ap_remove_ue(&f1ap_du_ue[instance], cplt->rnti); + f1ap_remove_ue(&f1ap_du_inst[instance], cplt->rnti); return 0; } -- GitLab From 1a07a1e06744c072ccb89ac8978eb17359ac2760 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 22 Feb 2019 10:26:41 +0100 Subject: [PATCH 230/308] Replace redundant CU_F1AP/DU_F1AP with F1AP --- common/utils/LOG/log.c | 2 - common/utils/LOG/log.h | 2 - common/utils/T/T_messages.txt | 42 ------ openair2/F1AP/f1ap_cu_interface_management.c | 60 ++++---- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 37 ++--- openair2/F1AP/f1ap_cu_task.c | 27 ++-- openair2/F1AP/f1ap_cu_task.h | 6 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 10 +- openair2/F1AP/f1ap_du_interface_management.c | 89 ++++++------ openair2/F1AP/f1ap_du_rrc_message_transfer.c | 134 +++++++++--------- openair2/F1AP/f1ap_du_task.c | 20 +-- openair2/F1AP/f1ap_du_task.h | 6 +- openair2/F1AP/f1ap_du_ue_context_management.c | 20 +-- openair2/F1AP/f1ap_encoder.c | 2 - 14 files changed, 210 insertions(+), 247 deletions(-) diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 296a011ead..d97cf808d5 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -406,8 +406,6 @@ int logInit (void) { register_log_component("GTPV1U","",GTPU); register_log_component("S1AP","",S1AP); register_log_component("F1AP","",F1AP); - register_log_component("CU_F1AP","",CU_F1AP); - register_log_component("DU_F1AP","",DU_F1AP); register_log_component("X2AP","",X2AP); register_log_component("SCTP","",SCTP); register_log_component("X2AP","",X2AP); diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index f570520257..350d1e9624 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -206,8 +206,6 @@ typedef enum { SPGW, S1AP, F1AP, - DU_F1AP, - CU_F1AP, SCTP, HW, OSA, diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 9d8aa0e17e..5281647b5e 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -923,48 +923,6 @@ ID = LEGACY_F1AP_ERROR GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_ERROR:LEGACY FORMAT = string,log -ID = LEGACY_CU_F1AP_TRACE - DESC = CU_F1AP TRACE LEVEL - GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_TRACE:LEGACY - FORMAT = string,log -ID = LEGACY_CU_F1AP_DEBUG - DESC = CU_F1AP DEBUG LEVEL - GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_DEBUG:LEGACY - FORMAT = string,log -ID = LEGACY_CU_F1AP_INFO - DESC = CU_F1AP INFO LEVEL - GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_INFO:LEGACY - FORMAT = string,log -ID = LEGACY_CU_F1AP_WARNING - DESC = CU_F1AP WARNING LEVEL - GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_WARNING:LEGACY - FORMAT = string,log -ID = LEGACY_CU_F1AP_ERROR - DESC = CU_F1AP ERROR LEVEL - GROUP = ALL:LEGACY_CU_F1AP:LEGACY_GROUP_ERROR:LEGACY - FORMAT = string,log - -ID = LEGACY_DU_F1AP_TRACE - DESC = DU_F1AP TRACE LEVEL - GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_TRACE:LEGACY - FORMAT = string,log -ID = LEGACY_DU_F1AP_DEBUG - DESC = DU_F1AP DEBUG LEVEL - GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_DEBUG:LEGACY - FORMAT = string,log -ID = LEGACY_DU_F1AP_INFO - DESC = DU_F1AP INFO LEVEL - GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_INFO:LEGACY - FORMAT = string,log -ID = LEGACY_DU_F1AP_WARNING - DESC = DU_F1AP WARNING LEVEL - GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_WARNING:LEGACY - FORMAT = string,log -ID = LEGACY_DU_F1AP_ERROR - DESC = DU_F1AP ERROR LEVEL - GROUP = ALL:LEGACY_DU_F1AP:LEGACY_GROUP_ERROR:LEGACY - FORMAT = string,log - ################# #### UE LOGS #### ################# diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 9039b967c4..a414c27383 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -84,7 +84,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - LOG_D(CU_F1AP, "CU_handle_F1_SETUP_REQUEST\n"); + LOG_D(F1AP, "CU_handle_F1_SETUP_REQUEST\n"); MessageDef *message_p; F1AP_F1SetupRequest_t *container; @@ -112,7 +112,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_ID, true); asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &F1AP_SETUP_REQ(message_p).gNB_DU_id); - LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); /* gNB_DU_name */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, @@ -122,13 +122,14 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ie->value.choice.GNB_DU_Name.size); /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; - LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); /* GNB_DU_Served_Cells_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); F1AP_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; - LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).num_cells_available %d \n", + F1AP_SETUP_REQ(message_p).num_cells_available); int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available; @@ -139,7 +140,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* tac */ OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); - LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", + i, F1AP_SETUP_REQ(message_p).tac[i]); /* - nRCGI */ TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], @@ -150,19 +152,20 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // NR cellID BIT_STRING_TO_NR_CELL_IDENTITY(&served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity, F1AP_SETUP_REQ(message_p).nr_cellid[i]); - LOG_D(CU_F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, - F1AP_SETUP_REQ(message_p).mcc[i], - F1AP_SETUP_REQ(message_p).mnc[i], - (long long unsigned int)F1AP_SETUP_REQ(message_p).nr_cellid[i]); - LOG_D(CU_F1AP, "nr_cellId : %x %x %x %x %x\n", - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2], - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3], - served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]); + LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, + F1AP_SETUP_REQ(message_p).mcc[i], + F1AP_SETUP_REQ(message_p).mnc[i], + (long long unsigned int)F1AP_SETUP_REQ(message_p).nr_cellid[i]); + LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2], + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3], + served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]); /* - nRPCI */ F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI; - LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", + i, F1AP_SETUP_REQ(message_p).nr_pci[i]); // System Information /* mib */ @@ -172,7 +175,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size; - LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", + i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); /* sib1 */ F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); @@ -181,7 +185,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size; - LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", + i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); } @@ -305,7 +310,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate; - LOG_D(CU_F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate); + LOG_D(F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate); for (i=0; i<num_cells_to_activate; i++) { @@ -346,15 +351,16 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); #ifdef F1AP_DEBUG - LOG_D(CU_F1AP, "SI %d: ",i); - for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) printf("%2x ",f1ap_setup_resp->SI_container[i][0][n]); - LOG_D(CU_F1AP, "\n"); + LOG_I(F1AP, "SI %d: ", i); + for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) + printf("%2x ", f1ap_setup_resp->SI_container[i][0][n]); + printf("\n"); #endif OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, (const char*)f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); - LOG_D(CU_F1AP, "f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); + LOG_D(F1AP, "f1ap_setup_resp->SI_container_length = %d \n", f1ap_setup_resp->SI_container_length[0][0]); cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; @@ -375,7 +381,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -385,7 +391,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, } int CU_send_F1_SETUP_FAILURE(instance_t instance) { - LOG_D(CU_F1AP, "CU_send_F1_SETUP_FAILURE\n"); + LOG_D(F1AP, "CU_send_F1_SETUP_FAILURE\n"); module_id_t enb_mod_idP; module_id_t cu_mod_idP; @@ -461,7 +467,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -865,7 +871,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index a8e7a020cb..fc104b266a 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -64,7 +64,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - LOG_D(CU_F1AP, "CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); + LOG_D(F1AP, "CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); // decode the F1 message // get the rrc message from the contauiner // call func rrc_eNB_decode_ccch: <-- needs some update here @@ -80,8 +80,8 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, DevAssert(pdu != NULL); if (stream != 0) { - LOG_E(CU_F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", - assoc_id, stream); + LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", + assoc_id, stream); return -1; } // TODO: use context @@ -94,7 +94,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(CU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); /* NRCGI * TODO: process NRCGI @@ -122,9 +122,10 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); #ifdef F1AP_DEBUG - LOG_I(CU_F1AP, "RRCContainer(CCCH) :"); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - LOG_I(CU_F1AP, "\n"); + LOG_I(F1AP, "RRCContainer (CCCH):"); + for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + printf("%2x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + printf("\n"); #endif // Find instance from nr_cellid int rrc_inst = -1; @@ -140,7 +141,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, int f1ap_uid = f1ap_add_ue(&f1ap_cu_inst[rrc_inst], rrc_inst, CC_id, 0, rnti); if (f1ap_uid < 0 ) { - LOG_E(CU_F1AP, "Failed to add UE \n"); + LOG_E(F1AP, "Failed to add UE \n"); return -1; } f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; @@ -194,8 +195,8 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - LOG_I(CU_F1AP, "Setting GNB_CU_UE_F1AP_ID %llu associated with UE RNTI %x (instance %d)\n", - (unsigned long long int)ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); + LOG_I(F1AP, "Setting GNB_CU_UE_F1AP_ID %llu associated with UE RNTI %x (instance %d)\n", + (unsigned long long int)ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); /* mandatory */ @@ -206,7 +207,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - LOG_I(CU_F1AP, "GNB_DU_UE_F1AP_ID %llu associated with UE RNTI %x \n", (unsigned long long int)ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti); + LOG_I(F1AP, "GNB_DU_UE_F1AP_ID %llu associated with UE RNTI %x \n", (unsigned long long int)ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti); /* optional */ /* c3. oldgNB_DU_UE_F1AP_ID */ @@ -268,7 +269,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -286,7 +287,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - LOG_D(CU_F1AP, "CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); + LOG_D(F1AP, "CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); F1AP_ULRRCMessageTransfer_t *container; F1AP_ULRRCMessageTransferIEs_t *ie; @@ -311,14 +312,14 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; - LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu associated with RNTI %x\n", cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id)); + LOG_D(F1AP, "cu_ue_f1ap_id %lu associated with RNTI %x\n", cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id)); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(CU_F1AP, "du_ue_f1ap_id %lu associated with RNTI %x\n", du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], du_ue_f1ap_id)); + LOG_D(F1AP, "du_ue_f1ap_id %lu associated with RNTI %x\n", du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], du_ue_f1ap_id)); /* mandatory */ @@ -327,9 +328,9 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; if (srb_id < 1 ) - LOG_E(CU_F1AP, "Unexpected UL RRC MESSAGE for srb_id %lu \n", srb_id); + LOG_E(F1AP, "Unexpected UL RRC MESSAGE for srb_id %lu \n", srb_id); else - LOG_D(CU_F1AP, "UL RRC MESSAGE for srb_id %lu in DCCH \n", srb_id); + LOG_D(F1AP, "UL RRC MESSAGE for srb_id %lu in DCCH \n", srb_id); // issue in here @@ -364,7 +365,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ctxt.enb_flag = 1; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); - LOG_I(CU_F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); + LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); pdcp_data_ind (&ctxt, 1, // srb_flag 0, // embms_flag diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index c12193d1b3..9ab84e6bc9 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -/*! \file openair2/F1AP/CU_F1AP.c +/*! \file openair2/F1AP/f1ap_cu_task.c * \brief data structures for F1 interface modules * \author EURECOM/NTUST * \date 2018 @@ -98,7 +98,7 @@ void cu_task_send_sctp_init_req(instance_t enb_id) { // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port // 3. creat an itti message to init - LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ(create socket)\n"); + LOG_I(F1AP, "F1AP_CU_SCTP_REQ(create socket)\n"); MessageDef *message_p = NULL; message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); @@ -124,7 +124,7 @@ void *F1AP_CU_task(void *arg) { MessageDef *received_msg = NULL; int result; - LOG_I(CU_F1AP,"Starting F1AP at CU\n"); + LOG_I(F1AP, "Starting F1AP at CU\n"); // no RLC in CU, initialize mem pool for PDCP pool_buffer_init(); @@ -138,25 +138,28 @@ void *F1AP_CU_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case SCTP_NEW_ASSOCIATION_IND: - LOG_I(CU_F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %d\n", + ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_NEW_ASSOCIATION_RESP: - LOG_I(CU_F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_RESP for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_RESP for instance %d\n", + ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: - LOG_I(CU_F1AP, "CU Task Received SCTP_DATA_IND for Instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(F1AP, "CU Task Received SCTP_DATA_IND for Instance %d\n", + ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_SETUP_RESP: // from rrc - LOG_I(CU_F1AP, "CU Task Received F1AP_SETUP_RESP\n"); + LOG_I(F1AP, "CU Task Received F1AP_SETUP_RESP\n"); // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), // &F1AP_SETUP_RESP(received_msg)); CU_send_F1_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), @@ -164,13 +167,13 @@ void *F1AP_CU_task(void *arg) { break; case F1AP_DL_RRC_MESSAGE: // from rrc - LOG_I(CU_F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); + LOG_I(F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_DL_RRC_MESSAGE(received_msg)); break; case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc - LOG_I(CU_F1AP, "CU Task Received F1AP_UE_CONTEXT_RELEASE_CMD\n"); + LOG_I(F1AP, "CU Task Received F1AP_UE_CONTEXT_RELEASE_CMD\n"); CU_send_UE_CONTEXT_RELEASE_COMMAND(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_UE_CONTEXT_RELEASE_CMD(received_msg)); break; @@ -184,13 +187,13 @@ void *F1AP_CU_task(void *arg) { // break; case TERMINATE_MESSAGE: - LOG_W(CU_F1AP, " *** Exiting CU_F1AP thread\n"); + LOG_W(F1AP, " *** Exiting F1AP thread\n"); itti_exit_task(); break; default: - LOG_E(CU_F1AP, "CU Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + LOG_E(F1AP, "CU Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); break; } // switch result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); diff --git a/openair2/F1AP/f1ap_cu_task.h b/openair2/F1AP/f1ap_cu_task.h index 60747efbcb..dec844accf 100644 --- a/openair2/F1AP/f1ap_cu_task.h +++ b/openair2/F1AP/f1ap_cu_task.h @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -#ifndef CU_F1AP_TASK_H_ -#define CU_F1AP_TASK_H_ +#ifndef F1AP_CU_TASK_H_ +#define F1AP_CU_TASK_H_ void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind); void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); @@ -29,4 +29,4 @@ void cu_task_send_sctp_init_req(instance_t enb_id); void *F1AP_CU_task(void *arg); -#endif /* CU_F1AP_TASK_H_ */ +#endif /* F1AP_CU_TASK_H_ */ diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 56db18c451..f0b7194bce 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -752,7 +752,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -823,7 +823,7 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, } */ - LOG_I(CU_F1AP, "Received UE CONTEXT RELEASE REQUEST: Trigger RRC for RNTI %x\n", rnti); + LOG_I(F1AP, "Received UE CONTEXT RELEASE REQUEST: Trigger RRC for RNTI %x\n", rnti); struct rrc_eNB_ue_context_s *ue_context_pP; ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ( @@ -917,7 +917,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 context release command\n"); + LOG_E(F1AP, "Failed to encode F1 context release command\n"); return -1; } @@ -1000,7 +1000,7 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, flexran_agent_get_rrc_xface(instance)->flexran_agent_notify_ue_state_change( instance, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - LOG_I(CU_F1AP, "Received UE CONTEXT RELEASE COMPLETE: Removing CU UE entry for RNTI %x\n", rnti); + LOG_I(F1AP, "Received UE CONTEXT RELEASE COMPLETE: Removing CU UE entry for RNTI %x\n", rnti); f1ap_remove_ue(&f1ap_cu_inst[instance], rnti); return 0; } @@ -1469,7 +1469,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index ba5ca584f0..8f738cf066 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -145,7 +145,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; int num_cells_available = f1ap_du_data->num_cells_available; - LOG_D(DU_F1AP, "num_cells_available = %d \n", num_cells_available); + LOG_D(F1AP, "num_cells_available = %d \n", num_cells_available); for (i=0; i<num_cells_available; i++) { @@ -170,16 +170,17 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - nRCGI */ F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - LOG_D(DU_F1AP, "plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); + LOG_D(F1AP, "plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); - LOG_D(DU_F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",(long long unsigned int)f1ap_du_data->nr_cellid[i], - nRCGI.nRCellIdentity.buf[0], - nRCGI.nRCellIdentity.buf[1], - nRCGI.nRCellIdentity.buf[2], - nRCGI.nRCellIdentity.buf[3], - nRCGI.nRCellIdentity.buf[4]); + LOG_D(F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n", + (long long unsigned int)f1ap_du_data->nr_cellid[i], + nRCGI.nRCellIdentity.buf[0], + nRCGI.nRCellIdentity.buf[1], + nRCGI.nRCellIdentity.buf[2], + nRCGI.nRCellIdentity.buf[3], + nRCGI.nRCellIdentity.buf[4]); served_cell_information.nRCGI = nRCGI; @@ -202,7 +203,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - broadcast PLMNs */ // RK: add the num_available_broadcast_PLMNs to the message int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs; - LOG_D(DU_F1AP, "num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); + LOG_D(F1AP, "num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); for (j=0; j<num_available_broadcast_PLMNs; // num_available_broadcast_PLMNs j++) { @@ -235,7 +236,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.1.3 freqBandListNr */ int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands; - LOG_D(DU_F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); + LOG_D(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); int fdd_ul_j; for (fdd_ul_j=0; fdd_ul_j<fdd_ul_num_available_freq_Bands; @@ -248,7 +249,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.1.3.2 supportedSULBandList*/ int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; - LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); int fdd_ul_k; for (fdd_ul_k=0; fdd_ul_k<num_available_supported_SULBands; @@ -277,7 +278,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.2.3 freqBandListNr */ int fdd_dl_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_frequency_bands; - LOG_D(DU_F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); + LOG_D(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); int fdd_dl_j; for (fdd_dl_j=0; fdd_dl_j<fdd_dl_num_available_freq_Bands; @@ -290,7 +291,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.2.3.2 supportedSULBandList*/ int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; - LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); int fdd_dl_k; for (fdd_dl_k=0; fdd_dl_k<num_available_supported_SULBands; @@ -331,7 +332,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* TDD.1.3 freqBandListNr */ int tdd_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].tdd.num_frequency_bands; - LOG_D(DU_F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); + LOG_D(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); int j; for (j=0; j<tdd_num_available_freq_Bands; @@ -344,7 +345,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* TDD.1.3.2 supportedSULBandList*/ int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].tdd.num_sul_frequency_bands; - LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); int k; for (k=0; k<num_available_supported_SULBands; @@ -399,7 +400,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -423,7 +424,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, F1AP_F1AP_PDU_t *pdu) { - LOG_D(DU_F1AP, "DU_handle_F1_SETUP_RESPONSE\n"); + LOG_D(F1AP, "DU_handle_F1_SETUP_RESPONSE\n"); AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome, "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); @@ -444,8 +445,8 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, F1AP_SETUP_RESP); - LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", - in->protocolIEs.list.count); + LOG_D(F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", + in->protocolIEs.list.count); for (int i=0;i < in->protocolIEs.list.count; i++) { ie = in->protocolIEs.list.array[i]; switch (ie->id) { @@ -455,8 +456,8 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID, "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); TransactionId=ie->value.choice.TransactionID; - LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n", - TransactionId); + LOG_D(F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n", + TransactionId); break; case F1AP_ProtocolIE_ID_id_gNB_CU_Name: AssertFatal(ie->criticality == F1AP_Criticality_ignore, @@ -466,8 +467,8 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size); F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0'; - LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", - F1AP_SETUP_RESP (msg_p).gNB_CU_name); + LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", + F1AP_SETUP_RESP (msg_p).gNB_CU_name); break; case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: AssertFatal(ie->criticality == F1AP_Criticality_reject, @@ -475,7 +476,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List, "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n"); num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; - LOG_D(DU_F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); + LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); for (int i=0;i<num_cells_to_activate;i++) { F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = ie->value.choice.Cells_to_be_Activated_List.list.array[i]; @@ -491,12 +492,12 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], F1AP_SETUP_RESP (msg_p).mnc_digit_length[i]); AssertFatal(cell->nRPCI != NULL, "nRPCI is null\n"); - LOG_D(DU_F1AP, "nr_cellId : %x %x %x %x %x\n", - cell->nRCGI.nRCellIdentity.buf[0], - cell->nRCGI.nRCellIdentity.buf[1], - cell->nRCGI.nRCellIdentity.buf[2], - cell->nRCGI.nRCellIdentity.buf[3], - cell->nRCGI.nRCellIdentity.buf[4]); + LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", + cell->nRCGI.nRCellIdentity.buf[0], + cell->nRCGI.nRCellIdentity.buf[1], + cell->nRCGI.nRCellIdentity.buf[2], + cell->nRCGI.nRCellIdentity.buf[3], + cell->nRCGI.nRCellIdentity.buf[4]); BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, F1AP_SETUP_RESP (msg_p).nr_cellid[i]); F1AP_SETUP_RESP (msg_p).nrpci[i] = *cell->nRPCI; @@ -505,13 +506,13 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ext!=NULL,"Extension for SI is null\n"); F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - LOG_D(DU_F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", - i, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], - F1AP_SETUP_RESP (msg_p).nr_cellid[i], F1AP_SETUP_RESP (msg_p).num_SI[i]); + LOG_D(F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", + i, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], + F1AP_SETUP_RESP (msg_p).nr_cellid[i], F1AP_SETUP_RESP (msg_p).num_SI[i]); for (int si =0;si < ext->list.count;si++) { size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; - LOG_D(DU_F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %ld bytes\n", i, si, size); + LOG_D(F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %ld bytes\n", i, si, size); F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si], @@ -538,8 +539,8 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), assoc_id); - LOG_D(DU_F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); return 0; @@ -550,7 +551,7 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - LOG_E(DU_F1AP, "DU_handle_F1_SETUP_FAILURE\n"); + LOG_E(F1AP, "DU_handle_F1_SETUP_FAILURE\n"); return 0; } @@ -619,12 +620,12 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t nRCGI; MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - LOG_D(DU_F1AP, "nr_cellId : %x %x %x %x %x\n", - nRCGI.nRCellIdentity.buf[0], - nRCGI.nRCellIdentity.buf[1], - nRCGI.nRCellIdentity.buf[2], - nRCGI.nRCellIdentity.buf[3], - nRCGI.nRCellIdentity.buf[4]); + LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", + nRCGI.nRCellIdentity.buf[0], + nRCGI.nRCellIdentity.buf[1], + nRCGI.nRCellIdentity.buf[2], + nRCGI.nRCellIdentity.buf[3], + nRCGI.nRCellIdentity.buf[4]); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; @@ -994,7 +995,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 05cc602451..27add35f5f 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -67,7 +67,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { #ifndef UETARGET - LOG_D(DU_F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); + LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); F1AP_DLRRCMessageTransfer_t *container; F1AP_DLRRCMessageTransferIEs_t *ie; @@ -95,19 +95,19 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID; - LOG_D(DU_F1AP, "cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + LOG_D(F1AP, "cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(DU_F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer + LOG_D(F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer if (f1ap_du_add_cu_ue_id(&f1ap_du_inst[instance],du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { - LOG_E(DU_F1AP, "Failed to find the F1AP UID \n"); + LOG_E(F1AP, "Failed to find the F1AP UID \n"); //return -1; } @@ -123,7 +123,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; - LOG_D(DU_F1AP, "srb_id %lu \n", srb_id); + LOG_D(F1AP, "srb_id %lu \n", srb_id); /* optional */ /* ExecuteDuplication */ @@ -131,7 +131,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); executeDuplication = ie->value.choice.ExecuteDuplication; - LOG_D(DU_F1AP, "ExecuteDuplication %d \n", executeDuplication); + LOG_D(F1AP, "ExecuteDuplication %d \n", executeDuplication); } // issue in here @@ -165,7 +165,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, //rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority; break; default: - LOG_W(DU_F1AP, "unhandled IE RAT_FrequencyPriorityInformation.present\n"); + LOG_W(F1AP, "unhandled IE RAT_FrequencyPriorityInformation.present\n"); break; } } @@ -195,30 +195,30 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, switch (dl_ccch_msg->message.choice.c1.present) { case LTE_DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(DU_F1AP, "Received PR_NOTHING on DL-CCCH-Message\n"); + LOG_I(F1AP, "Received PR_NOTHING on DL-CCCH-Message\n"); break; case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: - LOG_I(DU_F1AP, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n"); + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n"); break; case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: - LOG_I(DU_F1AP, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n"); + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n"); break; case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReject: - LOG_I(DU_F1AP, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); break; case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: { - LOG_I(DU_F1AP, - "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %lx/RNTI %x\n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %lx/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // Get configuration LTE_RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; @@ -328,36 +328,36 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, rrc_dl_sdu_len,0,0); if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) - LOG_E(DU_F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed); + LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed); else - LOG_D(DU_F1AP, "Received message: present %d and c1 present %d\n", - dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1.present); + LOG_D(F1AP, "Received message: present %d and c1 present %d\n", + dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1.present); if (dl_dcch_msg->message.present == LTE_DL_DCCH_MessageType_PR_c1) { switch (dl_dcch_msg->message.choice.c1.present) { case LTE_DL_DCCH_MessageType__c1_PR_NOTHING: - LOG_I(DU_F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); + LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); return 0; case LTE_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: - LOG_I(DU_F1AP,"Received NAS DL Information Transfer\n"); + LOG_I(F1AP,"Received NAS DL Information Transfer\n"); break; case LTE_DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: - LOG_I(DU_F1AP,"Received NAS sfbParametersResponseCDMA2000\n"); + LOG_I(F1AP,"Received NAS sfbParametersResponseCDMA2000\n"); break; case LTE_DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: - LOG_I(DU_F1AP,"Received NAS andoverFromEUTRAPreparationRequest\n"); + LOG_I(F1AP,"Received NAS andoverFromEUTRAPreparationRequest\n"); break; case LTE_DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: - LOG_I(DU_F1AP,"Received NAS mobilityFromEUTRACommand\n"); + LOG_I(F1AP,"Received NAS mobilityFromEUTRACommand\n"); break; case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: // handle RRCConnectionReconfiguration - LOG_I(DU_F1AP, - "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %lx/RNTI %x\n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + LOG_I(F1AP, + "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %lx/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); LTE_RRCConnectionReconfiguration_t* rrcConnectionReconfiguration = &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration; @@ -368,15 +368,15 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, &rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8; if (rrcConnectionReconfiguration_r8->mobilityControlInfo) { - LOG_I(DU_F1AP,"Mobility Control Information is present\n"); + LOG_I(F1AP, "Mobility Control Information is present\n"); AssertFatal(1==0,"Can't handle this yet in DU\n"); } if (rrcConnectionReconfiguration_r8->measConfig != NULL) { - LOG_I(DU_F1AP,"Measurement Configuration is present\n"); + LOG_I(F1AP, "Measurement Configuration is present\n"); } if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated) { - LOG_I(DU_F1AP,"Radio Resource Configuration is present\n"); + LOG_I(F1AP, "Radio Resource Configuration is present\n"); uint8_t DRB2LCHAN[8]; long drb_id; int i; @@ -405,9 +405,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { ue_context_p->ue_context.Srb2.Active=1; ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(DU_F1AP,"[DU %d] SRB2 is now active\n",ctxt.module_id); + LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); } else { - LOG_W(DU_F1AP,"[DU %d] invalide SRB identity %ld\n",ctxt.module_id, + LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, SRB_configList->list.array[i]->srb_Identity); } } @@ -417,12 +417,12 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) if (DRB_configList->list.array[i]) { drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(DU_F1AP, - "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", - ctxt.module_id, - ctxt.rnti, - (int)DRB_configList->list.array[i]->drb_Identity, - (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + LOG_I(F1AP, + "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", + ctxt.module_id, + ctxt.rnti, + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { ue_context_p->ue_context.DRB_active[drb_id] = 1; @@ -478,13 +478,13 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, break; case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: // handle RRCConnectionRelease - LOG_I(DU_F1AP,"Received RRCConnectionRelease\n"); + LOG_I(F1AP, "Received RRCConnectionRelease\n"); break; case LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand: - LOG_I(DU_F1AP,"Received securityModeCommand\n"); + LOG_I(F1AP, "Received securityModeCommand\n"); break; case LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - LOG_I(DU_F1AP,"Received ueCapabilityEnquiry\n"); + LOG_I(F1AP, "Received ueCapabilityEnquiry\n"); break; case LTE_DL_DCCH_MessageType__c1_PR_counterCheck: #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) @@ -499,10 +499,10 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, #endif break; case LTE_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9: - LOG_I(DU_F1AP, "Received ueInformationRequest_r9\n"); + LOG_I(F1AP, "Received ueInformationRequest_r9\n"); break; case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionResume_r13: - LOG_I(DU_F1AP, "Received rrcConnectionResume_r13\n"); + LOG_I(F1AP, "Received rrcConnectionResume_r13\n"); } } } @@ -510,7 +510,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } - LOG_I(DU_F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id); + LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id); rlc_op_status_t rlc_status; boolean_t ret = TRUE; mem_block_t *pdcp_pdu_p = NULL; @@ -543,27 +543,27 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ); switch (rlc_status) { case RLC_OP_STATUS_OK: - //LOG_I(DU_F1AP, "Data sending request over RLC succeeded!\n"); + //LOG_I(F1AP, "Data sending request over RLC succeeded!\n"); ret=TRUE; break; case RLC_OP_STATUS_BAD_PARAMETER: - LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); ret= FALSE; break; case RLC_OP_STATUS_INTERNAL_ERROR: - LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); ret= FALSE; break; case RLC_OP_STATUS_OUT_OF_RESSOURCES: - LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); ret= FALSE; break; default: - LOG_W(DU_F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); ret= FALSE; break; } // switch case @@ -592,7 +592,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, uint32_t len; - LOG_I(DU_F1AP,"[DU %d] %s: size %d UE RNTI %x in SRB %d\n", + LOG_I(F1AP, "[DU %d] %s: size %d UE RNTI %x in SRB %d\n", ctxt_pP->module_id, __func__, sdu_sizeP, rnti, rb_idP); /* Create */ @@ -661,10 +661,10 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, sdu_sizeP,0,0); if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) - LOG_E(DU_F1AP," Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); + LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); else - LOG_I(DU_F1AP, "Received message: present %d and c1 present %d\n", - ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1.present); + LOG_I(F1AP, "Received message: present %d and c1 present %d\n", + ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1.present); if (ul_dcch_msg->message.present == LTE_UL_DCCH_MessageType_PR_c1) { @@ -685,31 +685,31 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, break; case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: - LOG_I(DU_F1AP,"[MSG] RRC UL rrcConnectionSetupComplete \n"); + LOG_I(F1AP, "[MSG] RRC UL rrcConnectionSetupComplete \n"); if(!ue_context_p){ - LOG_E(DU_F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", ctxt_pP->rnti); }else { - LOG_I(DU_F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti); + LOG_I(F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti); ue_context_p->ue_context.Status = RRC_CONNECTED; } break; case LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete: - LOG_I(DU_F1AP,"[MSG] RRC securityModeComplete \n"); + LOG_I(F1AP, "[MSG] RRC securityModeComplete \n"); break; case LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure: break; case LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - LOG_I(DU_F1AP,"[MSG] RRC ueCapabilityInformation \n"); + LOG_I(F1AP, "[MSG] RRC ueCapabilityInformation \n"); break; case LTE_UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: break; case LTE_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: - LOG_I(DU_F1AP,"[MSG] RRC UL Information Transfer \n"); + LOG_I(F1AP,"[MSG] RRC UL Information Transfer \n"); break; case LTE_UL_DCCH_MessageType__c1_PR_counterCheckResponse: @@ -739,7 +739,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, } /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -765,7 +765,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int f1ap_uid = f1ap_add_ue (&f1ap_du_inst[module_idP], module_idP, CC_idP,UE_id, rntiP); if (f1ap_uid < 0 ) { - LOG_E(DU_F1AP, "Failed to add UE \n"); + LOG_E(F1AP, "Failed to add UE \n"); return -1; } @@ -836,7 +836,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 95982c2ecc..5cd784abf2 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -/*! \file openair2/F1AP/DU_F1AP.c +/*! \file openair2/F1AP/f1ap_du_task.c * \brief data structures for F1 interface modules * \author EURECOM/NTUST * \date 2018 @@ -132,7 +132,7 @@ void *F1AP_DU_task(void *arg) { MessageDef *received_msg = NULL; int result; - LOG_I(DU_F1AP, "Starting F1AP at DU\n"); + LOG_I(F1AP, "Starting F1AP at DU\n"); //f1ap_eNB_prepare_internal_data(); @@ -153,7 +153,7 @@ void *F1AP_DU_task(void *arg) { // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req - LOG_I(DU_F1AP, "DU Task Received F1AP_SETUP_REQ\n"); + LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n"); du_task_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg)); break; @@ -161,39 +161,39 @@ void *F1AP_DU_task(void *arg) { case SCTP_NEW_ASSOCIATION_RESP: // 1. store the respon // 2. send the f1setup_req - LOG_I(DU_F1AP, "DU Task Received SCTP_NEW_ASSOCIATION_RESP\n"); + LOG_I(F1AP, "DU Task Received SCTP_NEW_ASSOCIATION_RESP\n"); du_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here - LOG_I(DU_F1AP, "DU Task Received SCTP_DATA_IND\n"); + LOG_I(F1AP, "DU Task Received SCTP_DATA_IND\n"); du_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_UL_RRC_MESSAGE: // from rrc - LOG_I(DU_F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); + LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); AssertFatal (1 == 0, "Should not be here!\n" ); //DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), // &F1AP_UL_RRC_MESSAGE(received_msg)); break; case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC - LOG_I(DU_F1AP, "DU Task Received F1AP_UE_CONTEXT_RELEASE_REQ\n"); + LOG_I(F1AP, "DU Task Received F1AP_UE_CONTEXT_RELEASE_REQ\n"); DU_send_UE_CONTEXT_RELEASE_REQUEST(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_UE_CONTEXT_RELEASE_REQ(received_msg)); break; case TERMINATE_MESSAGE: - LOG_W(DU_F1AP, " *** Exiting DU_F1AP thread\n"); + LOG_W(F1AP, " *** Exiting F1AP thread\n"); itti_exit_task(); break; default: - LOG_E(DU_F1AP, "DU Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + LOG_E(F1AP, "DU Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); break; } // switch result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); diff --git a/openair2/F1AP/f1ap_du_task.h b/openair2/F1AP/f1ap_du_task.h index 47d0827809..2d5195baed 100644 --- a/openair2/F1AP/f1ap_du_task.h +++ b/openair2/F1AP/f1ap_du_task.h @@ -19,12 +19,12 @@ * contact@openairinterface.org */ -#ifndef DU_F1AP_TASK_H_ -#define DU_F1AP_TASK_H_ +#ifndef F1AP_DU_TASK_H_ +#define F1AP_DU_TASK_H_ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req); void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind); void *F1AP_DU_task(void *arg); -#endif /* DU_F1AP_TASK_H_ */ +#endif /* F1AP_DU_TASK_H_ */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 3f12bf9505..4af453e4e4 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -547,7 +547,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -631,7 +631,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 context release request\n"); + LOG_E(F1AP, "Failed to encode F1 context release request\n"); return -1; } @@ -712,16 +712,16 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, case RLC_OP_STATUS_OK: break; case RLC_OP_STATUS_BAD_PARAMETER: - LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); break; case RLC_OP_STATUS_INTERNAL_ERROR: - LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); break; case RLC_OP_STATUS_OUT_OF_RESSOURCES: - LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); break; default: - LOG_W(DU_F1AP, "RLC returned an unknown status code after DU_F1AP placed " + LOG_W(F1AP, "RLC returned an unknown status code after F1AP placed " "the order to send some data (Status Code:%d)\n", rlc_status); break; } @@ -740,7 +740,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, else rrc_release_info.RRC_release_ctrl[release_num].flag = 2; rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; - LOG_W(DU_F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); + LOG_D(F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); // TODO: how to provide the correct MUI? rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; rrc_release_info.num_UEs++; @@ -755,7 +755,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, /* UE exists and is out of sync, drop the connection */ mac_eNB_rrc_ul_failure(instance, 0, 0, 0, rnti); } else { - LOG_E(DU_F1AP, "no ue_context for RNTI %x, acknowledging release\n", rnti); + LOG_E(F1AP, "no ue_context for RNTI %x, acknowledging release\n", rnti); } /* TODO send this once the connection has really been released */ @@ -861,7 +861,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, uint8_t *buffer; uint32_t len; if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 context release complete\n"); + LOG_E(F1AP, "Failed to encode F1 context release complete\n"); return -1; } @@ -1267,7 +1267,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); + LOG_E(F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index f0624ef4d8..e448690139 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -93,8 +93,6 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) *length = encoded; - /* Is the following needed? I moved the code here from CU_F1AP.c/DU_F1AP.c */ - // ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu); return encoded; } -- GitLab From a4d909bca81fad5fb41ceba9b1f22189ffb68aa2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 22 Feb 2019 10:51:40 +0100 Subject: [PATCH 231/308] Initialize variables to prevent illegal free() --- openair2/ENB_APP/flexran_agent_handler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 84ccb54068..e5782b5903 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -90,7 +90,8 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size){ - Protocol__FlexranMessage *decoded_message, *reply_message; + Protocol__FlexranMessage *decoded_message = NULL; + Protocol__FlexranMessage *reply_message = NULL; err_code_t err_code; DevAssert(data != NULL); -- GitLab From bd36a9ef0ca6c614985f27e4aab6373e8215c582 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 22 Feb 2019 11:23:58 +0100 Subject: [PATCH 232/308] Gracefully handle different numbers of UE in MAC and RRC --- openair2/ENB_APP/flexran_agent_common.c | 8 +++++--- openair2/ENB_APP/flexran_agent_handler.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index e2780073f6..539c7f2a5c 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -593,9 +593,11 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id) && flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) { - LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC (%d) and MAC (%d)\n", - flexran_get_rrc_num_ues(mod_id), flexran_get_mac_num_ues(mod_id)); - goto error; + const int nrrc = flexran_get_rrc_num_ues(mod_id); + const int nmac = flexran_get_mac_num_ues(mod_id); + ue_config_reply_msg->n_ue_config = nrrc < nmac ? nrrc : nmac; + LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %lu UEs\n", + __func__, nrrc, nmac, ue_config_reply_msg->n_ue_config); } Protocol__FlexUeConfig **ue_config; diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index e5782b5903..9ffb1e6cec 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -250,9 +250,11 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id) && flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) { - LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC (%d) and MAC (%d)\n", - flexran_get_rrc_num_ues(mod_id), flexran_get_mac_num_ues(mod_id)); - goto error; + const int nrrc = flexran_get_rrc_num_ues(mod_id); + const int nmac = flexran_get_mac_num_ues(mod_id); + report_config.nr_ue = nrrc < nmac ? nrrc : nmac; + LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %d UEs\n", + __func__, nrrc, nmac, report_config.nr_ue); } report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue); if (report_config.ue_report_type == NULL) { -- GitLab From c75fd52e3a789090055a71f0f1f361a44c64c994 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 22 Feb 2019 15:21:49 +0100 Subject: [PATCH 233/308] Remove many warnings --- common/utils/backtrace.h | 2 +- openair2/ENB_APP/enb_app.c | 6 +++--- openair2/ENB_APP/enb_config.h | 3 +++ openair2/F1AP/f1ap_du_interface_management.c | 8 ++++---- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 18 ++++++++++++------ openair2/F1AP/f1ap_du_task.c | 1 + openair2/LAYER2/RLC/rlc.c | 4 +++- openair2/RRC/LTE/L2_interface.c | 5 +++-- openair2/RRC/LTE/rrc_eNB.c | 2 +- openair2/RRC/LTE/rrc_proto.h | 2 +- 10 files changed, 32 insertions(+), 19 deletions(-) diff --git a/common/utils/backtrace.h b/common/utils/backtrace.h index b4620b6bed..9a77767cf4 100644 --- a/common/utils/backtrace.h +++ b/common/utils/backtrace.h @@ -24,7 +24,7 @@ #ifndef BACKTRACE_H_ #define BACKTRACE_H_ -void display_backtrace(); +void display_backtrace(void); void backtrace_handle_signal(siginfo_t *info); diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 3ef96d63b1..5daaba9621 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -34,6 +34,7 @@ #include "enb_config.h" #include "assertions.h" #include "common/ran_context.h" +#include "targets/RT/USER/lte-softmodem.h" #include "common/utils/LOG/log.h" @@ -145,8 +146,8 @@ void *eNB_app_task(void *args_p) uint32_t registered_enb; long enb_register_retry_timer_id; # endif - uint32_t x2_register_enb_pending; - uint32_t x2_registered_enb; + uint32_t x2_register_enb_pending = 0; + uint32_t x2_registered_enb = 0; long x2_enb_register_retry_timer_id; MessageDef *msg_p = NULL; instance_t instance; @@ -168,7 +169,6 @@ void *eNB_app_task(void *args_p) #endif /* Try to register each eNB with each other */ - // x2_registered_enb = 0; if (RC.rrc[0]->node_type == ngran_eNB) { // CU or DU do not need x2_register_enb_pending = eNB_app_register_x2 (enb_id_start, enb_id_end); } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index d1aece8b4c..a204a47652 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -121,5 +121,8 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i); void fill_SL_configuration(MessageDef *msg_p, ccparams_sidelink_t *SLconfig,int cell_idx,int cc_idx,char *config_fname); void fill_eMTC_configuration(MessageDef *msg_p, ccparams_eMTC_t *eMTCconfig, int cell_idx,int cc_idx,char *config_fname,char *brparamspath); +int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i); +void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp); + #endif /* ENB_CONFIG_H_ */ /** @} */ diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 8f738cf066..5b3fc4addd 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -479,7 +479,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); for (int i=0;i<num_cells_to_activate;i++) { - F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = ie->value.choice.Cells_to_be_Activated_List.list.array[i]; + F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *) ie->value.choice.Cells_to_be_Activated_List.list.array[i]; AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item, "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); @@ -502,7 +502,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, F1AP_SETUP_RESP (msg_p).nr_cellid[i]); F1AP_SETUP_RESP (msg_p).nrpci[i] = *cell->nRPCI; - F1AP_ProtocolExtensionContainer_160P9_t *ext = cell->iE_Extensions; + F1AP_ProtocolExtensionContainer_160P9_t *ext = (F1AP_ProtocolExtensionContainer_160P9_t *)cell->iE_Extensions; AssertFatal(ext!=NULL,"Extension for SI is null\n"); F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); @@ -634,7 +634,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - &f1ap_du_data->tac[i], + (const char *) &f1ap_du_data->tac[i], 3); /* - Configured_EPS_TAC */ @@ -800,7 +800,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - &f1ap_du_data->tac[i], + (const char *) &f1ap_du_data->tac[i], 3); /* - Configured_EPS_TAC */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 27add35f5f..4a71a291cc 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -228,7 +228,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // get SRB logical channel information LTE_SRB_ToAddModList_t *SRB_configList; LTE_SRB_ToAddMod_t *SRB1_config; - LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; SRB_configList = radioResourceConfigDedicated->srb_ToAddModList; AssertFatal(SRB_configList!=NULL,"SRB_configList is null\n"); @@ -273,6 +273,10 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; + LTE_MAC_MainConfig_t *mac_MainConfig = NULL; + if (radioResourceConfigDedicated->mac_MainConfig) + mac_MainConfig = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; + rrc_mac_config_req_eNB( ctxt.module_id, 0, //primaryCC_id, @@ -292,7 +296,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif (LTE_MeasObjectToAddMod_t **) NULL, - radioResourceConfigDedicated->mac_MainConfig, + mac_MainConfig, 1, SRB1_logicalChannelConfig, NULL, // measGapConfig, @@ -383,9 +387,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, LTE_DRB_ToAddModList_t *DRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToAddModList; LTE_SRB_ToAddModList_t *SRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->srb_ToAddModList; LTE_DRB_ToReleaseList_t *DRB_ReleaseList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToReleaseList; - LTE_MAC_MainConfig_t *mac_MainConfig = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig; + LTE_MAC_MainConfig_t *mac_MainConfig = NULL; + if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig) + mac_MainConfig = &rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; LTE_MeasGapConfig_t *measGapConfig = NULL; - struct LTE_PhysicalConfigDedicated** physicalConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->physicalConfigDedicated; + struct LTE_PhysicalConfigDedicated* physicalConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->physicalConfigDedicated; rrc_rlc_config_asn1_req( &ctxt, SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, @@ -643,7 +649,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sdu_pP, sdu_sizeP); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char *)sdu_pP, sdu_sizeP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); if (rb_idP == 1 || rb_idP == 2) { @@ -819,7 +825,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char *)sduP, sdu_lenP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 5cd784abf2..35c4ea35bb 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -33,6 +33,7 @@ #include "f1ap_common.h" #include "f1ap_handlers.h" #include "f1ap_du_interface_management.h" +#include "f1ap_du_ue_context_management.h" #include "f1ap_du_task.h" #include "proto_agent.h" diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 16e344555c..7aa1846675 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -618,11 +618,13 @@ void rlc_data_ind ( break; case ngran_eNB_DU: case ngran_gNB_DU: - if (srb_flagP == 1) + if (srb_flagP == 1) { + /* TODO do ITTI message */ DU_send_UL_RRC_MESSAGE_TRANSFER(ctxt_pP, rb_idP, sdu_sizeP, sdu_pP->data); + } else proto_agent_send_pdcp_data_ind ( ctxt_pP, diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 947a38c637..88b6eb5198 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -247,6 +247,7 @@ mac_rrc_data_ind( LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %d length %d for UE id %d RNTI %x \n", module_idP, srb_idP, sdu_lenP, UE_id, rntiP); + /* do ITTI message */ DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( module_idP, CC_id, @@ -258,7 +259,7 @@ mac_rrc_data_ind( return(0); } - SRB_INFO *Srb_info; + //SRB_INFO *Srb_info; protocol_ctxt_t ctxt; sdu_size_t sdu_size = 0; /* for no gcc warnings */ @@ -269,7 +270,7 @@ mac_rrc_data_ind( PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0); if((srb_idP & RAB_OFFSET) == CCCH) { - LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id); + LOG_D(RRC, "[eNB %d] Received SDU for CCCH on SRB %d\n", module_idP, srb_idP); /*Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0; #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ctxt.brOption = brOption; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 51f196eaf6..bdc588adff 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7042,7 +7042,7 @@ char openair_rrc_eNB_init( int rrc_eNB_decode_ccch( protocol_ctxt_t* const ctxt_pP, - uint8_t *buffer, + const uint8_t *buffer, int buffer_length, const int CC_id ) diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index b9277b59a3..88da94bc23 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -224,7 +224,7 @@ uint8_t rrc_eNB_get_next_transaction_identifier(module_id_t module_idP); \param CC_id component carrier index*/ int rrc_eNB_decode_ccch(protocol_ctxt_t* const ctxt_pP, - uint8_t *buffer, + const uint8_t *buffer, int buffer_length, const int CC_id ); -- GitLab From 549e72d001d2642479cb17902f4e7b9477ff02e6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 22 Feb 2019 16:11:04 +0100 Subject: [PATCH 234/308] Trigger UL RRC Message through ITTI Message --- openair2/COMMON/f1ap_messages_types.h | 4 +-- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 34 ++++++++------------ openair2/F1AP/f1ap_du_rrc_message_transfer.h | 10 ++---- openair2/F1AP/f1ap_du_task.c | 6 ++-- openair2/LAYER2/RLC/rlc.c | 11 ++++--- 5 files changed, 25 insertions(+), 40 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 6afd3f6dfa..d83f9cb71d 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -248,10 +248,8 @@ typedef struct f1ap_initial_ul_rrc_message_s { } f1ap_initial_ul_rrc_message_t; typedef struct f1ap_ul_rrc_message_s { - uint32_t gNB_CU_ue_id; - uint32_t gNB_DU_ue_id; uint16_t rnti; - uint8_t srb_id; + uint8_t srb_id; uint8_t *rrc_container; int rrc_container_length; } f1ap_ul_rrc_message_t; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 4a71a291cc..49bf9ee261 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -581,25 +581,19 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } -int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - const uint8_t *sdu_pP - ) { - - - rnti_t rnti = ctxt_pP->rnti; +int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg) { + const rnti_t rnti = msg->rnti; F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; F1AP_ULRRCMessageTransferIEs_t *ie; - uint8_t *buffer; - uint32_t len; + uint8_t *buffer = NULL; + uint32_t len; LOG_I(F1AP, "[DU %d] %s: size %d UE RNTI %x in SRB %d\n", - ctxt_pP->module_id, __func__, sdu_sizeP, rnti, rb_idP); + instance, __func__, msg->rrc_container_length, rnti, msg->srb_id); /* Create */ /* 0. Message Type */ @@ -618,8 +612,6 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - instance_t instance = ctxt_pP->module_id; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -639,7 +631,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_SRBID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = rb_idP; + ie->value.choice.SRBID = msg->srb_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); // issue in here @@ -649,13 +641,13 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char *)sdu_pP, sdu_sizeP); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, + (const char *) msg->rrc_container, + msg->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - if (rb_idP == 1 || rb_idP == 2) { - struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - rnti); + if (msg->srb_id == 1 || msg->srb_id == 2) { + struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); LTE_UL_DCCH_Message_t* ul_dcch_msg=NULL; @@ -664,7 +656,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, &asn_DEF_LTE_UL_DCCH_Message, (void**)&ul_dcch_msg, &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header - sdu_sizeP,0,0); + msg->rrc_container_length, 0, 0); if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); @@ -693,7 +685,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP, case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: LOG_I(F1AP, "[MSG] RRC UL rrcConnectionSetupComplete \n"); if(!ue_context_p){ - LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", rnti); }else { LOG_I(F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti); ue_context_p->ue_context.Status = RRC_CONNECTED; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 3ec4762932..6ffc3914fe 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -39,14 +39,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_p, - const rb_id_t rb_id, - const sdu_size_t sdu_size, - const uint8_t *sdu_p); -/* - instance_t instance, - f1ap_ul_rrc_message_t *f1ap_ul_rrc); -*/ +int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); + int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, int UE_id, diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 35c4ea35bb..d287e1e5bf 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -34,6 +34,7 @@ #include "f1ap_handlers.h" #include "f1ap_du_interface_management.h" #include "f1ap_du_ue_context_management.h" +#include "f1ap_du_rrc_message_transfer.h" #include "f1ap_du_task.h" #include "proto_agent.h" @@ -176,9 +177,8 @@ void *F1AP_DU_task(void *arg) { case F1AP_UL_RRC_MESSAGE: // from rrc LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); - AssertFatal (1 == 0, "Should not be here!\n" ); - //DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), - // &F1AP_UL_RRC_MESSAGE(received_msg)); + DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_UL_RRC_MESSAGE(received_msg)); break; case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 7aa1846675..ee299740e2 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -619,11 +619,12 @@ void rlc_data_ind ( case ngran_eNB_DU: case ngran_gNB_DU: if (srb_flagP == 1) { - /* TODO do ITTI message */ - DU_send_UL_RRC_MESSAGE_TRANSFER(ctxt_pP, - rb_idP, - sdu_sizeP, - sdu_pP->data); + MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); + F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti; + F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_idP; + F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data; + F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = sdu_sizeP; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); } else proto_agent_send_pdcp_data_ind ( -- GitLab From eab78405cc068867a2728a7ad53ac3fa144ba4bc Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 22 Feb 2019 18:33:12 +0100 Subject: [PATCH 235/308] Log received F1 messages correctly --- openair2/F1AP/f1ap_decoder.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index b26c943292..7bd5359e29 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -46,22 +46,22 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) case F1AP_ProcedureCode_id_F1Setup: //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__); break; case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_InitialULRRCMessageTransfer\n", __func__); break; case F1AP_ProcedureCode_id_DLRRCMessageTransfer: //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_DLRRCMessageTransfer\n", __func__); break; case F1AP_ProcedureCode_id_ULRRCMessageTransfer: //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_ULRRCMessageTransfer\n", __func__); break; case F1AP_ProcedureCode_id_UEContextRelease: LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__); @@ -121,7 +121,7 @@ static int f1ap_decode_unsuccessful_outcome(F1AP_F1AP_PDU_t *pdu) switch(pdu->choice.unsuccessfulOutcome->procedureCode) { case F1AP_ProcedureCode_id_F1Setup: - LOG_I(F1AP, "get F1AP_ProcedureCode_id_F1Setup\n"); + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__); break; default: -- GitLab From 80b62452130ae8bdadec3b5afa2d91da1d7a754e Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 22 Feb 2019 18:33:54 +0100 Subject: [PATCH 236/308] Remove comments left after merge --- openair2/RRC/LTE/rrc_eNB.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index bdc588adff..0901c826bc 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7364,13 +7364,12 @@ rrc_eNB_decode_ccch( ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); - // TODO MERGE - //ue_context_p->ue_context.Srb0.Srb_id=0; - //ue_context_p->ue_context.Srb0.Active=1; - //memcpy(ue_context_p->ue_context.Srb0.Rx_buffer.Payload, - // buffer, - // buffer_length); - //ue_context_p->ue_context.Srb0.Rx_buffer.payload_size=buffer_length; + ue_context_p->ue_context.Srb0.Srb_id = 0; + ue_context_p->ue_context.Srb0.Active = 1; + memcpy(ue_context_p->ue_context.Srb0.Rx_buffer.Payload, + buffer, + buffer_length); + ue_context_p->ue_context.Srb0.Rx_buffer.payload_size = buffer_length; } else if (LTE_InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { /* Save s-TMSI */ @@ -7992,7 +7991,6 @@ rrc_eNB_decode_dcch( if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. present == LTE_RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - /* TODO MERGE: test, was if with empty DU clause */ AssertFatal(RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU && RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU, "should not be reached in DU\n"); rrc_eNB_process_RRCConnectionSetupComplete( -- GitLab From cc2a507d59b033844d4b31dc1def28394626b1cb Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 25 Feb 2019 16:23:42 +0100 Subject: [PATCH 237/308] Unify and comment RRC container print of F1 --- openair2/ENB_APP/enb_config.c | 7 +++-- openair2/F1AP/f1ap_cu_interface_management.c | 10 +++---- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 24 ++++++++++++---- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 29 ++++++++++++-------- openair2/RRC/LTE/rrc_eNB.c | 7 +++-- 5 files changed, 48 insertions(+), 29 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index df1c065ba8..3fa3df041a 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2652,9 +2652,10 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { resp->nrpci[j] == carrier->physCellId)) { // copy system information and decode it for (si_ind=0;si_ind<resp->num_SI[j];si_ind++) { - printf("SI %d: ",si_ind); - for (int n=0;n<resp->SI_container_length[j][si_ind];n++) printf("%2x ",resp->SI_container[j][si_ind][n]); - printf("\n"); + //printf("SI %d size %d: ", si_ind, resp->SI_container_length[j][si_ind]); + //for (int n=0;n<resp->SI_container_length[j][si_ind];n++) + // printf("%02x ",resp->SI_container[j][si_ind][n]); + //printf("\n"); extract_and_decode_SI(i, si_ind, resp->SI_container[j][si_ind], diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index a414c27383..b451a01457 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -350,12 +350,10 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); -#ifdef F1AP_DEBUG - LOG_I(F1AP, "SI %d: ", i); - for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) - printf("%2x ", f1ap_setup_resp->SI_container[i][0][n]); - printf("\n"); -#endif + //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); + //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) + // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); + //printf("\n"); OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, (const char*)f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index fc104b266a..f32d5c8ed0 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -121,12 +121,13 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); - #ifdef F1AP_DEBUG - LOG_I(F1AP, "RRCContainer (CCCH):"); - for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) - printf("%2x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - printf("\n"); -#endif + + //LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, + // ie->value.choice.RRCContainer.size); + //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + // printf("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + //printf("\n"); + // Find instance from nr_cellid int rrc_inst = -1; for (int i=0;i<RC.nb_inst;i++) { @@ -250,6 +251,11 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + //LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, f1ap_dl_rrc->rrc_container_length); + //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + // printf("%02x ", f1ap_dl_rrc->rrc_container[i]); + //printf("\n"); + /* optional */ /* c7. RAT_FrequencyPriorityInformation */ /* TODO */ @@ -366,6 +372,12 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); + + //LOG_I(F1AP, "%s() RRCContainer size %lu: ", __func__, ie->value.choice.RRCContainer.size); + //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + // printf("%02x ", mb->data[i]); + //printf("\n"); + pdcp_data_ind (&ctxt, 1, // srb_flag 0, // embms_flag diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 49bf9ee261..be04a60cbf 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -147,9 +147,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; // memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, // ccch_sdu_len); - printf ("RRCContainer :"); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",ie->value.choice.RRCContainer.buf[i]); - printf("\n"); + + //LOG_I(F1AP, "%s() RRCContainer size %lu: ", __func__, ie->value.choice.RRCContainer.size); + //for (int i = 0;i < ie->value.choice.RRCContainer.size; i++) + // printf("%02x ", ie->value.choice.RRCContainer.buf[i]); + //printf("\n"); /* optional */ /* RAT_FrequencyPriorityInformation */ @@ -523,15 +525,15 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); -#ifdef DEBUG_MSG - printf ("PRRCContainer size %d:", ie->value.choice.RRCContainer.size); - for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",ie->value.choice.RRCContainer.buf[i]); - printf("\n"); - printf ("PDCP PDU size %d:", rrc_dl_sdu_len); - for (int i=0;i<rrc_dl_sdu_len;i++) printf("%2x ",pdcp_pdu_p->data[i]); - printf("\n"); -#endif + //LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size); + //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + // printf("%02x ", ie->value.choice.RRCContainer.buf[i]); + + //printf (", PDCP PDU size %d:", rrc_dl_sdu_len); + //for (int i=0;i<rrc_dl_sdu_len;i++) printf("%2x ",pdcp_pdu_p->data[i]); + //printf("\n"); + if (pdcp_pdu_p != NULL) { rlc_status = rlc_data_req(&ctxt @@ -595,6 +597,11 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_messa LOG_I(F1AP, "[DU %d] %s: size %d UE RNTI %x in SRB %d\n", instance, __func__, msg->rrc_container_length, rnti, msg->srb_id); + //LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, msg->rrc_container_length); + //for (int i = 0;i < msg->rrc_container_length; i++) + // printf("%02x ", msg->rrc_container[i]); + //printf("\n"); + /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 0901c826bc..cfe86fa4ae 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -8420,9 +8420,10 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { if (rrc->carrier[0].SIB23) { F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23; F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23; - printf("SI %d: ",0); - for (int n=0;n<F1AP_SETUP_RESP (msg_p).SI_container_length[j][num_SI];n++) printf("%2x ",F1AP_SETUP_RESP (msg_p).SI_container[0][num_SI][n]); - printf("\n"); + //printf("SI %d size %d: ", 0, F1AP_SETUP_RESP(msg_p).SI_container_length[j][num_SI]); + //for (int n = 0; n < F1AP_SETUP_RESP(msg_p).SI_container_length[j][num_SI]; n++) + // printf("%02x ", F1AP_SETUP_RESP(msg_p).SI_container[0][num_SI][n]); + //printf("\n"); num_SI++; } F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI; -- GitLab From 97126eb57e06896d7734fa8663f9123e122e93f5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Mon, 25 Feb 2019 16:33:02 +0100 Subject: [PATCH 238/308] Fix carrierFreq MeasObj calculation to handle F1 case --- openair2/RRC/LTE/rrc_eNB.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index cfe86fa4ae..efa18b9d25 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3101,8 +3101,10 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *cons memset((void *)MeasObj, 0, sizeof(*MeasObj)); MeasObj->measObjectId = 1; MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA; - MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = (LTE_ARFCN_ValueEUTRA_t)to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->carrier[0].eutra_band, RC.rrc[ctxt_pP->module_id]->carrier[0].dl_CarrierFreq, - RC.rrc[ctxt_pP->module_id]->carrier[0].N_RB_DL); + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = + to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0], + RC.rrc[ctxt_pP->module_id]->configuration.downlink_frequency[0], + RC.rrc[ctxt_pP->module_id]->configuration.N_RB_DL[0]); MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25; MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); @@ -5070,8 +5072,10 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct memset((void *)MeasObj, 0, sizeof(*MeasObj)); MeasObj->measObjectId = 1; MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA; - MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = (LTE_ARFCN_ValueEUTRA_t)to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->carrier[0].eutra_band, RC.rrc[ctxt_pP->module_id]->carrier[0].dl_CarrierFreq, - RC.rrc[ctxt_pP->module_id]->carrier[0].N_RB_DL); + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = + to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0], + RC.rrc[ctxt_pP->module_id]->configuration.downlink_frequency[0], + RC.rrc[ctxt_pP->module_id]->configuration.N_RB_DL[0]); MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25; MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); @@ -5299,8 +5303,10 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.ul_CyclicPrefixLength; //End of configuration of radioResourceConfigCommon mobilityInfo->carrierFreq = CALLOC(1, sizeof(*mobilityInfo->carrierFreq)); //CALLOC(1,sizeof(CarrierFreqEUTRA_t)); 36090 - mobilityInfo->carrierFreq->dl_CarrierFreq = (LTE_ARFCN_ValueEUTRA_t)to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->carrier[0].eutra_band, RC.rrc[ctxt_pP->module_id]->carrier[0].dl_CarrierFreq, - RC.rrc[ctxt_pP->module_id]->carrier[0].N_RB_DL); + mobilityInfo->carrierFreq->dl_CarrierFreq = + to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0], + RC.rrc[ctxt_pP->module_id]->configuration.downlink_frequency[0], + RC.rrc[ctxt_pP->module_id]->configuration.N_RB_DL[0]); mobilityInfo->carrierFreq->ul_CarrierFreq = NULL; mobilityInfo->carrierBandwidth = CALLOC(1, sizeof( *mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA)); AllowedMeasBandwidth_mbw25 -- GitLab From 1e3d0c9a16b28efc67b1a55b274850c0a49b11c5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 27 Feb 2019 15:31:52 +0100 Subject: [PATCH 239/308] Update F1 CU/DU configuration (tested, formatted) --- .../PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf | 326 ++++++++++-------- .../CONF/du.lte.band7.10MHz.if4p5.conf | 157 +++++---- 2 files changed, 257 insertions(+), 226 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf index 035add8b31..38d3f5eac9 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf @@ -2,30 +2,26 @@ Active_eNBs = ( "eNB-CU-Eurecom-LTEBox"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -eNBs = -( - { +eNBs = ( + { ////////// Identification parameters: - eNB_ID = 0xe00; + eNB_ID = 0xe00; - cell_type = "CELL_MACRO_ENB"; + cell_type = "CELL_MACRO_ENB"; - eNB_name = "eNB-CU-Eurecom-LTEBox"; + eNB_name = "eNB-CU-Eurecom-LTEBox"; // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; + tracking_area_code = 1; + plmn_list = ( { mcc = 208; mnc = 95; mnc_length = 2; } ) - mobile_country_code = "208"; + nr_cellid = 12345678L - mobile_network_code = "93"; - - nr_cellid = 12345678L - - tr_s_preference = "f1" + tr_s_preference = "f1" local_s_if_name = "lo"; - remote_s_address = "127.0.0.3"; - local_s_address = "127.0.0.4"; + remote_s_address = "192.168.12.4"; + local_s_address = "192.168.12.45"; local_s_portc = 501; remote_s_portc = 500; local_s_portd = 601; @@ -35,165 +31,191 @@ eNBs = component_carriers = ( { - node_function = "3GPP_eNodeB"; - node_timing = "synch_to_ext_device"; - node_synch_ref = 0; - pbch_repetition = "FALSE"; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 0; - pucch_nCS_AN = 0; - pucch_n1_AN = 0; - pdsch_referenceSignalPower = -27; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 1; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -96; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -104; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; - - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; - /* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; - */ - rach_powerRampingStep = 4; - rach_preambleInitialReceivedTargetPower = -108; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; - - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - ue_TransmissionMode = 1; - - //Parameters for SIB18 - rxPool_sc_CP_Len = "normal"; - rxPool_sc_Period = "sf40"; - rxPool_data_CP_Len = "normal"; - rxPool_ResourceConfig_prb_Num = 20; - rxPool_ResourceConfig_prb_Start = 5; - rxPool_ResourceConfig_prb_End = 44; - rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; - rxPool_ResourceConfig_offsetIndicator_choice = 0; - rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; - rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; - rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; - rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; -/* rxPool_dataHoppingConfig_hoppingParameter = 0; - rxPool_dataHoppingConfig_numSubbands = "ns1"; - rxPool_dataHoppingConfig_rbOffset = 0; - rxPool_commTxResourceUC-ReqAllowed = "TRUE"; -*/ - // Parameters for SIB19 - discRxPool_cp_Len = "normal" - discRxPool_discPeriod = "rf32" - discRxPool_numRetx = 1; - discRxPool_numRepetition = 2; - discRxPool_ResourceConfig_prb_Num = 5; - discRxPool_ResourceConfig_prb_Start = 3; - discRxPool_ResourceConfig_prb_End = 21; - discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; - discRxPool_ResourceConfig_offsetIndicator_choice = 0; - discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; - discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; - discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; - discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; - + node_function = "3GPP_eNodeB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2665000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -27; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnable = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* + srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =; + */ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff= 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + /* + rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; + */ + + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; } ); srb1_parameters : { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] - timer_poll_retransmit = 80; + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; - # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] - timer_reordering = 35; + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; - # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] - timer_status_prohibit = 0; + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; - # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] - poll_pdu = 4; + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; - # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] - poll_byte = 99999; + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; - # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] - max_retx_threshold = 4; + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; } # ------- SCTP definitions SCTP : { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "127.0.0.3"; - ipv6 = "192:168:30::17"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { + mme_ip_address = ( + { + ipv4 = "127.0.1.10"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); - ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; - ENB_INTERFACE_NAME_FOR_S1U = "lo"; - ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 + NETWORK_INTERFACES : { + ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.1.30/24"; + ENB_INTERFACE_NAME_FOR_S1U = "lo"; + ENB_IPV4_ADDRESS_FOR_S1U = "127.0.1.30/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "127.0.1.30/24"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } ); -log_config = - { - global_log_level ="info"; - global_log_verbosity ="medium"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; +log_config = { + global_log_level = "info"; + global_log_verbosity = "medium"; + pdcp_log_level = "info"; + pdcp_log_verbosity = "high"; + rrc_log_level = "info"; + rrc_log_verbosity = "medium"; + flexran_agent_log_level = "info"; + flexran_agent_log_verbosity = "medium"; + gtp_log_level = "info"; + gtp_log_verbosity = "medium"; +}; + +NETWORK_CONTROLLER : { + FLEXRAN_ENABLED = "yes"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf index 1956259fdc..8e786be5e9 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf @@ -4,43 +4,46 @@ Asn1_verbosity = "none"; eNBs = ( - { + { ////////// Identification parameters: - eNB_CU_ID = 0xe00; + eNB_CU_ID = 0xe00; - eNB_name = "eNB-Eurecom-DU"; + eNB_name = "eNB-Eurecom-DU"; // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; + tracking_area_code = 1; + plmn_list = ( { mcc = 208; mnc = 95; mnc_length = 2; } ) - mobile_country_code = "208"; + nr_cellid = 12345678L - mobile_network_code = "93"; - - nr_cellid = 12345678L - ////////// Physical parameters: component_carriers = ( { - node_function = "3GPP_eNODEB"; - node_timing = "synch_to_ext_device"; - node_synch_ref = 0; - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2685000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 50; - Nid_cell_mbsfn = 0; - nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; + node_function = "3GPP_eNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2665000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; } ); @@ -48,63 +51,69 @@ eNBs = # ------- SCTP definitions SCTP : { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; }; } ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "f1"; - local_n_if_name = "lo"; - remote_n_address = "127.0.0.4"; - local_n_address = "127.0.0.3"; - local_n_portc = 500; - remote_n_portc = 501; - local_n_portd = 600; - remote_n_portd = 601; - } + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "f1"; + local_n_if_name = "lo"; + remote_n_address = "127.0.0.4"; + local_n_address = "127.0.0.3"; + local_n_portc = 500; + remote_n_portc = 501; + local_n_portd = 600; + remote_n_portd = 601; + } ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - } + { + num_cc = 1; + tr_n_preference = "local_mac"; + } ); RUs = ( - { - local_if_name = "enp4s0f1"; - local_address = "127.0.0.1"; - remote_address = "127.0.0.2"; - local_portc = 50000; - remote_portc = 50000; - local_portd = 50001; - remote_portd = 50001; - local_rf = "no" - tr_preference = "udp_if4p5" - nb_tx = 1 - nb_rx = 1 - att_tx = 0 - att_rx = 0; - eNB_instances = [0]; - } -); + { + local_rf = "yes"; + nb_tx = 1; + nb_rx = 1; + att_tx = 10; + att_rx = 10; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 125; + eNB_instances = [0]; + } +); + +log_config = { + global_log_level = "info"; + global_log_verbosity = "medium"; + hw_log_level = "info"; + hw_log_verbosity = "medium"; + phy_log_level = "info"; + phy_log_verbosity = "medium"; + mac_log_level = "info"; + mac_log_verbosity = "high"; + rlc_log_level = "info"; + rlc_log_verbosity = "medium"; + flexran_agent_log_level = "info"; + flexran_agent_log_verbosity = "medium"; +}; -log_config = { - global_log_level ="info"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="info"; - phy_log_verbosity ="medium"; - mac_log_level ="info"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_log_verbosity ="medium"; +NETWORK_CONTROLLER : { + FLEXRAN_ENABLED = "yes"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; }; -- GitLab From 56af9c60e4464bfcc6dafda21721d728c29e4443 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 5 Mar 2019 16:48:51 +0100 Subject: [PATCH 240/308] Fix compilation/linking errors in lte-uesoftmodem --- openair1/SCHED_UE/phy_procedures_lte_ue.c | 3 ++- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 4 ---- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 16 ++++++++++------ openair2/LAYER2/RLC/rlc.c | 2 ++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 8ceda675e8..807c79e6e0 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -73,7 +73,6 @@ extern double cpuf; - void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); @@ -2628,6 +2627,8 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint // we received a CRNTI, so we're in PUSCH if (ue->UE_mode[eNB_id] != PUSCH) { if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti); + } //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); ue->UE_mode[eNB_id] = PUSCH; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index be04a60cbf..a5aa5da569 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -66,7 +66,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { -#ifndef UETARGET LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); F1AP_DLRRCMessageTransfer_t *container; @@ -578,7 +577,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return ret; } // if pdcp_pdu_p -#endif return 0; } @@ -760,7 +758,6 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, rnti_t rntiP, uint8_t *sduP, sdu_size_t sdu_lenP) { -#ifndef UETARGET F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransferIEs_t *ie; @@ -853,7 +850,6 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ue_context_p->ue_context.Srb0.Active = 1; RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); -#endif return 0; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 435793adfa..d0fdc0197f 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -60,7 +60,9 @@ # include "gtpv1u.h" #include "ENB_APP/enb_config.h" +#ifndef UETARGET #include "LAYER2/PROTO_AGENT/proto_agent.h" +#endif extern int otg_enabled; extern uint8_t nfapi_mode; @@ -188,6 +190,7 @@ boolean_t pdcp_data_req( sdu_buffer_sizeP); LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP); } +#ifndef UETARGET if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { @@ -197,7 +200,9 @@ boolean_t pdcp_data_req( /* assume good status */ rlc_status = RLC_OP_STATUS_OK; - } else { + } else +#endif + { rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p ,NULL, NULL @@ -368,6 +373,7 @@ boolean_t pdcp_data_req( LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); +#ifndef UETARGET if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { @@ -384,9 +390,9 @@ boolean_t pdcp_data_req( || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU){ LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type); ret=FALSE; - } - else { - + } else +#endif + { rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p, sourceL2Id, destinationL2Id @@ -418,8 +424,6 @@ boolean_t pdcp_data_req( break; } // switch case } /* end if node_type is CU */ - - rlc_status = ack_result; } else // SRB { diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index b57522658d..7d431fcf20 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -625,6 +625,7 @@ void rlc_data_ind ( F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = sdu_sizeP; itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); } +#ifndef UETARGET else proto_agent_send_pdcp_data_ind ( ctxt_pP, @@ -633,6 +634,7 @@ void rlc_data_ind ( rb_idP, sdu_sizeP, sdu_pP); +#endif break; -- GitLab From 66d4c4e92d9fc8fa6c602850ee7d379c008b51a6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 6 Mar 2019 13:43:09 +0100 Subject: [PATCH 241/308] Fix cppcheck issues in PROTO_AGENT --- openair2/LAYER2/PROTO_AGENT/cu_test.c | 3 ++- openair2/LAYER2/PROTO_AGENT/du_test.c | 3 ++- openair2/LAYER2/PROTO_AGENT/proto_agent_common.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/cu_test.c b/openair2/LAYER2/PROTO_AGENT/cu_test.c index 2827b9c9a0..78467d68f0 100644 --- a/openair2/LAYER2/PROTO_AGENT/cu_test.c +++ b/openair2/LAYER2/PROTO_AGENT/cu_test.c @@ -83,6 +83,7 @@ int main(int argc, char *argv[]) pool_buffer_init(); if (proto_agent_start(0, ¶ms) != 0) { fprintf(stderr, "error on proto_agent_start()\n"); + fclose(f); return 3; } atexit(close_proto_agent); @@ -102,7 +103,7 @@ int main(int argc, char *argv[]) gettimeofday(&t_end, NULL); fclose(f); long us = uelapsed(&t_start, &t_end); - fprintf(stderr, "read %ld bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", + fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", totsize, us / 1000, ((float) totsize ) / us, ((float) totsize) / us * 8); fprintf(stderr, "check files using 'diff afile bfile'\n"); diff --git a/openair2/LAYER2/PROTO_AGENT/du_test.c b/openair2/LAYER2/PROTO_AGENT/du_test.c index 7fa9971f5a..9ff7662ab1 100644 --- a/openair2/LAYER2/PROTO_AGENT/du_test.c +++ b/openair2/LAYER2/PROTO_AGENT/du_test.c @@ -84,6 +84,7 @@ int main(int argc, char *argv[]) pool_buffer_init(); if (proto_agent_start(0, ¶ms) != 0) { fprintf(stderr, "error on proto_agent_start()\n"); + fclose(f); return 3; } atexit(close_proto_agent); @@ -98,7 +99,7 @@ int main(int argc, char *argv[]) gettimeofday(&t_end, NULL); fclose(f); long us = uelapsed(&t_start, &t_end); - fprintf(stderr, "read %ld bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", + fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", totsize, us / 1000, ((float) totsize ) / us, ((float) totsize) / us * 8); fprintf(stderr, "check files using 'diff afile bfile'\n"); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 0efeabf7aa..4d3abfdab5 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -85,7 +85,7 @@ int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size) *size = protocol__f1u_message__get_packed_size(msg); *buf = malloc(*size); - if (buf == NULL) + if (!(*buf)) goto error; protocol__f1u_message__pack(msg, *buf); @@ -181,7 +181,7 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf *size = protocol__flexsplit_message__get_packed_size(msg); *buf = malloc(*size); - if (buf == NULL) + if (!(*buf)) goto error; protocol__flexsplit_message__pack(msg, *buf); -- GitLab From 7a7c2afa1100cad89cc5e8bb661a8fd1def2a22d Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 6 Mar 2019 13:59:39 +0100 Subject: [PATCH 242/308] Handle cppcheck errors in ASYNC_IF --- openair2/UTIL/ASYNC_IF/socket_link.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 3c043f85df..e40fba4a04 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -222,7 +222,7 @@ socket_link_t *new_link_udp_client(const char *server, int port){ ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); - //goto error; + goto error; } ret->socket_fd = -1; @@ -253,8 +253,10 @@ socket_link_t *new_link_udp_client(const char *server, int port){ return ret; error: - if (ret != NULL) close(ret->socket_fd); - free(ret); + if (ret != NULL) { + close(ret->socket_fd); + free(ret); + } LOG_E(MAC, "ERROR in new_link_udp_client (see above), returning NULL\n"); return NULL; } -- GitLab From 275b559fbf144a1119cf09dccd126e03be5c2950 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 6 Mar 2019 14:18:54 +0100 Subject: [PATCH 243/308] Fix linker error: link F1-U protobuf for eNB noS1 case --- cmake_targets/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 807fbf8a31..d92ab01d38 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2145,7 +2145,7 @@ add_dependencies(lte-softmodem-nos1 rrc_flag s1ap_flag x2_flag) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group RRC_LIB F1AP F1AP_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${PROTO_AGENT_LIB} LFDS7 + ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7 NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl) -- GitLab From bbedd315e725774026f5442b4150bc3aee13135a Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Wed, 6 Mar 2019 19:26:53 +0100 Subject: [PATCH 244/308] Correctly link lte-uesoftmodem(-nos1) (hack) Although not used in the UE, we currently need to link the F1 library into it. This is because we do not define ASN_DISABLE_OER_SUPPORT (otherwise, F1 has compilation problems). In this case, some functions are apparently not correctly defined, giving linker errors in the UE. Linking F1 in solves the problem. This is a hack. It would be better to be able to define ASN_DISABLE_OER_SUPPORT and have no compilation errors or compile everything with ASN_DISABLE_OER_SUPPORT except F1. I did not do this because I did not find another way than add target_compile_definitions() to every target except F1 which adds many lines just so that one target (F1 ASN.1) compiles correctly (in other words, F1 needs to be fixed). --- cmake_targets/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index d92ab01d38..b886ef0ff3 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2184,7 +2184,7 @@ add_executable(lte-uesoftmodem add_dependencies(lte-uesoftmodem rrc_flag s1ap_flag x2_flag) target_link_libraries (lte-uesoftmodem -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU + RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP F1AP_LIB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl) @@ -2225,7 +2225,7 @@ add_dependencies(lte-uesoftmodem-nos1 rrc_flag s1ap_flag x2_flag) target_link_libraries (lte-uesoftmodem-nos1 -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU + RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP F1AP_LIB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl) -- GitLab From ede37e56b86e44f995a6dbd5d0266a8406312122 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 7 Mar 2019 12:46:34 +0100 Subject: [PATCH 245/308] Use correct RNTI for RRC data req --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 7b704f2264..81d504dffc 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -717,8 +717,9 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, if ((ra->msg4_mpdcch_repetition_cnt == 0) && (mpdcch_sf_condition (mac, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) { // Get RRCConnectionSetup for Piggyback - ra->msg4_rrc_sdu_length = mac_rrc_data_req (module_idP, CC_idP, frameP, CCCH, ra->rnti, 1, // 1 transport block - &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case + ra->msg4_rrc_sdu_length = mac_rrc_data_req (module_idP, CC_idP, frameP, CCCH, + UE_RNTI(module_idP, UE_id), 1, // 1 transport block + &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case AssertFatal (ra->msg4_rrc_sdu_length > 0, "[MAC][eNB Scheduler] CCCH not allocated\n"); -- GitLab From 02d99edf23c5618ccfbdbc6c5f93d3cad8092564 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 7 Mar 2019 14:16:16 +0100 Subject: [PATCH 246/308] Fix cppcheck errors: RRC, F1AP --- openair2/F1AP/f1ap_cu_ue_context_management.c | 51 ++++++++++--------- openair2/F1AP/f1ap_du_interface_management.c | 38 +++++++------- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 6 +-- openair2/F1AP/f1ap_du_ue_context_management.c | 4 +- openair2/RRC/LTE/rrc_eNB.c | 10 ++-- 5 files changed, 55 insertions(+), 54 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index f0b7194bce..6f6a84e404 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -965,35 +965,36 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); - - /* The following is normally done in the function rrc_rx_tx() */ - rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(instance, - ue_context_p->ue_context.eNB_ue_s1ap_id); - - rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(instance, ue_context_p); - // erase data of GTP tunnels in UE context - for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], - 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); - ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; - } - - struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = - rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, - ue_context_p->ue_context.eNB_ue_s1ap_id); - if (rrc_ue_s1ap_ids) - rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); - - /* The following is normally done in the function release_UE_in_freeList() */ - /* remove PDCP entry */ protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, instance, ENB_FLAG_YES, rnti, 0, 0, instance); - pdcp_remove_UE(&ctxt); - /* trigger UE release in RRC */ - if (ue_context_p) + if (ue_context_p) { + /* The following is normally done in the function rrc_rx_tx() */ + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(instance, + ue_context_p->ue_context.eNB_ue_s1ap_id); + + rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(instance, ue_context_p); + // erase data of GTP tunnels in UE context + for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], + 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; + } + + struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = + rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, + ue_context_p->ue_context.eNB_ue_s1ap_id); + if (rrc_ue_s1ap_ids) + rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); + + /* trigger UE release in RRC */ rrc_eNB_remove_ue_context(&ctxt, RC.rrc[instance], ue_context_p); + } else { + LOG_E(F1AP, "could not find ue_context of UE RNTI %x\n", rnti); + } + + pdcp_remove_UE(&ctxt); /* notify the agent */ if (flexran_agent_get_rrc_xface(instance)) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 5b3fc4addd..f076b28a44 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -563,7 +563,7 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, //void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, instance_t du_mod_idP, - f1ap_setup_req_t *f1ap_du_data) { + f1ap_setup_req_t *f1ap_setup_req) { F1AP_F1AP_PDU_t pdu; F1AP_GNBDUConfigurationUpdate_t *out; F1AP_GNBDUConfigurationUpdateIEs_t *ie; @@ -619,22 +619,22 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", nRCGI.nRCellIdentity.buf[0], nRCGI.nRCellIdentity.buf[1], nRCGI.nRCellIdentity.buf[2], nRCGI.nRCellIdentity.buf[3], nRCGI.nRCellIdentity.buf[4]); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 + served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - (const char *) &f1ap_du_data->tac[i], + (const char *) &f1ap_setup_req->tac[i], 3); /* - Configured_EPS_TAC */ @@ -653,14 +653,14 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* > PLMN BroadcastPLMNs Item */ F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); } // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; - if ("FDD") { + if (f1ap_setup_req->fdd_flag) { nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); @@ -778,9 +778,9 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t oldNRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &oldNRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); served_cells_to_modify_item.oldNRCGI = oldNRCGI; @@ -790,17 +790,17 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 + served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - (const char *) &f1ap_du_data->tac[i], + (const char *) &f1ap_setup_req->tac[i], 3); /* - Configured_EPS_TAC */ @@ -819,14 +819,14 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* > PLMN BroadcastPLMNs Item */ F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); } // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; - if ("FDD") { + if (f1ap_setup_req->fdd_flag) { nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); @@ -944,9 +944,9 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t oldNRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &oldNRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); served_cells_to_delete_item.oldNRCGI = oldNRCGI; /* ADD */ @@ -980,9 +980,9 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); active_cells_item.nRCGI = nRCGI; /* ADD */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index a5aa5da569..1a0494eccc 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -522,8 +522,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, boolean_t ret = TRUE; mem_block_t *pdcp_pdu_p = NULL; pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); - memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); - memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); //LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size); //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) @@ -534,7 +532,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, //printf("\n"); - if (pdcp_pdu_p != NULL) { + if (pdcp_pdu_p != NULL) { + memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); + memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); rlc_status = rlc_data_req(&ctxt , 1 , MBMS_FLAG_NO diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 4af453e4e4..1a80132ea8 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -301,8 +301,8 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* OPTIONAL */ /* lCID */ - drbs_setup_item.lCID = (F1AP_LCID_t *)calloc(1, sizeof(F1AP_LCID_t)); - drbs_setup_item.lCID = 0L; + //drbs_setup_item.lCID = (F1AP_LCID_t *)calloc(1, sizeof(F1AP_LCID_t)); + //drbs_setup_item.lCID = 1L; for (j=0; j<1; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index a1f04edf54..35046a4b36 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1179,7 +1179,7 @@ rrc_eNB_generate_SecurityModeCommand( rrc_eNB_mui, size); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) || + if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) && (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU)) { LOG_I(RRC,"calling rrc_data_req :securityModeCommand\n"); @@ -6507,8 +6507,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); */ - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { rrc_rlc_config_req(ctxt_pP, SRB_FLAG_NO, @@ -7210,8 +7210,8 @@ rrc_eNB_decode_ccch( if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); } -- GitLab From c2b51255d66f9eff8fc76a572f329c4418d1c24b Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 8 Mar 2019 09:42:33 +0100 Subject: [PATCH 247/308] WIP for adding OAI UE Testing. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 190 ++++++++++++++++++ ci-scripts/xml_files/ue_band20_test_10mhz.xml | 32 +++ 2 files changed, 222 insertions(+) create mode 100644 ci-scripts/xml_files/ue_band20_test_10mhz.xml diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 5e89384ebb..0a63795bc4 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -127,6 +127,22 @@ class SSHConnection(): self.eNBCpuModel = '' self.eNBCpuMHz = '' + #self.UEOsVersion = '' + #self.UEKernelVersion = '' + #self.UEUhdVersion = '' + #self.UECpuNb = '' + #self.UECpuModel = '' + self.UEIPAddress = '' + self.UERepository = '' + self.UEBranch = '' + #self.UE_AllowMerge = False + self.UECommitID = '' + #self.UETargetBranch = '' + self.UEUserName = '' + self.UEPassword = '' + #self.UESourceCodePath = '' + #self.UECpuMHz = '' + def open(self, ipaddress, username, password): count = 0 connect_status = False @@ -326,6 +342,12 @@ class SSHConnection(): self.close() self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) + def BuildOAIUE(self): + if self.UEIPAddress == '' or self.UERepository == '' or self.UEBranch == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': + Usage() + sys.exit('Insufficient Parameter') + self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) + def InitializeHSS(self): if self.EPCIPAddress == '' or self.EPCUserName == '' or self.EPCPassword == '' or self.EPCSourceCodePath == '' or self.EPCType == '': Usage() @@ -517,6 +539,108 @@ class SSHConnection(): job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + def InitializeOAIUE(self): + if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': + Usage() + sys.exit('Insufficient Parameter') + initialize_UE_flag = True + pStatus = self.CheckProcessExist(initialize_UE_flag) + if (pStatus < 0): + self.CreateHtmlTestRow(self.Initialize_UE_args, 'KO', pStatus) + self.CreateHtmlTabFooter(False) + sys.exit(1) + # If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB + result = re.search('T_stdout', str(self.Initialize_eNB_args)) + if result is not None: + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + self.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5) + result = re.search('interfaceToUse=(?P<eth_interface>[a-zA-Z0-9\-\_]+)done', str(self.ssh.before)) + if result is not None: + eth_interface = result.group('eth_interface') + logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + '\u001B[0m') + self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f /tmp/enb_' + self.testCase_id + '_s1log.pcap', '\$', 5) + self.command('echo $USER; nohup sudo tshark -f "host ' + self.eNBIPAddress +'" -i ' + eth_interface + ' -w /tmp/enb_' + self.testCase_id + '_s1log.pcap > /tmp/tshark.log 2>&1 &', self.EPCUserName, 5) + self.close() + self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) + self.command('cd ' + self.eNBSourceCodePath, '\$', 5) + # Initialize_eNB_args usually start with -O and followed by the location in repository + full_config_file = self.Initialize_eNB_args.replace('-O ','') + extIdx = full_config_file.find('.conf') + if (extIdx > 0): + extra_options = full_config_file[extIdx + 5:] + # if tracer options is on, compiling and running T Tracer + result = re.search('T_stdout', str(extra_options)) + if result is not None: + logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m') + self.command('cd common/utils/T/tracer', '\$', 5) + self.command('make', '\$', 10) + self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.log 2>&1 &', self.eNBUserName, 5) + self.command('cd ' + self.eNBSourceCodePath, '\$', 5) + full_config_file = full_config_file[:extIdx + 5] + config_path, config_file = os.path.split(full_config_file) + else: + sys.exit('Insufficient Parameter') + ci_full_config_file = config_path + '/ci-' + config_file + rruCheck = False + result = re.search('rru', str(config_file)) + if result is not None: + rruCheck = True + # Make a copy and adapt to EPC / eNB IP addresses + self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) + self.command('sed -i -e \'s/CI_MME_IP_ADDR/' + self.EPCIPAddress + '/\' ' + ci_full_config_file, '\$', 2); + self.command('sed -i -e \'s/CI_ENB_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2); + # Launch eNB with the modified config file + self.command('source oaienv', '\$', 5) + self.command('cd cmake_targets', '\$', 5) + self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5) + self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5) + self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5) + self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(self.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) + if not rruCheck: + self.eNBLogFile = 'enb_' + self.testCase_id + '.log' + time.sleep(6) + doLoop = True + loopCounter = 10 + while (doLoop): + loopCounter = loopCounter - 1 + if (loopCounter == 0): + # In case of T tracer recording, we may need to kill it + result = re.search('T_stdout', str(self.Initialize_eNB_args)) + if result is not None: + self.command('killall --signal SIGKILL record', '\$', 5) + self.close() + doLoop = False + logging.error('\u001B[1;37;41m eNB logging system did not show got sync! \u001B[0m') + self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'KO', ALL_PROCESSES_OK) + self.CreateHtmlTabFooter(False) + # In case of T tracer recording, we need to kill tshark on EPC side + result = re.search('T_stdout', str(self.Initialize_eNB_args)) + if result is not None: + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + logging.debug('\u001B[1m Stopping tshark \u001B[0m') + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) + self.close() + time.sleep(1) + pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap' + copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.') + if (copyin_res == 0): + self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.') + sys.exit(1) + else: + self.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4) + if rruCheck: + result = re.search('wait RUs', str(self.ssh.before)) + else: + result = re.search('got sync', str(self.ssh.before)) + if result is None: + time.sleep(6) + else: + doLoop = False + self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'OK', ALL_PROCESSES_OK) + logging.debug('\u001B[1m Initialize eNB Completed\u001B[0m') + + self.close() + def checkDevTTYisUnlocked(self): self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) count = 0 @@ -2467,6 +2591,16 @@ while len(argvs) > 1: matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE) SSH.testXMLfiles.append(matchReg.group(1)) SSH.nbTestXMLfiles += 1 + elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE) + SSH.testXMLfiles.append(matchReg.group(1)) + SSH.nbTestXMLfiles += 1 + elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE) + SSH.UEUserName = matchReg.group(1) + elif re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE) + SSH.UEPassword = matchReg.group(1) elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE) finalStatus = matchReg.group(1) @@ -2675,6 +2809,62 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE): sys.exit('Invalid action') SSH.CreateHtmlTabFooter(True) +elif re.match('^TestUE$', mode, re.IGNORECASE): + if SSH.UEIPAddress == '' or SSH.UERepository == '' or SSH.UEBranch == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '': + Usage() + sys.exit('Insufficient Parameter') + #read test_case_list.xml file + # if no parameters for XML file, use default value + if (SSH.nbTestXMLfiles != 1): + xml_test_file = sys.path[0] + "/test_case_list.xml" + else: + xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[0] + + xmlTree = ET.parse(xml_test_file) + xmlRoot = xmlTree.getroot() + + exclusion_tests=xmlRoot.findtext('TestCaseExclusionList',default='') + requested_tests=xmlRoot.findtext('TestCaseRequestedList',default='') + if (SSH.nbTestXMLfiles == 1): + SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-0')) + all_tests=xmlRoot.findall('testCase') + + exclusion_tests=exclusion_tests.split() + requested_tests=requested_tests.split() + + #check that exclusion tests are well formatted + #(6 digits or less than 6 digits followed by +) + for test in exclusion_tests: + if (not re.match('^[0-9]{6}$', test) and + not re.match('^[0-9]{1,5}\+$', test)): + logging.debug('ERROR: exclusion test is invalidly formatted: ' + test) + sys.exit(1) + else: + logging.debug(test) + + #check that requested tests are well formatted + #(6 digits or less than 6 digits followed by +) + #be verbose + for test in requested_tests: + if (re.match('^[0-9]{6}$', test) or + re.match('^[0-9]{1,5}\+$', test)): + logging.debug('INFO: test group/case requested: ' + test) + else: + logging.debug('ERROR: requested test is invalidly formatted: ' + test) + sys.exit(1) + + #get the list of tests to be done + todo_tests=[] + for test in requested_tests: + if (test_in_list(test, exclusion_tests)): + logging.debug('INFO: test will be skipped: ' + test) + else: + #logging.debug('INFO: test will be run: ' + test) + todo_tests.append(test) + + signal.signal(signal.SIGUSR1, receive_signal) + + SSH.CreateHtmlTabHeader() else: Usage() sys.exit('Invalid mode') diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz.xml b/ci-scripts/xml_files/ue_band20_test_10mhz.xml new file mode 100644 index 0000000000..7841664246 --- /dev/null +++ b/ci-scripts/xml_files/ue_band20_test_10mhz.xml @@ -0,0 +1,32 @@ +<!-- + + 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 + +--> +<testCaseList> + <TestCaseRequestedList>010101</TestCaseRequestedList> + + <testCase id="010101i"> + <class>IdleSleep</class> + <desc>Sleep OAI UE</desc> + <nbMaxUEtoAttach>1</nbMaxUEtoAttach> + </testCase> + +</testCaseList> -- GitLab From 05ebea4a2477b4934ce98e9c8206444bc01abe01 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 8 Mar 2019 16:51:57 +0100 Subject: [PATCH 248/308] Reduce PHY layer logging (as in current develop) --- openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index 4f163a750e..dbade04739 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -3334,7 +3334,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, harq_pid = subframe2harq_pid(frame_parms, pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe), pdcch_alloc2ul_subframe(frame_parms,subframe)); - LOG_I(PHY,"Frame %d, Subframe %d: Programming ULSCH for (%d.%d) => harq_pid %d\n", + LOG_D(PHY,"Frame %d, Subframe %d: Programming ULSCH for (%d.%d) => harq_pid %d\n", proc->frame_rx,subframe, pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe), pdcch_alloc2ul_subframe(frame_parms,subframe), harq_pid); -- GitLab From 20c35748cae0703138a00c9feaf76ea401b05de5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 8 Mar 2019 16:52:31 +0100 Subject: [PATCH 249/308] Fix lte-uesoftmodem: segfaults & logic errors * prevent segfault: guard access to RC.rrc with UETARGET * in rlc_data_ind(): correct logic to test for all cases eNB, CU, DU, UE --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 7 +++- openair2/LAYER2/RLC/rlc.c | 61 ++++++++++------------------- 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index d0fdc0197f..7d9d9b478a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -370,10 +370,10 @@ boolean_t pdcp_data_req( if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) { +#ifndef UETARGET LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); -#ifndef UETARGET if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { @@ -428,6 +428,7 @@ boolean_t pdcp_data_req( else // SRB { +#ifndef UETARGET if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) || (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)|| (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) ) { @@ -449,7 +450,9 @@ boolean_t pdcp_data_req( LOG_I(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); ret=TRUE; - } else{ + } else +#endif + { rlc_status = rlc_data_req(ctxt_pP , srb_flagP , MBMS_FLAG_NO diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 7d431fcf20..2cb92a4208 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -607,49 +607,28 @@ void rlc_data_ind ( T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); #endif - if (ctxt_pP->enb_flag == 1) - { - switch (RC.rrc[ctxt_pP->module_id]->node_type){ - case ngran_eNB_CU: - case ngran_ng_eNB_CU: - case ngran_gNB_CU: - LOG_E(RLC, "Can't be CU, Bad Node type %d\n",RC.rrc[ctxt_pP->module_id]->node_type); - break; - case ngran_eNB_DU: - case ngran_gNB_DU: - if (srb_flagP == 1) { - MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); - F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti; - F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_idP; - F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data; - F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = sdu_sizeP; - itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); - } + #ifndef UETARGET - else - proto_agent_send_pdcp_data_ind ( - ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_idP, - sdu_sizeP, - sdu_pP); -#endif - - break; - - default: - pdcp_data_ind ( - ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_idP, - sdu_sizeP, - sdu_pP); - break; + const ngran_node_t type = RC.rrc[ctxt_pP->module_id]->node_type; + AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU, + "Can't be CU, bad node type %d\n", type); + + if (type == ngran_eNB_DU || type == ngran_gNB_DU) { + if (srb_flagP == 1) { + MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); + F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti; + F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_idP; + F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data; + F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = sdu_sizeP; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); + } else { + proto_agent_send_pdcp_data_ind (ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP); } - - } + } else +#endif + { // case monolithic eNodeB or UE + pdcp_data_ind(ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP); + } } //----------------------------------------------------------------------------- void rlc_data_conf (const protocol_ctxt_t *const ctxt_pP, -- GitLab From 7edf4387f9a1341e61adf2930324be998acd8759 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 8 Mar 2019 16:58:45 +0100 Subject: [PATCH 250/308] Fix bug in eNB: correctly set brOption for RRC R14 --- openair2/RRC/LTE/L2_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 88b6eb5198..b9e95f9bd6 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -271,10 +271,10 @@ mac_rrc_data_ind( if((srb_idP & RAB_OFFSET) == CCCH) { LOG_D(RRC, "[eNB %d] Received SDU for CCCH on SRB %d\n", module_idP, srb_idP); - /*Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0; #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ctxt.brOption = brOption; #endif + /*Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0; if (sdu_lenP > 0) { memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP); Srb_info->Rx_buffer.payload_size = sdu_lenP; -- GitLab From a22102bf3453ab9f854c068ea3f0996c02a8f1e1 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Mon, 11 Mar 2019 09:37:28 +0100 Subject: [PATCH 251/308] Temporary hack to make main.py command work with the new xml file, ue_band20_test_10mhz.xml. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 259 ++++++++++-------- ci-scripts/xml_files/ue_band20_test_10mhz.xml | 4 +- 2 files changed, 154 insertions(+), 109 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 0a63795bc4..355d75cd1d 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -126,7 +126,6 @@ class SSHConnection(): self.eNBCpuNb = '' self.eNBCpuModel = '' self.eNBCpuMHz = '' - #self.UEOsVersion = '' #self.UEKernelVersion = '' #self.UEUhdVersion = '' @@ -142,6 +141,9 @@ class SSHConnection(): self.UEPassword = '' #self.UESourceCodePath = '' #self.UECpuMHz = '' + self.Build_eNB_args = '' + self.Initialize_eNB_args = '' + def open(self, ipaddress, username, password): count = 0 @@ -347,6 +349,37 @@ class SSHConnection(): Usage() sys.exit('Insufficient Parameter') self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) + self.command('mkdir -p ' + self.UESourceCodePath, '\$', 5) + self.command('cd ' + self.UESourceCodePath, '\$', 5) + self.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + self.UERepository + ' .; else stdbuf -o0 git fetch; fi', '\$', 600) + # here add a check if git clone or git fetch went smoothly + self.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + self.command('git config user.name "OAI Jenkins"', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S git clean -x -d -ff', '\$', 30) + # if the commit ID is provided use it to point to it + if self.UECommitID != '': + self.command('git checkout -f ' + self.UECommitID, '\$', 5) + # if the branch is not develop, then it is a merge request and we need to do + # the potential merge. Note that merge conflicts should already been checked earlier + if (self.UE_AllowMerge): + if self.UETargetBranch == '': + if (self.UEBranch != 'develop') and (self.UEBranch != 'origin/develop'): + self.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.debug('Merging with the target branch: ' + self.UETargetBranch) + self.command('git merge --ff origin/' + self.UETargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + self.command('source oaienv', '\$', 5) + self.command('cd cmake_targets', '\$', 5) + self.command('mkdir -p log', '\$', 5) + self.command('chmod 777 log', '\$', 5) + # no need to remove in log (git clean did the trick) + self.command('stdbuf -o0 ./build_oai ' + self.Build_UE_args + ' 2>&1 | stdbuf -o0 tee -a compile_oai_ue.log', 'Bypassing the Tests', 600) + self.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) + self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) + self.command('mv compile_oai_ue.log ' + 'build_log_' + self.testCase_id, '\$', 5) + self.close() + self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) + def InitializeHSS(self): if self.EPCIPAddress == '' or self.EPCUserName == '' or self.EPCPassword == '' or self.EPCSourceCodePath == '' or self.EPCType == '': @@ -528,6 +561,7 @@ class SSHConnection(): def InitializeUE(self): if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': Usage() + print('InitializeUE') sys.exit('Insufficient Parameter') multi_jobs = [] for device_id in self.UEDevices: @@ -542,6 +576,7 @@ class SSHConnection(): def InitializeOAIUE(self): if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': Usage() + print('DEBUG InitializeOAIUE 1') sys.exit('Insufficient Parameter') initialize_UE_flag = True pStatus = self.CheckProcessExist(initialize_UE_flag) @@ -549,22 +584,10 @@ class SSHConnection(): self.CreateHtmlTestRow(self.Initialize_UE_args, 'KO', pStatus) self.CreateHtmlTabFooter(False) sys.exit(1) - # If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB - result = re.search('T_stdout', str(self.Initialize_eNB_args)) - if result is not None: - self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - self.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5) - result = re.search('interfaceToUse=(?P<eth_interface>[a-zA-Z0-9\-\_]+)done', str(self.ssh.before)) - if result is not None: - eth_interface = result.group('eth_interface') - logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + '\u001B[0m') - self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f /tmp/enb_' + self.testCase_id + '_s1log.pcap', '\$', 5) - self.command('echo $USER; nohup sudo tshark -f "host ' + self.eNBIPAddress +'" -i ' + eth_interface + ' -w /tmp/enb_' + self.testCase_id + '_s1log.pcap > /tmp/tshark.log 2>&1 &', self.EPCUserName, 5) - self.close() - self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) - self.command('cd ' + self.eNBSourceCodePath, '\$', 5) - # Initialize_eNB_args usually start with -O and followed by the location in repository - full_config_file = self.Initialize_eNB_args.replace('-O ','') + self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) + self.command('cd ' + self.UESourceCodePath, '\$', 5) + # Initialize_UE_args usually start with -O and followed by the location in repository + full_config_file = self.Initialize_UE_args.replace('-O ','') extIdx = full_config_file.find('.conf') if (extIdx > 0): extra_options = full_config_file[extIdx + 5:] @@ -574,30 +597,30 @@ class SSHConnection(): logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m') self.command('cd common/utils/T/tracer', '\$', 5) self.command('make', '\$', 10) - self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.log 2>&1 &', self.eNBUserName, 5) - self.command('cd ' + self.eNBSourceCodePath, '\$', 5) + self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.UESourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.UESourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.log 2>&1 &', self.UEUserName, 5) + self.command('cd ' + self.UESourceCodePath, '\$', 5) full_config_file = full_config_file[:extIdx + 5] config_path, config_file = os.path.split(full_config_file) else: + print('DEBUG InitializeOAIUE 2') sys.exit('Insufficient Parameter') ci_full_config_file = config_path + '/ci-' + config_file rruCheck = False result = re.search('rru', str(config_file)) if result is not None: rruCheck = True - # Make a copy and adapt to EPC / eNB IP addresses + # Make a copy and adapt to EPC / UE IP addresses self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) - self.command('sed -i -e \'s/CI_MME_IP_ADDR/' + self.EPCIPAddress + '/\' ' + ci_full_config_file, '\$', 2); - self.command('sed -i -e \'s/CI_ENB_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2); - # Launch eNB with the modified config file + self.command('sed -i -e \'s/CI_UE_IP_ADDR/' + self.UEIPAddress + '/\' ' + ci_full_config_file, '\$', 2); + # Launch UE with the modified config file self.command('source oaienv', '\$', 5) self.command('cd cmake_targets', '\$', 5) - self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5) - self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5) - self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5) - self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(self.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) + self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.UESourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.UE_instance) + '.sh ', '\$', 5) + self.command('chmod 775 ./my-lte-softmodem-run' + str(self.UE_instance) + '.sh ', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ue_' + self.testCase_id + '.log', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S -E daemon --inherit --unsafe --name=ue' + str(self.UE_instance) + '_daemon --chdir=' + self.UESourceCodePath + '/cmake_targets -o ' + self.UESourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) if not rruCheck: - self.eNBLogFile = 'enb_' + self.testCase_id + '.log' + self.UELogFile = 'enb_' + self.testCase_id + '.log' time.sleep(6) doLoop = True loopCounter = 10 @@ -605,16 +628,16 @@ class SSHConnection(): loopCounter = loopCounter - 1 if (loopCounter == 0): # In case of T tracer recording, we may need to kill it - result = re.search('T_stdout', str(self.Initialize_eNB_args)) + result = re.search('T_stdout', str(self.Initialize_UE_args)) if result is not None: self.command('killall --signal SIGKILL record', '\$', 5) self.close() doLoop = False - logging.error('\u001B[1;37;41m eNB logging system did not show got sync! \u001B[0m') + logging.error('\u001B[1;37;41m UE logging system did not show got sync! \u001B[0m') self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'KO', ALL_PROCESSES_OK) self.CreateHtmlTabFooter(False) # In case of T tracer recording, we need to kill tshark on EPC side - result = re.search('T_stdout', str(self.Initialize_eNB_args)) + result = re.search('T_stdout', str(self.Initialize_UE_args)) if result is not None: self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) logging.debug('\u001B[1m Stopping tshark \u001B[0m') @@ -624,7 +647,7 @@ class SSHConnection(): pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap' copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.') if (copyin_res == 0): - self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.') + self.copyout(self.UEIPAddress, self.UEUserName, self.UEPassword, pcap_log_file, self.UESourceCodePath + '/cmake_targets/.') sys.exit(1) else: self.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4) @@ -637,7 +660,7 @@ class SSHConnection(): else: doLoop = False self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'OK', ALL_PROCESSES_OK) - logging.debug('\u001B[1m Initialize eNB Completed\u001B[0m') + logging.debug('\u001B[1m Initialize UE Completed\u001B[0m') self.close() @@ -1998,6 +2021,69 @@ class SSHConnection(): job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + def TerminateOAIUE(self): + self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) + self.command('cd ' + self.UESourceCodePath + '/cmake_targets', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S daemon --name=ue' + str(self.UE_instance) + '_daemon --stop', '\$', 5) + self.command('rm -f my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S killall --signal SIGINT lte-uesoftmodem || true', '\$', 5) + time.sleep(5) + self.command('stdbuf -o0 ps -aux | grep -v grep | grep lte-uesoftmodem', '\$', 5) + result = re.search('lte-uesoftmodem', str(self.ssh.before)) + if result is not None: + self.command('echo ' + self.UEPassword + ' | sudo -S killall --signal SIGKILL lte-uesoftmodem || true', '\$', 5) + time.sleep(5) + self.close() + # If tracer options is on, stopping tshark on EPC side + result = re.search('T_stdout', str(self.Initialize_UE_args)) + if result is not None: + self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) + logging.debug('\u001B[1m Stopping tshark \u001B[0m') + self.command('echo ' + self.UEPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) + time.sleep(1) + pcap_log_file = self.UELogFile.replace('.log', '_s1log.pcap') + self.command('echo ' + self.UEPassword + ' | sudo -S chmod 666 /tmp/' + pcap_log_file, '\$', 5) + self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, '/tmp/' + pcap_log_file, '.') + self.copyout(self.UEIPAddress, self.UEUserName, self.UEPassword, pcap_log_file, self.UESourceCodePath + '/cmake_targets/.') + self.close() + logging.debug('\u001B[1m Replaying RAW record file\u001B[0m') + self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) + self.command('cd ' + self.UESourceCodePath + '/common/utils/T/tracer/', '\$', 5) + raw_record_file = self.UELogFile.replace('.log', '_record.raw') + replay_log_file = self.UELogFile.replace('.log', '_replay.log') + extracted_txt_file = self.UELogFile.replace('.log', '_extracted_messages.txt') + extracted_log_file = self.UELogFile.replace('.log', '_extracted_messages.log') + self.command('./extract_config -i ' + self.UESourceCodePath + '/cmake_targets/' + raw_record_file + ' > ' + self.UESourceCodePath + '/cmake_targets/' + extracted_txt_file, '\$', 5) + self.command('echo $USER; nohup ./replay -i ' + self.UESourceCodePath + '/cmake_targets/' + raw_record_file + ' > ' + self.UESourceCodePath + '/cmake_targets/' + replay_log_file + ' 2>&1 &', self.UEUserName, 5) + self.command('./textlog -d ' + self.UESourceCodePath + '/cmake_targets/' + extracted_txt_file + ' -no-gui -ON -full > ' + self.UESourceCodePath + '/cmake_targets/' + extracted_log_file, '\$', 5) + self.close() + self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + extracted_log_file, '.') + logging.debug('\u001B[1m Analyzing UE replay logfile \u001B[0m') + logStatus = self.AnalyzeLogFile_UE(extracted_log_file) + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.UELogFile = '' + else: + result = re.search('enb_', str(self.UELogFile)) + if result is not None: + copyin_res = self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + self.UELogFile, '.') + if (copyin_res == -1): + logging.debug('\u001B[1;37;41m Could not copy UE logfile to analyze it! \u001B[0m') + self.htmlUEFailureMsg = 'Could not copy UE logfile to analyze it!' + self.CreateHtmlTestRow('N/A', 'KO', ENB_PROCESS_NOLOGFILE_TO_ANALYZE) + self.UELogFile = '' + return + logging.debug('\u001B[1m Analyzing UE logfile \u001B[0m') + logStatus = self.AnalyzeLogFile_UE(self.UELogFile) + if (logStatus < 0): + self.CreateHtmlTestRow('N/A', 'KO', logStatus) + self.CreateHtmlTabFooter(False) + sys.exit(1) + else: + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.UELogFile = '' + else: + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + def AutoTerminateUEandeNB(self): self.testCase_id = 'AUTO-KILL-UE' self.desc = 'Automatic Termination of UE' @@ -2213,10 +2299,6 @@ class SSHConnection(): if (self.ADBIPAddress != 'none'): self.GetAllUEDevices(terminate_ue_flag) self.GetAllCatMDevices(terminate_ue_flag) - else: - self.UEDevices.append('doughq9rehg') - self.UEDevices.append('dnsgiuahgia') - self.UEDevices.append('uehgieng9') self.htmlUEConnected = len(self.UEDevices) self.htmlFile.write(' <h2><span class="glyphicon glyphicon-phone"></span> <span class="glyphicon glyphicon-menu-right"></span> ' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server</h2>\n') @@ -2259,10 +2341,6 @@ class SSHConnection(): if (self.ADBIPAddress != 'none'): self.GetAllUEDevices(terminate_ue_flag) self.GetAllCatMDevices(terminate_ue_flag) - else: - self.UEDevices.append('doughq9rehg') - self.UEDevices.append('dnsgiuahgia') - self.UEDevices.append('uehgieng9') self.htmlUEConnected = len(self.UEDevices) i = 0 @@ -2593,14 +2671,25 @@ while len(argvs) > 1: SSH.nbTestXMLfiles += 1 elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE) - SSH.testXMLfiles.append(matchReg.group(1)) - SSH.nbTestXMLfiles += 1 + SSH.UEIPAddress = matchReg.group(1) + elif re.match('^\-\-UERepository=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-UERepository=(.+)$', myArgv, re.IGNORECASE) + SSH.UERepository = matchReg.group(1) elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE) SSH.UEUserName = matchReg.group(1) elif re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE) SSH.UEPassword = matchReg.group(1) + elif re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE) + SSH.UESourceCodePath = matchReg.group(1) + elif re.match('^\-\-UEBranch=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-UEBranch=(.+)$', myArgv, re.IGNORECASE) + SSH.UEBranch = matchReg.group(1) + elif re.match('^\-\-UECommitID=(.*)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-UECommitID=(.*)$', myArgv, re.IGNORECASE) + SSH.UECommitID = matchReg.group(1) elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE) finalStatus = matchReg.group(1) @@ -2616,7 +2705,7 @@ if re.match('^TerminateeNB$', mode, re.IGNORECASE): sys.exit('Insufficient Parameter') SSH.TerminateeNB() elif re.match('^TerminateUE$', mode, re.IGNORECASE): - if SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '': + if SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == '': Usage() sys.exit('Insufficient Parameter') signal.signal(signal.SIGUSR1, receive_signal) @@ -2687,14 +2776,26 @@ elif re.match('^InitiateHtml$', mode, re.IGNORECASE): SSH.CreateHtmlHeader() elif re.match('^FinalizeHtml$', mode, re.IGNORECASE): SSH.CreateHtmlFooter(SSH.finalStatus) -elif re.match('^TesteNB$', mode, re.IGNORECASE): - if SSH.eNBIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '' or SSH.EPCIPAddress == '' or SSH.EPCUserName == '' or SSH.EPCPassword == '' or SSH.EPCType == '' or SSH.EPCSourceCodePath == '' or SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '': - Usage() - sys.exit('Insufficient Parameter') +elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re.IGNORECASE): + if re.match('^TesteNB$', mode, re.IGNORECASE): + if SSH.eNBIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '' or SSH.EPCIPAddress == '' or SSH.EPCUserName == '' or SSH.EPCPassword == '' or SSH.EPCType == '' or SSH.EPCSourceCodePath == '' or SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '': + Usage() + sys.exit('Insufficient Parameter') + + if (SSH.EPCIPAddress != 'none'): + SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp") + SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp") + else: + print('SSH.UEIPAddress=' + SSH.UEIPAddress) + print('SSH.UERepository=' + SSH.UERepository) + print('SSH.UEBranch=' + SSH.UEBranch) + print('SSH.UEUserName=' + SSH.UEUserName) + print('SSH.UEPassword=' + SSH.UEPassword) + print('SSH.UESourceCodePath=' + SSH.UESourceCodePath) + if SSH.UEIPAddress == '' or SSH.UERepository == '' or SSH.UEBranch == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '': + Usage() + sys.exit('UE: Insufficient Parameter') - if (SSH.EPCIPAddress != 'none'): - SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp") - SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp") #read test_case_list.xml file # if no parameters for XML file, use default value if (SSH.nbTestXMLfiles != 1): @@ -2809,62 +2910,6 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE): sys.exit('Invalid action') SSH.CreateHtmlTabFooter(True) -elif re.match('^TestUE$', mode, re.IGNORECASE): - if SSH.UEIPAddress == '' or SSH.UERepository == '' or SSH.UEBranch == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '': - Usage() - sys.exit('Insufficient Parameter') - #read test_case_list.xml file - # if no parameters for XML file, use default value - if (SSH.nbTestXMLfiles != 1): - xml_test_file = sys.path[0] + "/test_case_list.xml" - else: - xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[0] - - xmlTree = ET.parse(xml_test_file) - xmlRoot = xmlTree.getroot() - - exclusion_tests=xmlRoot.findtext('TestCaseExclusionList',default='') - requested_tests=xmlRoot.findtext('TestCaseRequestedList',default='') - if (SSH.nbTestXMLfiles == 1): - SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-0')) - all_tests=xmlRoot.findall('testCase') - - exclusion_tests=exclusion_tests.split() - requested_tests=requested_tests.split() - - #check that exclusion tests are well formatted - #(6 digits or less than 6 digits followed by +) - for test in exclusion_tests: - if (not re.match('^[0-9]{6}$', test) and - not re.match('^[0-9]{1,5}\+$', test)): - logging.debug('ERROR: exclusion test is invalidly formatted: ' + test) - sys.exit(1) - else: - logging.debug(test) - - #check that requested tests are well formatted - #(6 digits or less than 6 digits followed by +) - #be verbose - for test in requested_tests: - if (re.match('^[0-9]{6}$', test) or - re.match('^[0-9]{1,5}\+$', test)): - logging.debug('INFO: test group/case requested: ' + test) - else: - logging.debug('ERROR: requested test is invalidly formatted: ' + test) - sys.exit(1) - - #get the list of tests to be done - todo_tests=[] - for test in requested_tests: - if (test_in_list(test, exclusion_tests)): - logging.debug('INFO: test will be skipped: ' + test) - else: - #logging.debug('INFO: test will be run: ' + test) - todo_tests.append(test) - - signal.signal(signal.SIGUSR1, receive_signal) - - SSH.CreateHtmlTabHeader() else: Usage() sys.exit('Invalid mode') diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz.xml b/ci-scripts/xml_files/ue_band20_test_10mhz.xml index 7841664246..72b6a81ec1 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz.xml @@ -21,9 +21,9 @@ --> <testCaseList> - <TestCaseRequestedList>010101</TestCaseRequestedList> + <TestCaseRequestedList>080101</TestCaseRequestedList> - <testCase id="010101i"> + <testCase id="080101"> <class>IdleSleep</class> <desc>Sleep OAI UE</desc> <nbMaxUEtoAttach>1</nbMaxUEtoAttach> -- GitLab From 718e0fe894d7fad63d519871841e75923cfeeff2 Mon Sep 17 00:00:00 2001 From: laurent <laurent.thomas@open-cells.com> Date: Mon, 11 Mar 2019 09:56:47 +0100 Subject: [PATCH 252/308] thread pool --- common/utils/threadPool/Makefile | 8 + common/utils/threadPool/measurement_display.c | 56 ++++ common/utils/threadPool/thread-pool.c | 214 ++++++++++++++++ common/utils/threadPool/thread-pool.h | 239 ++++++++++++++++++ common/utils/threadPool/thread-pool.md | 65 +++++ 5 files changed, 582 insertions(+) create mode 100644 common/utils/threadPool/Makefile create mode 100644 common/utils/threadPool/measurement_display.c create mode 100644 common/utils/threadPool/thread-pool.c create mode 100644 common/utils/threadPool/thread-pool.h create mode 100644 common/utils/threadPool/thread-pool.md diff --git a/common/utils/threadPool/Makefile b/common/utils/threadPool/Makefile new file mode 100644 index 0000000000..6f0e884886 --- /dev/null +++ b/common/utils/threadPool/Makefile @@ -0,0 +1,8 @@ +all: measurement_display thread-pool-test + +measurement_display: measurement_display.c thread-pool.h + gcc measurement_display.c -I /data/openairinterface5g.nr/common/utils/ -I. /data/openairinterface5g.nr/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o measurement_display + +thread-pool-test: thread-pool.c thread-pool.h + gcc -g thread-pool.c -I /data/openairinterface5g.nr/common/utils/ -I. /data/openairinterface5g.nr/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o thread-pool-test + diff --git a/common/utils/threadPool/measurement_display.c b/common/utils/threadPool/measurement_display.c new file mode 100644 index 0000000000..8cee3796c7 --- /dev/null +++ b/common/utils/threadPool/measurement_display.c @@ -0,0 +1,56 @@ +#define __USE_GNU +#define _GNU_SOURCE +#include <stdio.h> +#include <pthread.h> +#include <sched.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <string.h> +#include <unistd.h> +#include <sys/syscall.h> +#include <sys/time.h> +#include <stdint.h> +#include <sys/stat.h> +#include <fcntl.h> +#include "thread-pool.h" + +#define SEP "\t" + +uint64_t cpuCyclesMicroSec; + +int main(int argc, char *argv[]) { + if(argc != 2) { + printf("Need one paramter: the trace Linux pipe (fifo)"); + exit(1); + } + + mkfifo(argv[1],0666); + int fd=open(argv[1], O_RDONLY); + + if ( fd == -1 ) { + perror("open read mode trace file:"); + exit(1); + } + + uint64_t deb=rdtsc(); + usleep(100000); + cpuCyclesMicroSec=(rdtsc()-deb)/100000; + printf("Cycles per µs: %lu\n",cpuCyclesMicroSec); + printf("Key" SEP "delay to process" SEP "processing time" SEP "delay to be read answer\n"); + notifiedFIFO_elt_t doneRequest; + + while ( 1 ) { + if ( read(fd,&doneRequest, sizeof(doneRequest)) == sizeof(doneRequest)) { + printf("%lu" SEP "%lu" SEP "%lu" SEP "%lu" "\n", + doneRequest.key, + (doneRequest.startProcessingTime-doneRequest.creationTime)/cpuCyclesMicroSec, + (doneRequest.endProcessingTime-doneRequest.startProcessingTime)/cpuCyclesMicroSec, + (doneRequest.returnTime-doneRequest.endProcessingTime)/cpuCyclesMicroSec + ); + } else { + printf("no measurements\n"); + sleep(1); + } + } +} diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c new file mode 100644 index 0000000000..ba70a07cc3 --- /dev/null +++ b/common/utils/threadPool/thread-pool.c @@ -0,0 +1,214 @@ +#define _GNU_SOURCE +#include <sched.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <unistd.h> +#include <thread-pool.h> + +void displayList(notifiedFIFO_t *nf) { + int n=0; + notifiedFIFO_elt_t *ptr=nf->outF; + + while(ptr) { + printf("element: %d, key: %lu\n",++n,ptr->key); + ptr=ptr->next; + } + + printf("End of list: %d elements\n",n); +} + +static inline notifiedFIFO_elt_t *pullNotifiedFifoRemember( notifiedFIFO_t *nf, struct one_thread *thr) { + mutexlock(nf->lockF); + + while(!nf->outF) + condwait(nf->notifF, nf->lockF); + + notifiedFIFO_elt_t *ret=nf->outF; + nf->outF=nf->outF->next; + + if (nf->outF==NULL) + nf->inF=NULL; + + // For abort feature + thr->runningOnKey=ret->key; + thr->abortFlag=false; + mutexunlock(nf->lockF); + return ret; +} + +void *one_thread(void *arg) { + struct one_thread *myThread=(struct one_thread *) arg; + struct thread_pool *tp=myThread->pool; + // configure the thread core assignment + // TBD: reserve the core for us exclusively + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(myThread->coreID, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + //Configure the thread scheduler policy for Linux + struct sched_param sparam= {0}; + sparam.sched_priority = sched_get_priority_max(SCHED_RR); + pthread_setschedparam(pthread_self(), SCHED_RR, &sparam); + // set the thread name for debugging + sprintf(myThread->name,"Tpool_%d",myThread->coreID); + pthread_setname_np(pthread_self(), myThread->name ); + + // Infinite loop to process requests + do { + notifiedFIFO_elt_t *elt=pullNotifiedFifoRemember(&tp->incomingFifo, myThread); + + if (tp->measurePerf) elt->startProcessingTime=rdtsc(); + + elt->processingFunc(NotifiedFifoData(elt)); + + if (tp->measurePerf) elt->endProcessingTime=rdtsc(); + + if (elt->reponseFifo) { + // Check if the job is still alive, else it has been aborted + mutexlock(tp->incomingFifo.lockF); + + if (myThread->abortFlag) + delNotifiedFIFO_elt(elt); + else + pushNotifiedFIFO(elt->reponseFifo, elt); + + mutexunlock(tp->incomingFifo.lockF); + } + } while (true); +} + +void initTpool(char *params,tpool_t *pool, bool performanceMeas) { + memset(pool,0,sizeof(*pool)); + char *measr=getenv("threadPoolMeasurements"); + pool->measurePerf=performanceMeas; + // force measurement if the output is defined + pool->measurePerf=measr!=NULL; + + if (measr) { + mkfifo(measr,0666); + AssertFatal(-1 != (pool->dummyTraceFd= + open(measr, O_RDONLY| O_NONBLOCK)),""); + AssertFatal(-1 != (pool->traceFd= + open(measr, O_WRONLY|O_APPEND|O_NOATIME|O_NONBLOCK)),""); + } else + pool->traceFd=-1; + + //Configure the thread scheduler policy for Linux + struct sched_param sparam= {0}; + sparam.sched_priority = sched_get_priority_max(SCHED_RR)-1; + pthread_setschedparam(pthread_self(), SCHED_RR, &sparam); + pool->activated=true; + initNotifiedFIFO(&pool->incomingFifo); + char *saveptr, * curptr; + pool->nbThreads=0; + pool->restrictRNTI=false; + curptr=strtok_r(params,",",&saveptr); + + while ( curptr!=NULL ) { + if (curptr[0] == 'u' || curptr[0] == 'U') { + pool->restrictRNTI=true; + } else if ( curptr[0]>='0' && curptr[0]<='9' ) { + struct one_thread *tmp=pool->allthreads; + pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread)); + pool->allthreads->next=tmp; + printf("create a thread for core %d\n", atoi(curptr)); + pool->allthreads->coreID=atoi(curptr); + pool->allthreads->id=pool->nbThreads; + pool->allthreads->pool=pool; + pthread_create(&pool->allthreads->threadID, NULL, one_thread, (void *)pool->allthreads); + pool->nbThreads++; + } else if (curptr[0] == 'n' || curptr[0] == 'N') { + pool->activated=false; + } else + printf("Error in options for thread pool: %s\n",curptr); + + curptr=strtok_r(NULL,",",&saveptr); + } + + if (pool->activated && pool->nbThreads==0) { + printf("No servers created in the thread pool, exit\n"); + exit(1); + } +} + +#ifdef TEST_THREAD_POOL + +struct testData { + int id; + char txt[30]; +}; + +void processing(void *arg) { + struct testData *in=(struct testData *)arg; + printf("doing: %d, %s, in thr %ld\n",in->id, in->txt,pthread_self() ); + sprintf(in->txt,"Done by %ld, job %d", pthread_self(), in->id); + usleep(rand()%100); + printf("done: %d, %s, in thr %ld\n",in->id, in->txt,pthread_self() ); +} + +int main() { + notifiedFIFO_t myFifo; + initNotifiedFIFO(&myFifo); + pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 1234,NULL,NULL)); + + for(int i=10; i>1; i--) { + pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 1000+i,NULL,NULL)); + } + + displayList(&myFifo); + notifiedFIFO_elt_t *tmp=pullNotifiedFIFO(&myFifo); + printf("pulled: %lu\n", tmp->key); + displayList(&myFifo); + tmp=pullNotifiedFIFO(&myFifo); + printf("pulled: %lu\n", tmp->key); + displayList(&myFifo); + abortNotifiedFIFO(&myFifo,1005); + printf("aborted 1005\n"); + displayList(&myFifo); + pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 12345678, NULL, NULL)); + displayList(&myFifo); + abortNotifiedFIFO(&myFifo,12345678); + printf("aborted 12345678\n"); + displayList(&myFifo); + + do { + tmp=pollNotifiedFIFO(&myFifo); + + if (tmp) { + printf("pulled: %lu\n", tmp->key); + displayList(&myFifo); + } else + printf("Empty list \n"); + } while(tmp); + + tpool_t pool; + char params[]="1,2,3,u"; + initTpool(params,&pool, true); + notifiedFIFO_t worker_back; + initNotifiedFIFO(&worker_back); + + for (int i=0; i <1000 ; i++) { + notifiedFIFO_elt_t *work=newNotifiedFIFO_elt(sizeof(struct testData), i, &worker_back, processing); + struct testData *x=(struct testData *)NotifiedFifoData(work); + x->id=i; + pushTpool(&pool, work); + } + + do { + tmp=pullTpool(&worker_back,&pool); + + if (tmp) { + struct testData *dd=NotifiedFifoData(tmp); + printf("Result: %s\n",dd->txt); + delNotifiedFIFO_elt(tmp); + } else + printf("Empty list \n"); + + abortTpool(&pool,510); + } while(tmp); + + return 0; +} +#endif diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h new file mode 100644 index 0000000000..8b815bf752 --- /dev/null +++ b/common/utils/threadPool/thread-pool.h @@ -0,0 +1,239 @@ +#ifndef THREAD_POOL_H +#define THREAD_POOL_H +#include <stdbool.h> +#include <stdint.h> +#include <pthread.h> +#include <sys/syscall.h> +#include <assertions.h> +#include <log.h> + +#ifdef DEBUG + #define THREADINIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +#else + #define THREADINIT PTHREAD_MUTEX_INITIALIZER +#endif +#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,""); +#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,""); +#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,""); +#define mutextrylock(mutex) pthread_mutex_trylock(&mutex) +#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,""); +#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,""); +#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); +#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); + +typedef struct notifiedFIFO_elt_s { + struct notifiedFIFO_elt_s *next; + uint64_t key; //To filter out elements + struct notifiedFIFO_s *reponseFifo; + void (*processingFunc)(void *); + bool malloced; + uint64_t creationTime; + uint64_t startProcessingTime; + uint64_t endProcessingTime; + uint64_t returnTime; + void *msgData; +} notifiedFIFO_elt_t; + +typedef struct notifiedFIFO_s { + notifiedFIFO_elt_t *outF; + notifiedFIFO_elt_t *inF; + pthread_mutex_t lockF; + pthread_cond_t notifF; +} notifiedFIFO_t; + +// You can use this allocator or use any piece of memory +static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size, + uint64_t key, + notifiedFIFO_t *reponseFifo, + void (*processingFunc)(void *)) { + notifiedFIFO_elt_t *ret; + size_t sz=sizeof(notifiedFIFO_elt_t)+size; + AssertFatal( NULL != (ret=(notifiedFIFO_elt_t *) malloc((sz/32+1)*32)), ""); + ret->next=NULL; + ret->key=key; + ret->reponseFifo=reponseFifo; + ret->processingFunc=processingFunc; + // We set user data piece aligend 32 bytes to be able to process it with SIMD + ret->msgData=(void *)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32; + ret->malloced=true; + return ret; +} + +static inline void *NotifiedFifoData(notifiedFIFO_elt_t *elt) { + return elt->msgData; +} + +static inline void delNotifiedFIFO_elt(notifiedFIFO_elt_t *elt) { + bool tmp=elt->malloced; + + if (elt->malloced) { + elt->malloced=false; + free(elt); + } else + printf("delNotifiedFIFO on something not allocated by newNotifiedFIFO\n"); + + //LOG_W(UTIL,"delNotifiedFIFO on something not allocated by newNotifiedFIFO\n"); +} + +static inline void initNotifiedFIFO(notifiedFIFO_t *nf) { + mutexinit(nf->lockF); + condinit (nf->notifF); + nf->inF=NULL; + nf->outF=NULL; + // No delete function: the creator has only to free the memory +} + +static inline void pushNotifiedFIFO(notifiedFIFO_t *nf, notifiedFIFO_elt_t *msg) { + mutexlock(nf->lockF); + msg->next=NULL; + + if (nf->outF == NULL) + nf->outF = msg; + + if (nf->inF) + nf->inF->next = msg; + + nf->inF = msg; + condbroadcast(nf->notifF); + mutexunlock(nf->lockF); +} + +static inline notifiedFIFO_elt_t *pullNotifiedFIFO(notifiedFIFO_t *nf) { + mutexlock(nf->lockF); + + while(!nf->outF) + condwait(nf->notifF, nf->lockF); + + notifiedFIFO_elt_t *ret=nf->outF; + nf->outF=nf->outF->next; + + if (nf->outF==NULL) + nf->inF=NULL; + + mutexunlock(nf->lockF); + return ret; +} + +static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) { + int tmp=mutextrylock(nf->lockF); + if (tmp != 0 ) + return NULL; + + notifiedFIFO_elt_t *ret=nf->outF; + + if (ret!=NULL) + nf->outF=nf->outF->next; + + if (nf->outF==NULL) + nf->inF=NULL; + + mutexunlock(nf->lockF); + return ret; +} + +// This function aborts all messages matching the key +// If the queue is used in thread pools, it doesn't cancels already running processing +// because the message has already been picked +static inline void abortNotifiedFIFO(notifiedFIFO_t *nf, uint64_t key) { + mutexlock(nf->lockF); + notifiedFIFO_elt_t **start=&nf->outF; + + while(*start!=NULL) { + if ( (*start)->key == key ) { + notifiedFIFO_elt_t *request=*start; + *start=(*start)->next; + delNotifiedFIFO_elt(request); + } + + if (*start != NULL) + start=&(*start)->next; + } + + mutexunlock(nf->lockF); +} + +struct one_thread { + pthread_t threadID; + int id; + int coreID; + char name[256]; + uint64_t runningOnKey; + bool abortFlag; + struct thread_pool *pool; + struct one_thread *next; +}; + +typedef struct thread_pool { + int activated; + bool measurePerf; + int traceFd; + int dummyTraceFd; + uint64_t cpuCyclesMicroSec; + uint64_t startProcessingUE; + int nbThreads; + bool restrictRNTI; + notifiedFIFO_t incomingFifo; + struct one_thread *allthreads; +} tpool_t; + +static inline void pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg) { + if (t->measurePerf) msg->creationTime=rdtsc(); + + pushNotifiedFIFO(&t->incomingFifo, msg); +} + +static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) { + notifiedFIFO_elt_t *msg= pullNotifiedFIFO(responseFifo); + + if (t->measurePerf) + msg->returnTime=rdtsc(); + + if (t->traceFd) + (void)write(t->traceFd, msg, sizeof(*msg)); + + return msg; +} + +static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) { + notifiedFIFO_elt_t *msg= pullNotifiedFIFO(responseFifo); + if (msg == NULL) + return NULL; + + if (t->measurePerf) + msg->returnTime=rdtsc(); + + if (t->traceFd) + (void)write(t->traceFd, msg, sizeof(*msg)); + + return msg; +} + +static inline void abortTpool(tpool_t *t, uint64_t key) { + notifiedFIFO_t *nf=&t->incomingFifo; + mutexlock(nf->lockF); + notifiedFIFO_elt_t **start=&nf->outF; + + while(*start!=NULL) { + if ( (*start)->key == key ) { + notifiedFIFO_elt_t *request=*start; + *start=(*start)->next; + delNotifiedFIFO_elt(request); + } + + if (*start != NULL) + start=&(*start)->next; + } + + struct one_thread *ptr=t->allthreads; + + while(ptr!=NULL) { + if (ptr->runningOnKey==key) + ptr->abortFlag=true; + + ptr=ptr->next; + } + + mutexunlock(nf->lockF); +} + +#endif diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md new file mode 100644 index 0000000000..6da98018e1 --- /dev/null +++ b/common/utils/threadPool/thread-pool.md @@ -0,0 +1,65 @@ +# Thread pool + +The thread pool is a working server, made of a set of worker threads that can be mapped on CPU cores. + +Each worker loop on pick from the same input queue jobs to do. +When a job is done, the worker sends a return if a return is defined. + +A selective abort allows to cancel parallel jobs (usage: a client pushed jobs, but from a response of one job, the other linked jobs becomes useless). + +All the thread pool functions are thread safe, nevertheless the working functions are implemented by the thread pool client, so the client has to tackle the parallel execution of his functions called "processingFunc" hereafter. + +# jobs + +A job is a message (notifiedFIFO_elt_t): +next: internal FIFO chain, do not set it +key: a long int that the client can use to identify a message or a group of messages +responseFifo: if the client defines a response FIFO, the message will be posted back after processing +processingFunc: any funtion (type void processingFunc(void *)) that the worker will launch +msgData: the data passed to processingFunc. It can be added automatically, or you can set it to a buffer you are managing +malloced: a boolean that enable internal free in these cases: no return Fifo or Abort feature + +The job messages can be created with newNotifiedFIFO_elt() and delNotifiedFIFO_elt() or managed by the client. + +# Queues of jobs + +Queues are type of: notifiedFIFO_t that must be initialized by init_notifiedFIFO() +No delete function is required, the creator has only to free the data of type notifiedFIFO_t + +push_notifiedFIFO() add a job in the queue +pull_notifiedFIFO() is blocking, poll_notifiedFIFO() is non blocking + +abort_notifiedFIFO() allows the customer to delete all waiting jobs that match with the key (see key in jobs definition) + +# Thread pools + +## initialization +The clients can create one or more thread pools with init_tpool() +the params string structure: describes a list of cores, separated by "," that run a worker thread + +The threads are all Linux real time scheduler, their name is set automatically is "Tpool_<core id>" + +## adding jobs +The client create their jobs messages as a notifiedFIFO_elt_t, then they push it with pushTpool() (that internally calls push_notifiedFIFO()) + +If they need a return, they have to create response queues with init_notifiedFIFO() and set this FIFO pointer in the notifiedFIFO_elt_t before pushing the job. + +## abort + +A abort service abortTpool() allows to abort all jobs that match a key (see jobs "key"). When the abort returns, it garanties no job (matching the key) response will be posted on response queues. + +Nevertheless, jobs already performed before the return of abortTpool() are pushed in the response Fifo queue. + +## Performance measurements + +A performance measurement is integrated: the pool will automacillay fill timestamps: + +* creationTime: time the request is push to the pool; +* startProcessingTime: time a worker start to run on the job +* endProcessingTime: time the worker finished the job +* returnTime: time the client reads the result + +if you set the environement variable: thread-pool-measurements to a valid file name +These measurements will be wrote to this Linux pipe. + +A tool to read the linux fifo and display it in ascii will be provided (TBD) -- GitLab From 590c99e79e1a60127ddca7e97c98e7925ccc37cc Mon Sep 17 00:00:00 2001 From: laurent <laurent.thomas@open-cells.com> Date: Mon, 11 Mar 2019 11:22:27 +0100 Subject: [PATCH 253/308] add license --- common/utils/threadPool/measurement_display.c | 5 +++++ common/utils/threadPool/thread-pool.c | 5 +++++ common/utils/threadPool/thread-pool.h | 5 +++++ common/utils/threadPool/thread-pool.md | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/common/utils/threadPool/measurement_display.c b/common/utils/threadPool/measurement_display.c index 8cee3796c7..ac7beca1fe 100644 --- a/common/utils/threadPool/measurement_display.c +++ b/common/utils/threadPool/measurement_display.c @@ -1,3 +1,8 @@ +/* + Author: Laurent THOMAS, Open Cells + copyleft: OpenAirInterface Software Alliance and it's licence +*/ + #define __USE_GNU #define _GNU_SOURCE #include <stdio.h> diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c index ba70a07cc3..8a706d9246 100644 --- a/common/utils/threadPool/thread-pool.c +++ b/common/utils/threadPool/thread-pool.c @@ -1,3 +1,8 @@ +/* + Author: Laurent THOMAS, Open Cells + copyleft: OpenAirInterface Software Alliance and it's licence +*/ + #define _GNU_SOURCE #include <sched.h> #include <sys/types.h> diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 8b815bf752..5c36364fc9 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -1,3 +1,8 @@ +/* + Author: Laurent THOMAS, Open Cells + copyleft: OpenAirInterface Software Alliance and it's licence +*/ + #ifndef THREAD_POOL_H #define THREAD_POOL_H #include <stdbool.h> diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md index 6da98018e1..92cc21b975 100644 --- a/common/utils/threadPool/thread-pool.md +++ b/common/utils/threadPool/thread-pool.md @@ -9,6 +9,10 @@ A selective abort allows to cancel parallel jobs (usage: a client pushed jobs, b All the thread pool functions are thread safe, nevertheless the working functions are implemented by the thread pool client, so the client has to tackle the parallel execution of his functions called "processingFunc" hereafter. +## license +Author: Laurent Thomas, Open cells project +The owner share the code usage to Openairsoftware alliance as per OSA license terms + # jobs A job is a message (notifiedFIFO_elt_t): -- GitLab From 13857c67e89f0e7d1eba4ae05546efcc0bde2ca7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Thu, 14 Mar 2019 14:24:16 +0100 Subject: [PATCH 254/308] fix segfault RRU: check for nb_inst >0 before node_type --- targets/RT/USER/lte-softmodem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 8464e9747c..966b363822 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -688,7 +688,8 @@ int main( int argc, char **argv ) { RCconfig_L1(); } - if (RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU) { + if (RC.nb_inst > 0 + && (RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { protocol_ctxt_t ctxt; ctxt.module_id = 0 ; ctxt.instance = 0; -- GitLab From 777be28189ed70273f3624399e4572b249bfcc15 Mon Sep 17 00:00:00 2001 From: frtabu <francois.taburet@nokia-bell-labs.com> Date: Fri, 15 Mar 2019 18:39:12 +0100 Subject: [PATCH 255/308] Build documentation update, moved to gitlab --- doc/BUILD.md | 112 +++++++++++++++++++++++++++++++++++++++++++++ doc/GET_SOURCES.md | 103 +++++++++++++++++++++++++++++++++++++++++ doc/RUNMODEM.md | 12 +++++ 3 files changed, 227 insertions(+) create mode 100644 doc/BUILD.md create mode 100644 doc/GET_SOURCES.md create mode 100644 doc/RUNMODEM.md diff --git a/doc/BUILD.md b/doc/BUILD.md new file mode 100644 index 0000000000..9fa2419c98 --- /dev/null +++ b/doc/BUILD.md @@ -0,0 +1,112 @@ +# OAI build procedures + +## soft modem Build script + +oai EPC is developed in a distinct project with it's own [documentation](https://github.com/OPENAIRINTERFACE/openair-cn/wiki) , it is not described here. OAI UE and eNodeB sources can be downloaded from the Eurecom [gitlab repository](./GET_SOURCES.md). Sources come with a build script [build_oai](../cmake_targets/build_oai) located at the root of the `openairinterface5g/cmake_targets` directory. This script is developed to build the oai binaries (executables,shared libraries) for different hardware platforms, and use cases. + +the main oai binaries, which are tested by the Continuous Integration process are: + +- The LTE UE: `lte-uesoftmodem` +- The LTE eNodeB: `lte-softmodem` +- The PHY simulators: `dlsim` and `ulsim` + +The build system for OAI uses [cmake](https://cmake.org/) which is a common tool to -generate makefiles. The `build_oai` script is a wrapper using cmake, make and standard linux shell commands to ease the oai build and use . The file describing how to build the executables from source files is the [CMakeLists.txt](../cmake_targets/CMakeLists.txt), it is used as input by cmake to generate the makefiles. + +The oai softmodem supports many use cases, and new ones are regularly added. Most of them are accessible using the configuration file or the command line options and continuous effort is done to avoid introducing build options as it makes tests and usage more complicated than run-time options. The following functionalities, originally requiring a specific build are now accessible by configuration or command line options: + +- s1, noS1 + +- all simulators, with exception of PHY simulators, which are distinct executables. + + + +Calling the build_oai script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is ongoing. Check the table at the end of this page to know the status of `buid_oai` options which are not described hereafter. + + + +## building PHY simulators + +detailed information about these simulators can be found [in this dedicated page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/OpenAirLTEPhySimul + +## building UE and eNodeB executables + +After downloading the source files, a single build command can be used to get the binaries supporting all the oai softmodem use cases (UE and eNodeB): + +``` +cd <your oai installation directory>/openairinterface5g/ +source oaienv +cd ../cmake_targets/ +./build_oai -I -w USRP --eNB --UE +``` + +- The -I option is to install pre-requisites, you only need it the first time you build the softmodem or when some oai dependencies have changed. +- The -w option is to select the radio head support you want to include in your build. Radio head support is provided via a shared library, which is called the "oai device" The build script creates a soft link from `liboai_device.so` to the true device which will be used at run-time (here the USRP one,`liboai_usrpdevif.so` . USRP is the only hardware tested today in the Continuous Integration process. +- --eNB is to build the `lte-softmodem` executable and all required shared libraries +- --UE is to build the `lte-uesoftmodem` executable and all required shared libraries + +You can build the eNodeB and the UE separately, you may not need both of them depending on your oai usage. + +After completing the build, the binaries are available in the `cmake_targets/lte_build_oai/build` directory. A copy is also available in the `target/bin` directory, with all binaries suffixed by the 3GPP release number, today .Rel14 by default. It must be noticed that the option for building for a specific 3GPP release number is not tested by the CI and may be removed in the future. + +## building optional binaries + +### Telnet server + +​ The telnet server can be built with the --build-telnet option, after building the softmodem or while building it. + +`./build_oai -I -w USRP --eNB --UE --build-telnet`srv + +​ or + +`./build_oai --build-telnetsrv` + +### USRP record player + +​ The USRP record player today needs a specific build. Work to make it available as a run time option is under consideration + + + +## `build_oai` options + +| Option | Status | Description | +| ----------------------------------------------------------- | ------------------------------------------- | :----------------------------------------------------------- | +| -h | maintained | get help | +| -c | maintained | erase all previously built files for this target before starting the new build. | +| -C | maintained, needs improvement | erase all previously built files for any target before starting the new build. | +| --verbose-compile | maintained | | +| --cflags_processor | maintained | used to pass options to the compiler | +| --clean-kernel | unknown | no code in the script corresponding to this option | +| --install-system-files | maintained | install oai built binaries in linux system files repositories | +| -w | maintained and tested in CI for USRP device | build corresponding oai device and create the soft link to enforce this device usage at run-time | +| -t | maintained | build the specified transport library, which is used in some simulators and in non monolithic eNodeB deployments. Now of little interest as transport library build is enforced when building the eNodeB. | +| --phy_simulators | maintained, tested in CI | build all PHY simulators, a set of executables allowing unitary tests of LTE channel implementation within oai. | +| --core_simulators | | | +| -s | | | +| --run-group | | | +| -I | maintained, tested in CI | install external dependencies before starting the build | +| --install-optional-packages | maintained | install optional packages, useful for developing and testing. look at the | +| | | check_install_additional_tools function in cmake_targets/tools/build_helper script to get the list | +| -g | maintained | build binaries with gdb support. | +| --eNB | maintained and tested in CI | build `lte-softmodem` the LTE eNodeB | +| --UE | maintained and tested in CI | build `lte-uesoftmodem` the LTE UE | +| --usrp-recplay | maintained | build with support for the record player. Implementation will be soon reviewed to switch to a run-time option. | +| --build-telnet | maintained | build the telnet server shared library, which can then be loaded at run time via the --telnetsrv command line option. | +| --build-msc | unknown | build the msc shared library, which can then be loaded at run time via the --msc command line option. msc is a tracing utility which status is unknown. | +| --UE-conf-nvram | | | +| --UE-gen-nvram | | | +| -r | unknown, to be removed | specifies which 3GPP release to build for. Only the default (today rel14) is tested in CI and it is likely that future oai release will remove this option | +| -V | deprecated | Used to build with support for synchronization diagram utility. This is now available via the T-Tracer and is included if T-Tracer is not disabled. | +| -x | deprecated | Used to build with support for embedded signal analyzer. This is now available via the T-Tracer and is included if T-Tracer is not disabled. | +| --noS1 | deprecated, to be removed | build noS1 version of oai softmodem binaries. noS1 allows running oai eNodeB and UE without an LTE core network (EPC). This functionality is now available via a run-time option. | +| --build-doxygen | unknown | build doxygen documentation, many oai source files do not include doxygen comments | +| --disable-deadline --enable-deadline --disable-cpu-affinity | deprecated | These options were used to activate or de-activate specific code depending on the choice of a specific linux scheduling mode. This has not been tested for a while and should be implemented as configuration options | +| --disable-T-Tracer | maintained, to be tested | Remove T_Tracer and console LOG messages except error messages. | +| --disable-hardware-dependency | | | +| --ue-autotest-trace --ue-timing --ue-trace | deprecated | Were used to enable conditional code implementing debugging messages or debugging statistics. These functionalities are now either available from run-time options or not maintained. | +| --disable-log | deprecated, to be removed | Was used to disable LOG messages, replaced by `--disable-T-Tracer` build option to remove tracing code from the build or `--T-stdout 0` run time option to redirect LOG messages to T-Tracer client interface. | +| --ue-nas-use-tun | deprecated to be removed | Usage of tun in place of specific kernel modules is now a run time option. `--nokrnmod 0` option disable the default behavior which is to use tun to send or receive ip packets to/from the linux ip stack. | +| --build-eclipse | unknown | | +| --basic-simulator | deprecated tested in CI | builds the basic simulator device. Now of little interest as this device build is enforced when building the eNodeB and it can be used at run time with the `--basicsim` option. More over the rf simulator is an enhanced basic simulator. | +| --rfsimulator | maintained | builds the rf simulator device. Now of little interest as this device build is enforced when building the eNodeB and it can be used at run time with the `--rfsim` option. | +| | | | + diff --git a/doc/GET_SOURCES.md b/doc/GET_SOURCES.md new file mode 100644 index 0000000000..bd85c8a926 --- /dev/null +++ b/doc/GET_SOURCES.md @@ -0,0 +1,103 @@ +# The OpenAirInterface repository + +The OpenAirInterface software can be obtained from our gitLab +server. You will need a git client to get the sources. The repository +is currently used for main developments. + +## Prerequisite + +You need to install the subversion/git using the following commands: + +```shell +sudo apt-get update +sudo apt-get install subversion git +``` + +## Using EURECOM Gitlab + +The [openairinterface5g repository](https://gitlab.eurecom.fr/oai/openairinterface5g.git) +holds the source code for (eNB RAN + UE RAN). + +For legal issues (licenses), the core network (EPC) source code is now moved away from +the above openairinterface5g git repository. This EPC code is now splitted into two git +projects ([openair-cn](https://gitlab.eurecom.fr/oai/openair-cn.git) with apache license +and [xtables-addons-oai](https://gitlab.eurecom.fr/oai/xtables-addons-oai.git) with GPL license). + +Configure git with your name/email address (only important if you are developer and want to checkin code to Git): + +```shell +git config --global user.name "Your Name" +git config --global user.email "Your email address" +``` + +- Add a certificate from gitlab.eurecom.fr to your Ubuntu 14.04 installation: + +```shell +echo -n | openssl s_client -showcerts -connect gitlab.eurecom.fr:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt +``` + +- Disable certificate check completely if you do not have root access to /etc/ssl directory + +```shell +git config --global http.sslverify false +``` + +### In order to checkout the Git repository (for OAI Users without login to gitlab server) + +Checkout RAN repository (eNB RAN + UE RAN): + +```shell +git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git +``` + +Checkout EPC (Core Network) repository: + +```shell +git clone https://gitlab.eurecom.fr/oai/openair-cn.git +``` + +Optionally (openair-cn build script can install it for you): + +```shell +git clone https://gitlab.eurecom.fr/oai/xtables-addons-oai.git +``` + +### In order to checkout the Git repository (for OAI Developers/admins with login to gitlab server) + +Please send email to {openair_tech (AT) eurecom (DOT) fr} to be added to the repository +as a developer (only important for users who want to commit code to the repository). If +you do not have account on gitlab.eurecom.fr, please register yourself to gitlab.eurecom.fr. + +* Checkout with using ssh keys: + * You will need to put your ssh keys in https://gitlab.eurecom.fr/profile/keys + to access to the git repo. Once that is done, checkout the git repository using: + * `git clone git@gitlab.eurecom.fr:oai/openairinterface5g.git` +* Checkout with user name/password prompt: + * `git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/openairinterface5g.git` + * `git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/openair-cn.git` + * `git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/xtables-addons-oai.git` (optional, openair-cn build script can do it for you) + +## Which branch to checkout? + +On the RAN side: + +* **master**: This branch is targeted for the user community. Since January 2019, it is also subject to a Continuous Integration process. The update frequency is about once every 2-3 months. We are also performing bug fixes on this branch. +* **develop**: This branch contains recent commits that are tested on our CI test bench. The update frequency is about once a week. + +Please see the work flow and policies page : + +https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/oai-policies-home + +you can find the latest stable tag release here : + +https://gitlab.eurecom.fr/oai/openairinterface5g/tags + +The tag naming conventions are : + +- On `master` branch: **v1.`x`.`y`** where + * `x` is the minor release number, incremented every 2-3 months when we are merging `develop` into `master` branch. + * `y` is the maintenance number, starting at 0 when we do a minor release and being incremented when a bug fix is incorporated into `master` branch. +- On `develop` branch **`yyyy`.w`xx`** + * `yyyy` is the calendar year + * `xx` the week number within the year + diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md new file mode 100644 index 0000000000..ea125337f0 --- /dev/null +++ b/doc/RUNMODEM.md @@ -0,0 +1,12 @@ +# Running OAI softmodem + +After you have [built the softmodem executables](BUILD.md) you can go to the build directory `cmake_targets/lte_build_oai/build/` and start testing some use cases. + +## rf simulator + +​ This is the easiest use-case to setup and test, you need two x86 PCs, 4 cores and 3GHz CPU should be enough + +## Monolithic eNodeB with USRP radio head + +1. ## + -- GitLab From 4cb1b9cefcdb8d2066760f0154240401d3b6e1b5 Mon Sep 17 00:00:00 2001 From: frtabu <francois.taburet@nokia-bell-labs.com> Date: Sat, 16 Mar 2019 01:33:26 +0100 Subject: [PATCH 256/308] update rf simulator doc, add lte usage doc --- doc/BUILD.md | 11 +++++--- doc/RUNMODEM.md | 14 +++++++++- targets/ARCH/rfsimulator/README.md | 41 ++++++++++++++++-------------- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/doc/BUILD.md b/doc/BUILD.md index 9fa2419c98..a9e6a19571 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -10,7 +10,7 @@ the main oai binaries, which are tested by the Continuous Integration process ar - The LTE eNodeB: `lte-softmodem` - The PHY simulators: `dlsim` and `ulsim` -The build system for OAI uses [cmake](https://cmake.org/) which is a common tool to -generate makefiles. The `build_oai` script is a wrapper using cmake, make and standard linux shell commands to ease the oai build and use . The file describing how to build the executables from source files is the [CMakeLists.txt](../cmake_targets/CMakeLists.txt), it is used as input by cmake to generate the makefiles. +The build system for OAI uses [cmake](https://cmake.org/) which is a tool to generate makefiles. The `build_oai` script is a wrapper using cmake, make and standard linux shell commands to ease the oai build and use . The file describing how to build the executables from source files is the [CMakeLists.txt](../cmake_targets/CMakeLists.txt), it is used as input by cmake to generate the makefiles. The oai softmodem supports many use cases, and new ones are regularly added. Most of them are accessible using the configuration file or the command line options and continuous effort is done to avoid introducing build options as it makes tests and usage more complicated than run-time options. The following functionalities, originally requiring a specific build are now accessible by configuration or command line options: @@ -18,9 +18,12 @@ The oai softmodem supports many use cases, and new ones are regularly added. Mos - all simulators, with exception of PHY simulators, which are distinct executables. - -Calling the build_oai script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is ongoing. Check the table at the end of this page to know the status of `buid_oai` options which are not described hereafter. +Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the + +[table]: BUILD.md "`build_oai` options" + + at the end of this page to know the status of `buid_oai` options which are not described hereafter. @@ -54,7 +57,7 @@ After completing the build, the binaries are available in the `cmake_targets/lte ​ The telnet server can be built with the --build-telnet option, after building the softmodem or while building it. -`./build_oai -I -w USRP --eNB --UE --build-telnet`srv +`./build_oai -I -w USRP --eNB --UE --build-telnetsrv` ​ or diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index ea125337f0..37b2552233 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -4,7 +4,19 @@ After you have [built the softmodem executables](BUILD.md) you can go to the bui ## rf simulator -​ This is the easiest use-case to setup and test, you need two x86 PCs, 4 cores and 3GHz CPU should be enough + The rf simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE and the oai eNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. This is the ideal tool to check signal processing algorithms implementation. + +It is planned to enhance this simulator with the following functionalities: + +- Support for multiple UE connections +- Support for multiple eNodeB for hand-over tests +- Spport for channel modeling + + This is an easy use-case to setup and test, as no specific hardware is required. The [rfsimulator page](../targets/ARCH/rfsimulator/README.md ) contains the detailed documentation. + +## l2 nfapi simulator + + As for the rf simulator, no specific hardware is required. The [L2 nfapi simlator page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/l2-nfapi-simulator/l2-nfapi-simulator-w-S1-same-machine) contains the detailed documentation. ## Monolithic eNodeB with USRP radio head diff --git a/targets/ARCH/rfsimulator/README.md b/targets/ARCH/rfsimulator/README.md index 89964decd5..ebe7d72ee0 100644 --- a/targets/ARCH/rfsimulator/README.md +++ b/targets/ARCH/rfsimulator/README.md @@ -1,26 +1,14 @@ -#General +## General + This is a RF simulator that allows to test OAI without a RF board. It replaces a actual RF board driver. As much as possible, it works like a RF board, but not in realtime: it can run faster than realtime if there is enough CPU or slower (it is CPU bound instead of real time RF sampling bound) -#build - -## From build_oai -You can build it the same way, and together with actual RF driver +## build -Example: -```bash -./build_oai --ue-nas-use-tun --UE --eNB -w SIMU -``` -It is also possible to build actual RF and use choose on each run: -```bash -./build_oai --ue-nas-use-tun --UE --eNB -w USRP --rfsimulator -``` -Will build both the eNB (lte-softmodem) and the UE (lte-uesoftmodem) -We recommend to use the option --ue-nas-use-tun that is much simpler to use than the OAI kernel driver. + No specific build is required, use the [oai softmodem build procedure](../../../doc/BUILD.md) -## Add the rfsimulator after initial build After any regular build, you can compile the driver ```bash cd <the_compilation_dir_from_bouild_oai_script>/build @@ -35,16 +23,30 @@ It should the set to "enb" in the eNB ## 4G case For the UE, it should be set to the IP address of the eNB example: + ```bash -sudo RFSIMULATOR=192.168.2.200 ./lte-uesoftmodem -C 2685000000 -r 50 +sudo RFSIMULATOR=192.168.2.200 ./lte-uesoftmodem -C 2685000000 -r 50 --rfsim ``` +For the eNodeB, use a valid configuration file setup for USRP board tests and start the softmodem as usual, but adding the `--rfsim` option. + + + +```bash +sudo RFSIMULATOR=enb ./lte-softmodem -O <config file> --rfsim +``` + + + Except this, the UE and the eNB can be used as it the RF is real If you reach 'RA not active' on UE, be careful to generate a valid SIM ```bash $OPENAIR_DIR/targets/bin/conf2uedata -c $OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o . ``` +This simulator can also be used with the `--noS1` option, in this case you must run the eNodeB and the UE on different PCs. + ## 5G case + After regular build, add the simulation driver (don't use ./build_oai -w SIMU until we merge 4G and 5G branches) ```bash @@ -62,7 +64,8 @@ sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --numerology 1 -r 106 -C 3510000000 Of course, set the gNB machine IP address if the UE and the gNB are not on the same machine In UE, you can add "-d" to get the softscope -#Caveacts +## Caveacts + Still issues in power control: txgain, rxgain are not used -no S1 mode is currently broken, so we were not able to test the simulator in noS1 mode + -- GitLab From 44e30b4d95770a72d3a9533d90aadbe226880daf Mon Sep 17 00:00:00 2001 From: frtabu <francois.taburet@nokia-bell-labs.com> Date: Sat, 16 Mar 2019 02:15:17 +0100 Subject: [PATCH 257/308] add links to new pages --- doc/BUILD.md | 6 ++++++ doc/FEATURE_SET.md | 7 +++++++ doc/RUNMODEM.md | 24 ++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/doc/BUILD.md b/doc/BUILD.md index a9e6a19571..6d3645948f 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -113,3 +113,9 @@ After completing the build, the binaries are available in the `cmake_targets/lte | --rfsimulator | maintained | builds the rf simulator device. Now of little interest as this device build is enforced when building the eNodeB and it can be used at run time with the `--rfsim` option. | | | | | +[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) + +[oai softmodem features](FEATURE_SET.md) + +[running the oai softmodem ](RUNMODEM.md) + diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md index 29163fd832..1e8e2840c0 100644 --- a/doc/FEATURE_SET.md +++ b/doc/FEATURE_SET.md @@ -192,3 +192,10 @@ The NAS layer is based on **3GPP 24.301** and implements the following functions - EMM attach/detach, authentication, tracking area update, and more - ESM default/dedicated bearer, PDN connectivity, and more + +[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) + +[oai softmodem build procedure](BUILD.md) + +[running the oai softmodem ](RUNMODEM.md) + diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 37b2552233..b86546368c 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -10,15 +10,35 @@ It is planned to enhance this simulator with the following functionalities: - Support for multiple UE connections - Support for multiple eNodeB for hand-over tests -- Spport for channel modeling +- Support for channel modeling This is an easy use-case to setup and test, as no specific hardware is required. The [rfsimulator page](../targets/ARCH/rfsimulator/README.md ) contains the detailed documentation. ## l2 nfapi simulator +This simulator connects a eNodeB and UEs through the nfapi interface. + As for the rf simulator, no specific hardware is required. The [L2 nfapi simlator page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/l2-nfapi-simulator/l2-nfapi-simulator-w-S1-same-machine) contains the detailed documentation. +## l1 simulator + +The [L1 simulator page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/OpenAirLTEEmulationNEW) contains the detailed documentation. + +## USRP record player + +## noS1 mode + +The noS1 mode is now available via the `--noS1`command line option. It can be used with simulators, described above, or when using oai with true RF boards. Only the oai UE can be connected to the oai eNodeB in noS1 mode. + +By default the noS1 mode is using linux tun interfaces to send or receive ip packets to/from the linux ip stack. using the `--nokrnmod 0`option you can enforce kernel modules instead of tun. + +noS1 code has been revisited, it has been tested with the rf simulator, and tun interfaces. More tests are on going and CI will soon include noS1 tests. + ## Monolithic eNodeB with USRP radio head -1. ## +[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) + +[oai softmodem features](FEATURE_SET.md) + +[oai softmodem build procedure](BUILD.md) -- GitLab From 07375a04beadfc7b0aa6b3c2b48aa6a1d8f2d961 Mon Sep 17 00:00:00 2001 From: frtabu <francois.taburet@nokia-bell-labs.com> Date: Sun, 17 Mar 2019 22:50:51 +0100 Subject: [PATCH 258/308] move some doc to gitlab --- doc/L1SIM.md | 99 +++++++++++++++ doc/L2NFAPI.md | 36 ++++++ doc/L2NFAP_S1I.md | 304 ++++++++++++++++++++++++++++++++++++++++++++++ doc/RUNMODEM.md | 24 ++-- 4 files changed, 455 insertions(+), 8 deletions(-) create mode 100644 doc/L1SIM.md create mode 100644 doc/L2NFAPI.md create mode 100644 doc/L2NFAP_S1I.md diff --git a/doc/L1SIM.md b/doc/L1SIM.md new file mode 100644 index 0000000000..d63c0e5a34 --- /dev/null +++ b/doc/L1SIM.md @@ -0,0 +1,99 @@ +<table style="border-collapse: collapse; border: none;"> + <tr style="border-collapse: collapse; border: none;"> + <td style="border-collapse: collapse; border: none;"> + <a href="http://www.openairinterface.org/"> + <img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150> + </img> + </a> + </td> + <td style="border-collapse: collapse; border: none; vertical-align: center;"> + <b><font size = "5">Open Air LTE Emulation</font></b> + </td> + </tr> +</table> + +This page is valid for the develop branch + +# Table of Contents: # + +* [How to build the eNB and the UE](#build) +* [How to run an eNB built with the noS1 option](#run-noS1-eNB) +* [How to run a UE built with the noS1 option](#run-noS1-UE) +* [Continuous Integration notes](#CInote) +* [How to ping an eNB from a UE and vice versa (with the noS1 option)](#noS1-pinging) + +The old oaisim is dead! Long live oaisim! :) + +If you are looking for a description of the old oaisim (which is still available in some branches/tags), please see [here](OpenAirLTEEmulation) and [here](how-to-run-oaisim-with-multiple-ue). + +oaisim has been scraped and replaced by the same programs that are used for the real-time operation, `lte-softmodem` and `lte-uesoftmodem`. The latter also now includes an optional channel model, just like oaisim did. + +# <a name="build">[How to build the eNB and the UE](BUILD.md)</a> + +The following paragraph explains how to run the L1 simulator in noS1 mode and using the oai kernel modules. + +# <a name="run-noS1-eNB">How to run an eNB with the noS1 option</a> + +Modify the configuration file for IF4p5 fronthaul, `/openairinterface5g/ci-scripts/conf_files/rcc.band7.nos1.simulator.conf`, and replace the loopback interface with a physical ethernet interface and the IP addresses to work on your network. Copy your modifications to a new file, let's call YYY.conf the resulting configuration file. + +Run lte-softmodem as usual with this configuration. + +```bash +$ source oaienv +$ cd cmake_targets/tools +$ sudo -E ./init_nas_nos1 eNB +$ cd ../lte_build_oai/build +$ sudo -E ./lte-softmodem -O YYY.conf --noS1 --nokrnmod 0 +``` + +# <a name="run-noS1-UE">How to run a UE with the noS1 option</a> + +Similarly modify the example configuration file in `/openairinterface5g/ci-scripts/conf_files/rru.band7.nos1.simulator.conf` and replace loopback interface and IP addresses. Copy your modifications to a new file, let's call XXX.conf the resulting configuration file. + +Run it like: + +```bash +$ source oaienv +$ cd cmake_targets/tools +$ sudo -E ./init_nas_nos1 UE +$ cd ../lte_build_oai/build +$ sudo ./lte-uesoftmodem -O XXX.conf -r 25 --siml1 --noS1 --nokrnmod 0 +``` + +That should give you equivalent functionality to what you had with oaisim including noise and RF channel emulation (path loss / fading, etc.). You should also be able to run multiple UEs. + +# <a name="CInote">Continuous Integration notes</a> +The CI currently tests the noS1 build option with one eNB and one UE in the following scenarios: +* pinging one UE from one eNB +* pinging one eNB from one UE +* iperf download between one eNB and one UE +* iperf upload between one eNB and one UE +* all the above tests are done in FDD 5Mhz mode. + +# <a name="noS1-pinging">How to ping an eNB from a UE and vice versa (with the noS1 option)</a> + +Once your eNB and UE (built with the noS1 option) are running and synchronised, you can ping the eNB from the UE with the following command: + +```bash +ping -I oai0 -c 20 $eNB_ip_addr +``` +where $eNB_ip_addr is the IP address of your eNB. + +Similarly, you can ping the UE from the eNB. + +The IP adresses of the eNB and the UE are set up by the init_nas_nos1 program and should have the following values: +* eNB_ip_addr set to 20 10.0.1.1 +* ue_ip_addr set to 20 10.0.1.2 + + + + + + + +[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) + +[oai softmodem features](FEATURE_SET.md) + +[oai softmodem build procedure](BUILD.md) + diff --git a/doc/L2NFAPI.md b/doc/L2NFAPI.md new file mode 100644 index 0000000000..8d48bf8b34 --- /dev/null +++ b/doc/L2NFAPI.md @@ -0,0 +1,36 @@ +<table style="border-collapse: collapse; border: none;"> + <tr style="border-collapse: collapse; border: none;"> + <td style="border-collapse: collapse; border: none;"> + <a href="http://www.openairinterface.org/"> + <img src="../images/oai_final_logo.png" alt="" border=3 height=50 width=150> + </img> + </a> + </td> + <td style="border-collapse: collapse; border: none; vertical-align: center;"> + <b><font size = "5">L2 nFAPI Simulator Usage</font></b> + </td> + </tr> +</table> + +This simulator allows to test L2 and above Layers using the nFAPI interface. + +**This simulator is available starting the `v1.0.0` release on the `master` branch.** + +Currently the only validated deployment by CI and developers is *with S1 interface and eNB / UEs are on the same machine*. + +Others deployments will be supported later after bug fixes and validation in the CI process. + +1. [With S1 -- eNB and UE on same machine](L2NFAPI_S1.md) + + + + + + + +[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) + +[oai softmodem features](FEATURE_SET.md) + +[oai softmodem build procedure](BUILD.md) + diff --git a/doc/L2NFAP_S1I.md b/doc/L2NFAP_S1I.md new file mode 100644 index 0000000000..edaaab6af2 --- /dev/null +++ b/doc/L2NFAP_S1I.md @@ -0,0 +1,304 @@ +<table style="border-collapse: collapse; border: none;"> + <tr style="border-collapse: collapse; border: none;"> + <td style="border-collapse: collapse; border: none;"> + <a href="http://www.openairinterface.org/"> + <img src="../images/oai_final_logo.png" alt="" border=3 height=50 width=150> + </img> + </a> + </td> + <td style="border-collapse: collapse; border: none; vertical-align: center;"> + <b><font size = "5">L2 nFAPI Simulator (with S1 / same machine deployment)</font></b> + </td> + </tr> +</table> + +## Table of Contents ## + +1. [Environment](#1-environment) +2. [Prepare the EPC](#2-prepare-the-epc) +3. [Retrieve the OAI eNB-UE source code](#3-retrieve-the-oai-enb-ue-source-code) +4. [Setup of the USIM information in UE folder](#4-setup-of-the-usim-information-in-ue-folder) +5. [Setup of the Configuration files](#5-setup-of-the-configuration-files) + 1. [The eNB Configuration file](#51-the-enb-configuration-file) + 2. [The UE Configuration file](#52-the-ue-configuration-file) +6. [Bring Up a second loopback interface](#6-bring-up-a-second-loopback-interface) +7. [Build the eNB](#7-build-the-enb) +8. [Build the UE](#8-build-the-ue) +9. [Initialize the NAS UE Layer](#9-initialize-the-nas-ue-layer) +10. [Start the eNB](#10-start-the-enb) +11. [Start the UE](#11-start-the-ue) +12. [Test with ping](#12-test-with-ping) +13. [Limitations](#13-limitations) + +# 1. Environment # + +2 servers are used in this deployment. You can use Virtual Machines instead of each server; like it is done in the CI process. + +* Machine A contains the EPC. +* Machine B contains the OAI eNB and the OAI UE(s) + +Example of L2 nFAPI Simulator testing environment: + +<img src="../l2-nfapi-simulator/L2-sim-single-server-deployment.png" alt="" border=3> + +Note that the IP addresses are indicative and need to be adapted to your environment. + +# 2. Prepare the EPC # + +Create the environment for the EPC and register all **USIM** information into the **HSS** database. + +If you are using OAI-EPC ([see on GitHub](https://github.com/OPENAIRINTERFACE/openair-cn)), build **HSS/MME/SPGW** and create config files. + +# 3. Retrieve the OAI eNB-UE source code # + +The eNB and the UE executables will compiled into 2 separate folders on the same machine `B`. + +```bash +$ ssh sudousername@machineB +$ git clone https://gitlab.eurecom.fr/oai/openairinterface5g/ enb_folder +$ cd enb_folder +$ git checkout -f v1.0.0 +$ cd .. +$ cp -Rf enb_folder ue_folder +``` + +# 4. Setup of the USIM information in UE folder # + +```bash +$ ssh sudousername@machineB +$ cd ue_folder +# Edit openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf with your preferred editor +``` + +Edit the USIM information within this file in order to match the HSS database. They **HAVE TO** match: + +* PLMN+MSIN and IMSI of users table of HSS database **SHALL** be the same. +* OPC of this file and OPC of users table of HSS database **SHALL** be the same. +* USIM_API_K of this file and the key of users table of HSS database **SHALL** be the same. + +When testing multiple UEs, it is necessary to add other UEs information like described below for 2 Users. Only UE0 (first UE) information is written in the original file. + +``` +UE0: +{ + USER: { + IMEI="356113022094149"; + MANUFACTURER="EURECOM"; + MODEL="LTE Android PC"; + PIN="0000"; + }; + + SIM: { + MSIN="0000000001"; // <-- Modify here + USIM_API_K="8baf473f2f8fd09487cccbd7097c6862"; + OPC="e734f8734007d6c5ce7a0508809e7e9c"; + MSISDN="33611123456"; + }; +... +}; +// Copy the UE0 and edit +UE1: // <- Edit here +{ + USER: { + IMEI="356113022094149"; + MANUFACTURER="EURECOM"; + MODEL="LTE Android PC"; + PIN="0000"; + }; + + SIM: { + MSIN="0000000002"; // <-- Modify here + USIM_API_K="8baf473f2f8fd09487cccbd7097c6862"; + OPC="e734f8734007d6c5ce7a0508809e7e9c"; + MSISDN="33611123456"; + }; +... +}; +``` + +You can repeat the operation for as many users you want to test with. + +# 5. Setup of the Configuration files # + +**CAUTION: both proposed configuration files resides in the ci-scripts realm. You can copy them but you CANNOT push any modification on these 2 files as part of an MR without informing the CI team.** + +## 5.1. The eNB Configuration file ## + +```bash +$ ssh sudousername@machineB +$ cd enb_folder +# Edit ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf with your preferred editor +``` + +First verify the nFAPI interface setup on the 2nd loopback interface. + +``` +MACRLCs = ( + { + num_cc = 1; + local_s_if_name = "lo:"; // <-- HERE + remote_s_address = "127.0.0.1"; // <-- HERE + local_s_address = "127.0.0.2"; // <-- HERE + local_s_portc = 50001; + remote_s_portc = 50000; + local_s_portd = 50011; + remote_s_portd = 50010; + tr_s_preference = "nfapi"; + tr_n_preference = "local_RRC"; + } +); +``` + +If you are testing more than 16 UEs, a proper setting on the RUs is necessary. **Note that this part is NOT present in the original configuration file**. + +``` +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 20 + att_rx = 0; + bands = [38]; + max_pdschReferenceSignalPower = -23; + max_rxgain = 116; + eNB_instances = [0]; + } +); +``` + +Last, the S1 interface shall be properly set. + +``` + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; // replace with 192.168.10.20 + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "ens3"; // replace with the proper interface name + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; // replace with 192.168.10.10 + ENB_INTERFACE_NAME_FOR_S1U = "ens3"; // replace with the proper interface name + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; // replace with 192.168.10.10 + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; // replace with 192.168.10.10 + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + + }; +``` + +## 5.2. The UE Configuration file ## + +```bash +$ ssh sudousername@machineB +$ cd ue_folder +# Edit ci-scripts/conf_files/ue.nfapi.conf with your preferred editor +``` + +Verify the nFAPI interface setup on the loopback interface. + +``` +L1s = ( + { + num_cc = 1; + tr_n_preference = "nfapi"; + local_n_if_name = "lo"; // <- HERE + remote_n_address = "127.0.0.2"; // <- HERE + local_n_address = "127.0.0.1"; // <- HERE + local_n_portc = 50000; + remote_n_portc = 50001; + local_n_portd = 50010; + remote_n_portd = 50011; + } +); +``` + +# 6. Bring Up a second loopback interface # + +A second loopback interface is used to connect the eNB and the UEs. + +```bash +$ ssh sudousername@machineB +$ sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up +``` + +# 7. [Build OAI UE and eNodeB](BUILD.md) # + + + +# 8. Initialize the NAS UE Layer # + +Start the EPC on machine `A`. + +```bash +$ ssh sudousername@machineA +# Start the EPC +``` + +# 9. Start the eNB # + +In the first terminal (the one you used to build the eNB): + +```bash +$ ssh sudousername@machineB +$ cd enb_folder/cmake_targets +$ sudo -E ./lte_build_oai/build/lte-softmodem -O ../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf > enb.log 2>&1 +``` + +If you don't use redirection, you can test but many logs are printed on the console and this may affect performance of the L2-nFAPI simulator. + +We do recommend the redirection in steady mode once your setup is correct. + +# 10. Start the UE # + +In the second terminal (the one you used to build the UE): + +```bash +$ ssh sudousername@machineB +$ cd ue_folder/cmake_targets +# Test 64 UEs, 64 threads in FDD mode +$ sudo -E ./lte_build_oai/build/lte-uesoftmodem -O ../ci-scripts/conf_files/ue.nfapi.conf --L2-emul 3 --num-ues 64 --nums-ue-thread 64 > ue.log 2>&1 +# Test 64 UEs, 64 threads in TDD mode +$ sudo -E ./lte_build_oai/build/lte-uesoftmodem -O ../ci-scripts/conf_files/ue.nfapi.conf --L2-emul 3 --num-ues 64 --nums-ue-thread 64 -T 1 > ue.log 2>&1 +# The "-T 1" option means TDD config +``` + +- The number of UEs can set by using `--num-ues` option and the maximum UE number is 255 (with the `--mu*` options, otherwise 16). +- The umber of threads can set with the `--nums-ue-thread`. This number **SHALL NOT** be greater than the number of UEs. +- How many UE that can be tested depends on hardware (server , PC, etc) performance in your environment. + +# 11. Test with ping # + +In a third terminal, after around 10 seconds, the UE(s) shall be connected to the eNB: + +```bash +$ ssh sudousername@machineA +# Ping UE0 IP address based on the EPC pool used: in this example: +$ ping -c 20 192.168.200.2 +# Ping UE1 IP address based on the EPC pool used: in this example: +$ ping -c 20 192.168.200.4 +``` + +# 12. Limitations # + +Testing on the CI process is currently limited at time of writing. Improvements will be made soon. + + + + + + + + + +[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) + +[oai softmodem features](FEATURE_SET.md) + +[oai softmodem build procedure](BUILD.md) + +[L2 nfapi simulator](L2NFAPI.md) \ No newline at end of file diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index b86546368c..ce976c788a 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -1,14 +1,14 @@ # Running OAI softmodem -After you have [built the softmodem executables](BUILD.md) you can go to the build directory `cmake_targets/lte_build_oai/build/` and start testing some use cases. +After you have [built the softmodem executables](BUILD.md) you can set your default directory to the build directory `cmake_targets/lte_build_oai/build/` and start testing some use cases. Below, the description of the different oai functionalities should help you choose the oai configuration that suits your need. ## rf simulator - The rf simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE and the oai eNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. This is the ideal tool to check signal processing algorithms implementation. + The rf simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE and the oai eNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. This is the ideal tool to check signal processing algorithms and protocols implementation. It is planned to enhance this simulator with the following functionalities: -- Support for multiple UE connections +- Support for multiple UE connections,each UE being a `lte-uesoftmodem` instance. - Support for multiple eNodeB for hand-over tests - Support for channel modeling @@ -16,15 +16,15 @@ It is planned to enhance this simulator with the following functionalities: ## l2 nfapi simulator -This simulator connects a eNodeB and UEs through the nfapi interface. +This simulator connects a eNodeB and UEs through a nfapi interface, short-cutting the L1 layer. The objective of this simulator is to allow multi UEs simulation, with a large number of UEs (ideally up to 255 ) .Here to ease the platform setup, UEs are simulated via a single `lte-uesoftmodem` instance. Today the CI tests just with one UE and architecture has to be reviewed to allow a number of UE above about 16. This work is on-going. - As for the rf simulator, no specific hardware is required. The [L2 nfapi simlator page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/l2-nfapi-simulator/l2-nfapi-simulator-w-S1-same-machine) contains the detailed documentation. + As for the rf simulator, no specific hardware is required. The [L2 nfapi simlator page](L2NFAPI.md) contains the detailed documentation. ## l1 simulator -The [L1 simulator page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/OpenAirLTEEmulationNEW) contains the detailed documentation. +The l1 simulator is using the ethernet fronthaul protocol, as used to connect a RRU and a RAU to connect UEs and a eNodeB. UEs are simulated in a single `lte-uesoftmodem` process, as for the nfapi simulator. -## USRP record player +The [L1 simulator page](L1SIM.md) contains the detailed documentation. ## noS1 mode @@ -34,7 +34,15 @@ By default the noS1 mode is using linux tun interfaces to send or receive ip pac noS1 code has been revisited, it has been tested with the rf simulator, and tun interfaces. More tests are on going and CI will soon include noS1 tests. -## Monolithic eNodeB with USRP radio head +## Using USRP radio head + +[Monolithic eNodeB](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/HowToConnectCOTSUEwithOAIeNBNew) + + + + + + [oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) -- GitLab From 77bd7b0790e0f7058bfd357928f502b3d014435d Mon Sep 17 00:00:00 2001 From: frtabu <francois.taburet@nokia-bell-labs.com> Date: Sun, 17 Mar 2019 23:01:51 +0100 Subject: [PATCH 259/308] fix file name problem --- doc/{L2NFAP_S1I.md => L2NFAP_S1.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{L2NFAP_S1I.md => L2NFAP_S1.md} (100%) diff --git a/doc/L2NFAP_S1I.md b/doc/L2NFAP_S1.md similarity index 100% rename from doc/L2NFAP_S1I.md rename to doc/L2NFAP_S1.md -- GitLab From 53c7c4c1b05a350f791aa5b1cd87b36a2ba9fb42 Mon Sep 17 00:00:00 2001 From: frtabu <francois.taburet@nokia-bell-labs.com> Date: Sun, 17 Mar 2019 23:09:41 +0100 Subject: [PATCH 260/308] fix file name typo --- doc/{L2NFAP_S1.md => L2NFAPI_S1.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{L2NFAP_S1.md => L2NFAPI_S1.md} (100%) diff --git a/doc/L2NFAP_S1.md b/doc/L2NFAPI_S1.md similarity index 100% rename from doc/L2NFAP_S1.md rename to doc/L2NFAPI_S1.md -- GitLab From c7d7f88da0b7092b236fe4c1cb7bacdbeea909a9 Mon Sep 17 00:00:00 2001 From: frtabu <francois.taburet@nokia-bell-labs.com> Date: Sun, 17 Mar 2019 23:26:10 +0100 Subject: [PATCH 261/308] doc update --- doc/RUNMODEM.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index ce976c788a..de2c53074b 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -34,9 +34,12 @@ By default the noS1 mode is using linux tun interfaces to send or receive ip pac noS1 code has been revisited, it has been tested with the rf simulator, and tun interfaces. More tests are on going and CI will soon include noS1 tests. -## Using USRP radio head +## Running with a true radio head -[Monolithic eNodeB](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/HowToConnectCOTSUEwithOAIeNBNew) +oai supports [number of deployment](FEATURE_SET.md) model, the following are tested in the CI: + +1. [Monolithic eNodeB](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/HowToConnectCOTSUEwithOAIeNBNew) where the whole signal processing is performed in a single process +2. if4p5 mode, where frequency domain samples are carried over ethernet, from the RRU which implement part of L1(FFT,IFFT,part of PRACH), to a RAU -- GitLab From 69ccf51f96f923485a42774dca57fb0d194ee417 Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Tue, 12 Mar 2019 12:07:00 +0100 Subject: [PATCH 262/308] bugfix: fix compilation T has to be generated before compiling targets SCHED_RU_LIB and SCHED_UE_LIB. --- cmake_targets/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 95fc2cc150..70ed10ddad 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2231,9 +2231,9 @@ if (${T_TRACER}) oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_eth_transpro FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA - SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS - GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB PHY_MEX - coding) + SECU_CN SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY L2 default_sched + remote_sched RAL CN_UTILS GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS + LFDS7 SIMU OPENAIR0_LIB PHY_MEX coding) if (TARGET ${i}) add_dependencies(${i} generate_T) endif() -- GitLab From ee5b73901954deb33cdc6e6a7914d7e9c559e84e Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Thu, 14 Mar 2019 15:13:22 +0100 Subject: [PATCH 263/308] PHY: make sf_extension a parameter This parameter is meaningful in TDD, to decide when to start DL at eNB side. Since there is a need for the PA to be operational, we need to transmit a bit before the DL subframe coming after an UL subframe. (We transmit zeros.) We used to use N_TA_offset which may be too much. Default value is now N_TA_offset/2 and can be changed in the configuration file, in the RUs section, like: RUs = ( { local_rf = "yes" nb_tx = 1 nb_rx = 1 att_tx = 0 att_rx = 0; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 105; eNB_instances = [0]; sf_extension = 312; } ); N_TA_offset is 624 (for 30.72MHz). In the example above, we set sf_extension = 312, which is also the default. The value to put in the configuration file is for 30.72MHz. The value is scaled accordingly at runtime (thus only one value to set for every RB configuration, 25, 50 or 100, leading to less problems when adapting configuration files). This option is for experts and should not be changed randomly. --- openair1/PHY/defs_eNB.h | 2 ++ openair2/ENB_APP/enb_paramdef.h | 5 ++++- targets/RT/USER/lte-ru.c | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 271d54fdce..0c41328f32 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -312,6 +312,8 @@ typedef struct RU_t_s{ LTE_DL_FRAME_PARMS frame_parms; ///timing offset used in TDD int N_TA_offset; + /// SF extension used in TDD (unit: number of samples at 30.72MHz) (this is an expert option) + int sf_extension; /// RF device descriptor openair0_device rfdevice; /// HW configuration diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index b44ec9de16..edbb34461a 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -101,6 +101,7 @@ typedef enum { #define CONFIG_STRING_RU_NBIOTRRC_LIST "NbIoT_RRC_instances" #define CONFIG_STRING_RU_SDR_ADDRS "sdr_addrs" #define CONFIG_STRING_RU_SDR_CLK_SRC "clock_src" +#define CONFIG_STRING_RU_SF_EXTENSION "sf_extension" #define RU_LOCAL_IF_NAME_IDX 0 #define RU_LOCAL_ADDRESS_IDX 1 @@ -122,6 +123,7 @@ typedef enum { #define RU_NBIOTRRC_LIST_IDX 17 #define RU_SDR_ADDRS 18 #define RU_SDR_CLK_SRC 19 +#define RU_SF_EXTENSION_IDX 20 @@ -149,7 +151,8 @@ typedef enum { {CONFIG_STRING_RU_ATT_RX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_NBIOTRRC_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFENBS, TYPE_INTARRAY, 1}, \ {CONFIG_STRING_RU_SDR_ADDRS, NULL, 0, strptr:NULL, defstrval:"type=b200", TYPE_STRING, 0}, \ -{CONFIG_STRING_RU_SDR_CLK_SRC, NULL, 0, strptr:NULL, defstrval:"internal", TYPE_STRING, 0}, \ +{CONFIG_STRING_RU_SDR_CLK_SRC, NULL, 0, strptr:NULL, defstrval:"internal", TYPE_STRING, 0}, \ +{CONFIG_STRING_RU_SF_EXTENSION, NULL, 0, uptr:NULL, defuintval:312, TYPE_UINT, 0}, \ } /*---------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 787e630d17..002190ec53 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -835,7 +835,7 @@ void tx_rf(RU_t *ru) { (prevSF_type == SF_UL) && (nextSF_type == SF_DL)) { flags = 2; // start of burst - sf_extension = ru->N_TA_offset; + sf_extension = ru->sf_extension; } if ((fp->frame_type == TDD) && @@ -843,7 +843,7 @@ void tx_rf(RU_t *ru) { (prevSF_type == SF_UL) && (nextSF_type == SF_UL)) { flags = 4; // start of burst and end of burst (only one DL SF between two UL) - sf_extension = ru->N_TA_offset; + sf_extension = ru->sf_extension; } #if defined(__x86_64) || defined(__i386__) @@ -1386,6 +1386,14 @@ int setup_RU_buffers(RU_t *ru) { * TODO: find a proper cleaner solution */ ru->N_TA_offset = 0; + + if (frame_parms->N_RB_DL == 100) /* no scaling to do */; + else if (frame_parms->N_RB_DL == 50) ru->sf_extension /= 2; + else if (frame_parms->N_RB_DL == 25) ru->sf_extension /= 4; + else { printf("not handled, todo\n"); exit(1); } + } else { + ru->N_TA_offset = 0; + ru->sf_extension = 0; } if (ru->openair0_cfg.mmapped_dma == 1) { @@ -2883,6 +2891,8 @@ void RCconfig_RU(void) { RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);; RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr); RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; + /* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */ + RC.ru[j]->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr); for (i=0; i<RC.ru[j]->num_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; } //strcmp(local_rf, "yes") == 0 -- GitLab From 1e71749cdfd1704e446c41e9cda9f813b3768a48 Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Fri, 15 Mar 2019 11:37:54 +0100 Subject: [PATCH 264/308] PHY: bugfix: use correct count of samples for TDD DL S-subframe --- targets/RT/USER/lte-ru.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 002190ec53..5a16a2ab7a 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -826,7 +826,8 @@ void tx_rf(RU_t *ru) { int siglen=fp->samples_per_tti,flags=1; if (SF_type == SF_S) { - siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0); + siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + + (fp->dl_symbols_in_S_subframe - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); flags=3; // end of burst } -- GitLab From a05753dff38ff20377331b9f8a8e719393ca44bf Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Fri, 15 Mar 2019 11:40:59 +0100 Subject: [PATCH 265/308] PHY: bugfix: compute start/end of burst correctly for TDD Start of burst is to start TDD DL transmission in the driver (tested with USRP for the moment). End of burst is to stop DL transmission. Start of burst can only happen for a DL subframe when the previous subframe was an UL subframe. End of burst can only happen for an S subframe. It's impossible for a subframe to be both the start of a burst and the end of a burst. This can be checked with eg. http://niviuk.free.fr/lte_resource_grid.html (or reading the specs). --- targets/RT/USER/lte-ru.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 5a16a2ab7a..cedd0be270 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -818,7 +818,6 @@ void tx_rf(RU_t *ru) { T_INT(0), T_BUFFER(&ru->common.txdata[0][proc->subframe_tx * fp->samples_per_tti], fp->samples_per_tti * 4)); lte_subframe_t SF_type = subframe_select(fp,proc->subframe_tx%10); lte_subframe_t prevSF_type = subframe_select(fp,(proc->subframe_tx+9)%10); - lte_subframe_t nextSF_type = subframe_select(fp,(proc->subframe_tx+1)%10); int sf_extension = 0; if ((SF_type == SF_DL) || @@ -831,22 +830,13 @@ void tx_rf(RU_t *ru) { flags=3; // end of burst } - if ((fp->frame_type == TDD) && - (SF_type == SF_DL)&& - (prevSF_type == SF_UL) && - (nextSF_type == SF_DL)) { + if (fp->frame_type == TDD && + SF_type == SF_DL && + prevSF_type == SF_UL) { flags = 2; // start of burst sf_extension = ru->sf_extension; } - if ((fp->frame_type == TDD) && - (SF_type == SF_DL)&& - (prevSF_type == SF_UL) && - (nextSF_type == SF_UL)) { - flags = 4; // start of burst and end of burst (only one DL SF between two UL) - sf_extension = ru->sf_extension; - } - #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ sf_extension = (sf_extension)&0xfffffff8; -- GitLab From 275e5b3a64188ae1399bdfcd1e27e6b5ecb6641c Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Fri, 15 Mar 2019 12:14:45 +0100 Subject: [PATCH 266/308] PHY: add parameter end_of_burst_delay for TDD end_of_burst_delay is used to stop TX only "after a while". If we stop right after effective signal, with USRP B210 and B200mini, we observe a high EVM on the S subframe (on the PSS). A value of 400 (for 30.72MHz) solves this issue. This is the default. This default value can be changed in the configuration file. For example: RUs = ( { local_rf = "yes" nb_tx = 1 nb_rx = 1 att_tx = 20 att_rx = 0; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 105; eNB_instances = [0]; sf_extension = 312; end_of_burst_delay = 200; } ); Here we would set a value of 200. The value to put in the configuration file is for 30.72MHz. The value is scaled accordingly at runtime (thus only one value to set for every RB configuration, 25, 50 or 100, leading to less problems when adapting configuration files). This option is for experts and should not be changed randomly. --- openair1/PHY/defs_eNB.h | 2 ++ openair2/ENB_APP/enb_paramdef.h | 3 +++ targets/RT/USER/lte-ru.c | 25 +++++++++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 0c41328f32..d3157d5e82 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -314,6 +314,8 @@ typedef struct RU_t_s{ int N_TA_offset; /// SF extension used in TDD (unit: number of samples at 30.72MHz) (this is an expert option) int sf_extension; + /// "end of burst delay" used in TDD (unit: number of samples at 30.72MHz) (this is an expert option) + int end_of_burst_delay; /// RF device descriptor openair0_device rfdevice; /// HW configuration diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index edbb34461a..b0fb97dac1 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -102,6 +102,7 @@ typedef enum { #define CONFIG_STRING_RU_SDR_ADDRS "sdr_addrs" #define CONFIG_STRING_RU_SDR_CLK_SRC "clock_src" #define CONFIG_STRING_RU_SF_EXTENSION "sf_extension" +#define CONFIG_STRING_RU_END_OF_BURST_DELAY "end_of_burst_delay" #define RU_LOCAL_IF_NAME_IDX 0 #define RU_LOCAL_ADDRESS_IDX 1 @@ -124,6 +125,7 @@ typedef enum { #define RU_SDR_ADDRS 18 #define RU_SDR_CLK_SRC 19 #define RU_SF_EXTENSION_IDX 20 +#define RU_END_OF_BURST_DELAY_IDX 21 @@ -153,6 +155,7 @@ typedef enum { {CONFIG_STRING_RU_SDR_ADDRS, NULL, 0, strptr:NULL, defstrval:"type=b200", TYPE_STRING, 0}, \ {CONFIG_STRING_RU_SDR_CLK_SRC, NULL, 0, strptr:NULL, defstrval:"internal", TYPE_STRING, 0}, \ {CONFIG_STRING_RU_SF_EXTENSION, NULL, 0, uptr:NULL, defuintval:312, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_END_OF_BURST_DELAY, NULL, 0, uptr:NULL, defuintval:400, TYPE_UINT, 0}, \ } /*---------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index cedd0be270..d4c53441d6 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -825,8 +825,16 @@ void tx_rf(RU_t *ru) { int siglen=fp->samples_per_tti,flags=1; if (SF_type == SF_S) { + /* end_of_burst_delay is used to stop TX only "after a while". + * If we stop right after effective signal, with USRP B210 and + * B200mini, we observe a high EVM on the S subframe (on the + * PSS). + * A value of 400 (for 30.72MHz) solves this issue. This is + * the default. + */ siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) - + (fp->dl_symbols_in_S_subframe - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + + (fp->dl_symbols_in_S_subframe - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples) + + ru->end_of_burst_delay; flags=3; // end of burst } @@ -1379,12 +1387,20 @@ int setup_RU_buffers(RU_t *ru) { ru->N_TA_offset = 0; if (frame_parms->N_RB_DL == 100) /* no scaling to do */; - else if (frame_parms->N_RB_DL == 50) ru->sf_extension /= 2; - else if (frame_parms->N_RB_DL == 25) ru->sf_extension /= 4; - else { printf("not handled, todo\n"); exit(1); } + else if (frame_parms->N_RB_DL == 50) { + ru->sf_extension /= 2; + ru->end_of_burst_delay /= 2; + } else if (frame_parms->N_RB_DL == 25) { + ru->sf_extension /= 4; + ru->end_of_burst_delay /= 4; + } else { + printf("not handled, todo\n"); + exit(1); + } } else { ru->N_TA_offset = 0; ru->sf_extension = 0; + ru->end_of_burst_delay = 0; } if (ru->openair0_cfg.mmapped_dma == 1) { @@ -2884,6 +2900,7 @@ void RCconfig_RU(void) { RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; /* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */ RC.ru[j]->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr); + RC.ru[j]->end_of_burst_delay = *(RUParamList.paramarray[j][RU_END_OF_BURST_DELAY_IDX].uptr); for (i=0; i<RC.ru[j]->num_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; } //strcmp(local_rf, "yes") == 0 -- GitLab From 9fd0f9f8bf45e1c6f037c6df3d3429968c34ed5f Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 19 Mar 2019 15:48:00 +0100 Subject: [PATCH 267/308] Re-comment Assert for unconfigured RLC as in current develop --- openair2/LAYER2/RLC/rlc_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index df4bac2e09..b539970704 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -293,7 +293,7 @@ void mac_rlc_data_ind ( rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; - AssertFatal (0 , "%s RLC not configured lcid %u ! (h_rc %d)\n", __FUNCTION__,channel_idP,h_rc); + //AssertFatal (0 , "%s RLC not configured lcid %u ! (h_rc %d)\n", __FUNCTION__,channel_idP,h_rc); } struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP); -- GitLab From b7155f027627bb0cb87b74f7c621ff1f46edafb0 Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Thu, 21 Mar 2019 10:49:32 +0100 Subject: [PATCH 268/308] cleanup: remove a file that should not be here --- .../LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# | 534 ------------------ 1 file changed, 534 deletions(-) delete mode 100644 openair2/LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# b/openair2/LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# deleted file mode 100644 index e6a7929024..0000000000 --- a/openair2/LAYER2/RLC/AM_v9.3.0/#rlc_am_receiver.c# +++ /dev/null @@ -1,534 +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 - */ - -#define RLC_AM_MODULE 1 -#define RLC_AM_RECEIVER_C 1 -#include "platform_types.h" -//----------------------------------------------------------------------------- -#include "assertions.h" -#include "msc.h" -#include "rlc.h" -#include "rlc_am.h" -#include "list.h" -#include "LAYER2/MAC/mac_extern.h" -#include "common/utils/LOG/log.h" - - -//----------------------------------------------------------------------------- -signed int -rlc_am_get_data_pdu_infos( - const protocol_ctxt_t* const ctxt_pP, - const rlc_am_entity_t* const rlc_pP, - rlc_am_pdu_sn_10_t* header_pP, - int16_t total_sizeP, - rlc_am_pdu_info_t* pdu_info_pP) -{ - memset(pdu_info_pP, 0, sizeof (rlc_am_pdu_info_t)); - - int16_t sum_li = 0; - pdu_info_pP->d_c = header_pP->b1 >> 7; - pdu_info_pP->num_li = 0; - -//Assertion(eNB)_PRAN_DesignDocument_annex No.766 - if(pdu_info_pP->d_c == 0) - { - LOG_E(RLC, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id); - return -2; - } -/* - AssertFatal (pdu_info_pP->d_c != 0, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id); -*/ - pdu_info_pP->rf = (header_pP->b1 >> 6) & 0x01; - pdu_info_pP->p = (header_pP->b1 >> 5) & 0x01; - pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03; - pdu_info_pP->e = (header_pP->b1 >> 2) & 0x01; - pdu_info_pP->sn = header_pP->b2 + (((uint16_t)(header_pP->b1 & 0x03)) << 8); - - pdu_info_pP->header_size = 2; - - if (pdu_info_pP->rf) { - pdu_info_pP->lsf = (header_pP->data[0] >> 7) & 0x01; - pdu_info_pP->so = header_pP->data[1] + (((uint16_t)(header_pP->data[0] & 0x7F)) << 8); - pdu_info_pP->payload = &header_pP->data[2]; - pdu_info_pP->header_size += 2; - } else { - pdu_info_pP->payload = &header_pP->data[0]; - } - - if (pdu_info_pP->e) { - rlc_am_e_li_t *e_li; - unsigned int li_length_in_bytes = 1; - unsigned int li_to_read = 1; - - if (pdu_info_pP->rf) { - e_li = (rlc_am_e_li_t*)(&header_pP->data[2]); - } else { - e_li = (rlc_am_e_li_t*)(header_pP->data); - } - - while (li_to_read) { - li_length_in_bytes = li_length_in_bytes ^ 3; - - if (li_length_in_bytes == 2) { - pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li->b1 << 4)) & 0x07F0; - pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((uint8_t)(e_li->b2 >> 4)) & 0x000F); - li_to_read = e_li->b1 & 0x80; - pdu_info_pP->header_size += 2; - } else { - pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li->b2 << 8)) & 0x0700; - pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li->b3; - li_to_read = e_li->b2 & 0x08; - e_li++; - pdu_info_pP->header_size += 1; - } - - sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li]; - pdu_info_pP->num_li = pdu_info_pP->num_li + 1; - - if (pdu_info_pP->num_li > RLC_AM_MAX_SDU_IN_PDU) { - LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), - pdu_info_pP->sn); - return -2; - } - } - - if (li_length_in_bytes == 2) { - pdu_info_pP->payload = &e_li->b3; - } else { - pdu_info_pP->payload = &e_li->b1; - } - } - - pdu_info_pP->payload_size = total_sizeP - pdu_info_pP->header_size; - - if (pdu_info_pP->payload_size > sum_li) { - pdu_info_pP->hidden_size = pdu_info_pP->payload_size - sum_li; - } - - return 0; -} -//----------------------------------------------------------------------------- -void -rlc_am_display_data_pdu_infos( - const protocol_ctxt_t* const ctxt_pP, - rlc_am_entity_t * const rlc_pP, - rlc_am_pdu_info_t* pdu_info_pP) -{ - int num_li; - - if (pdu_info_pP->d_c) { - if (pdu_info_pP->rf) { - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d SO %05d LSF %01d POLL %1d ", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), - pdu_info_pP->sn, - pdu_info_pP->fi, - pdu_info_pP->so, - pdu_info_pP->lsf, pdu_info_pP->p); - } else { - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d POLL %1d ", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), - pdu_info_pP->sn, - pdu_info_pP->fi, - pdu_info_pP->p); - } - - for (num_li = 0; num_li < pdu_info_pP->num_li; num_li++) { - LOG_D(RLC, "LI %05d ", pdu_info_pP->li_list[num_li]); - } - - if (pdu_info_pP->hidden_size > 0) { - LOG_D(RLC, "hidden size %05d ", pdu_info_pP->hidden_size); - } - - LOG_D(RLC, "\n"); - } else { - LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] ERROR RX CONTROL PDU\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); - } -} -// assumed the sn of the tb_p is equal to VR(MS) -//----------------------------------------------------------------------------- -void -rlc_am_rx_update_vr_ms( - const protocol_ctxt_t* const ctxt_pP, - rlc_am_entity_t * const rlc_pP, - mem_block_t* tb_pP) -{ - //rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; - rlc_am_pdu_info_t* pdu_info_cursor_p = NULL; - mem_block_t* cursor_p; - - cursor_p = tb_pP; - - if (cursor_p) { - do { - pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info; - - if ((((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) || - (rlc_pP->vr_ms != pdu_info_cursor_p->sn)) { - -#if TRACE_RLC_AM_RX - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), - rlc_pP->vr_ms, pdu_info_cursor_p->sn); -#endif - - return; - } - - rlc_pP->vr_ms = RLC_AM_NEXT_SN(pdu_info_cursor_p->sn); - cursor_p = cursor_p->next; - } while ((cursor_p != NULL) && (rlc_pP->vr_ms != rlc_pP->vr_h)); - - } -} -// assumed the sn of the tb_p is equal to VR(R) -//----------------------------------------------------------------------------- -void -rlc_am_rx_update_vr_r( - const protocol_ctxt_t* const ctxt_pP, - rlc_am_entity_t * const rlc_pP, - mem_block_t* tb_pP) -{ - rlc_am_pdu_info_t* pdu_info_cursor_p = NULL; - mem_block_t* cursor_p; - - cursor_p = tb_pP; - - if (cursor_p) { - do { - pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info; - - if ((((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) || - (rlc_pP->vr_r != pdu_info_cursor_p->sn)) { - return; - } - -#if TRACE_RLC_AM_RX - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[UPDATE VR(R)] UPDATED VR(R) %04d -> %04d\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), - rlc_pP->vr_r, - (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK); -#endif - - if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.rf == 1) { - if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.lsf == 1) { - rlc_pP->vr_r = (rlc_pP->vr_r + 1) & RLC_AM_SN_MASK; - } - } else { - rlc_pP->vr_r = (rlc_pP->vr_r + 1) & RLC_AM_SN_MASK; - } - - cursor_p = cursor_p->next; - } while (cursor_p != NULL); - - //rlc_pP->vr_r = (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK; - } -} -//----------------------------------------------------------------------------- -void -rlc_am_receive_routing ( - const protocol_ctxt_t* const ctxt_pP, - rlc_am_entity_t * const rlc_pP, - struct mac_data_ind data_indP) -{ - mem_block_t *tb_p = NULL; - uint8_t *first_byte_p = NULL; - sdu_size_t tb_size_in_bytes; - RLC_AM_MUTEX_LOCK(&rlc_pP->lock_input_sdus, ctxt_pP, rlc_pP); - - while ((tb_p = list_remove_head (&data_indP.data))) { - first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr; - tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size; - - if (tb_size_in_bytes > 0) { - if ((*first_byte_p & 0x80) == 0x80) { - rlc_pP->stat_rx_data_bytes += tb_size_in_bytes; - rlc_pP->stat_rx_data_pdu += 1; - rlc_am_receive_process_data_pdu (ctxt_pP, rlc_pP, tb_p, first_byte_p, tb_size_in_bytes); - } else { - rlc_pP->stat_rx_control_bytes += tb_size_in_bytes; - rlc_pP->stat_rx_control_pdu += 1; - rlc_am_receive_process_control_pdu (ctxt_pP, rlc_pP, tb_p, &first_byte_p, &tb_size_in_bytes); - // Test if remaining bytes not processed (up to know, highest probability is bug in MAC) -//Assertion(eNB)_PRAN_DesignDocument_annex No.767 - if(tb_size_in_bytes != 0) - { - LOG_E(RLC, "Remaining %d bytes following a control PDU\n", - tb_size_in_bytes); - } -/* - AssertFatal( tb_size_in_bytes == 0, - "Remaining %d bytes following a control PDU", - tb_size_in_bytes); -*/ - } - - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RX ROUTING] VR(R)=%03d VR(MR)=%03d\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), - rlc_pP->vr_r, - rlc_pP->vr_mr); - } - } // end while - RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus); -} -//----------------------------------------------------------------------------- -void -rlc_am_receive_process_data_pdu ( - const protocol_ctxt_t* const ctxt_pP, - rlc_am_entity_t * const rlc_pP, - mem_block_t* tb_pP, - uint8_t* first_byte_pP, - uint16_t tb_size_in_bytesP) -{ - // 5.1.3.2 Receive operations - // 5.1.3.2.1 General - // The receiving side of an AM RLC entity shall maintain a receiving window according to state variables VR(R) and - // VR(MR) as follows: - // - a SN falls within the receiving window if VR(R) <= SN < VR(MR); - // - a SN falls outside of the receiving window otherwise. - // - // When receiving a RLC data PDU from lower layer, the receiving side of an AM RLC entity shall: - // - either discard the received RLC data PDU or place it in the reception buffer (see sub clause 5.1.3.2.2); - // - if the received RLC data PDU was placed in the reception buffer: - // - update state variables, reassemble and deliver RLC SDUs to upper layer and start/stop t-Reordering as - // needed (see sub clause 5.1.3.2.3). - // When t-Reordering expires, the receiving side of an AM RLC entity shall: - // - update state variables and start t-Reordering as needed (see sub clause 5.1.3.2.4). - - - // 5.1.3.2.2 Actions when a RLC data PDU is received from lower layer - // When a RLC data PDU is received from lower layer, where the RLC data PDU contains byte segment numbers y to z of - // an AMD PDU with SN = x, the receiving side of an AM RLC entity shall: - // - if x falls outside of the receiving window; or - // - if byte segment numbers y to z of the AMD PDU with SN = x have been received before: - // - discard the received RLC data PDU; - // - else: - // - place the received RLC data PDU in the reception buffer; - // - if some byte segments of the AMD PDU contained in the RLC data PDU have been received before: - // - discard the duplicate byte segments. - rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; - rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)first_byte_pP; - rlc_am_rx_pdu_status_t pdu_status = RLC_AM_DATA_PDU_STATUS_OK; - boolean_t reassemble = false; - - if (rlc_am_get_data_pdu_infos(ctxt_pP,rlc_pP, rlc_am_pdu_sn_10_p, tb_size_in_bytesP, pdu_info_p) >= 0) { - - ((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received = 0; - - if (RLC_AM_SN_IN_WINDOW(pdu_info_p->sn, rlc_pP->vr_r)) { - - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SN=%04d] VR(R) %04d VR(H) %04d VR(MR) %04d VR(MS) %04d VR(X) %04d\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), - pdu_info_p->sn, - rlc_pP->vr_r, - rlc_pP->vr_h, - rlc_pP->vr_mr, - rlc_pP->vr_ms, - rlc_pP->vr_x); - - pdu_status = rlc_am_rx_list_check_duplicate_insert_pdu(ctxt_pP, rlc_pP,tb_pP); - if (pdu_status != RLC_AM_DATA_PDU_STATUS_OK) { - rlc_pP->stat_rx_data_pdu_dropped += 1; - rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP; - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED CAUSE=%d SN=%d\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_status,pdu_info_p->sn); -#if RLC_STOP_ON_LOST_PDU - AssertFatal( 0 == 1, - PROTOCOL_RLC_AM_CTXT_FMT" LOST PDU DETECTED\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); -#endif - } else { - // 5.1.3.2.3 - // Actions when a RLC data PDU is placed in the reception buffer - // - // When a RLC data PDU with SN = x is placed in the reception buffer, the receiving side of an AM RLC entity shall: - // - if x >= VR(H) - // - update VR(H) to x+ 1; - // - // - if all byte segments of the AMD PDU with SN = VR(MS) are received: - // - update VR(MS) to the SN of the first AMD PDU with SN > current VR(MS) for which not all byte segments - // have been received; - // - // - if x = VR(R): - // - if all byte segments of the AMD PDU with SN = VR(R) are received: - // - update VR(R) to the SN of the first AMD PDU with SN > current VR(R) for which not all byte segments - // have been received; - // - update VR(MR) to the updated VR(R) + AM_Window_Size; - // - // - reassemble RLC SDUs from any byte segments of AMD PDUs with SN that falls outside of the receiving - // window and in-sequence byte segments of the AMD PDU with SN = VR(R), remove RLC headers when - // doing so and deliver the reassembled RLC SDUs to upper layer in sequence if not delivered before; - // - // - if t-Reordering is running: - // - if VR(X) = VR(R); or - // - if VR(X) falls outside of the receiving window and VR(X) is not equal to VR(MR): - // - stop and reset t-Reordering; - // - // - if t-Reordering is not running (includes the case t-Reordering is stopped due to actions above): - // - if VR (H) > VR(R): - // - start t-Reordering; - // - set VR(X) to VR(H). - - -#if TRACE_RLC_AM_RX - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] RX LIST AFTER INSERTION:\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); - rlc_am_rx_list_display(rlc_pP, "rlc_am_receive_process_data_pdu AFTER INSERTION "); -#endif - - /* 1) Update vrH if sn >= vrH */ - if (RLC_AM_DIFF_SN(pdu_info_p->sn,rlc_pP->vr_r) >= RLC_AM_DIFF_SN(rlc_pP->vr_h,rlc_pP->vr_r)) - { - rlc_pP->vr_h = RLC_AM_NEXT_SN(pdu_info_p->sn); - } - - rlc_am_rx_check_all_byte_segments(ctxt_pP, rlc_pP, tb_pP); - - /* 2) Reordering Window Processing: Update vr_ms if sn = vr_ms and all bytes received for sn */ - if ((pdu_info_p->sn == rlc_pP->vr_ms) && (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received)) { - rlc_am_rx_update_vr_ms(ctxt_pP, rlc_pP, tb_pP); - } - - if (pdu_info_p->sn == rlc_pP->vr_r) { -mem_block_t* cursor_p = rlc_pP->receiver_buffer.head; -rlc_am_rx_pdu_management_t * pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data); -if( (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) == (pdu_cursor_mgnt_p->all_segments_received)){ - if (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) { - rlc_am_rx_update_vr_r(ctxt_pP, rlc_pP, tb_pP); - rlc_pP->vr_mr = (rlc_pP->vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK; - } - reassemble = rlc_am_rx_check_vr_reassemble(ctxt_pP, rlc_pP); - //TODO : optimization : check whether a reassembly is needed by looking at LI, FI, SO, etc... -}else{ - LOG_E(RLC, "BAD all_segments_received!!! discard buffer!!!\n"); - /* Discard received block if out of window, duplicate or header error */ - free_mem_block (tb_pP, __func__); -} - } - - //FNA: fix check VrX out of receiving window - if ((rlc_pP->t_reordering.running) || ((rlc_pP->t_reordering.ms_duration == 0) && (rlc_pP->vr_x != RLC_SN_UNDEFINED))) { - if ((rlc_pP->vr_x == rlc_pP->vr_r) || (!(RLC_AM_SN_IN_WINDOW(rlc_pP->vr_x, rlc_pP->vr_r)) && (rlc_pP->vr_x != rlc_pP->vr_mr))) { - rlc_am_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP); - rlc_pP->vr_x = RLC_SN_UNDEFINED; - } - } - - if (!(rlc_pP->t_reordering.running)) { - if (rlc_pP->vr_h != rlc_pP->vr_r) { // - if VR (H) > VR(R) translated to - if VR (H) != VR(R) - rlc_pP->vr_x = rlc_pP->vr_h; - if (rlc_pP->t_reordering.ms_duration != 0) { - rlc_am_start_timer_reordering(ctxt_pP, rlc_pP); - } - else { - /* specific case for no timer reordering configured */ - /* reordering window directly advances with vrH */ - rlc_pP->vr_ms = rlc_pP->vr_h; - - /* Trigger a Status and clear any existing Delay Flag */ - RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_T_REORDERING); - RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED); - rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED; - } - } - } - } - - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SN=%04d] NEW VR(R) %04d VR(H) %04d VR(MS) %04d VR(MR) %04d VR(X) %04d reassemble=%d\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), - pdu_info_p->sn, - rlc_pP->vr_r, - rlc_pP->vr_h, - rlc_pP->vr_ms, - rlc_pP->vr_mr, - rlc_pP->vr_x, - reassemble); - } else { - rlc_pP->stat_rx_data_pdu_out_of_window += 1; - rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP; - pdu_status = RLC_AM_DATA_PDU_STATUS_SN_OUTSIDE_WINDOW; - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, SN=%d\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_info_p->sn); - } - - /* 3) Check for triggering a Tx Status PDU if a poll is received or if a pending status was delayed */ - if ((pdu_info_p->p) && (pdu_status < RLC_AM_DATA_PDU_STATUS_BUFFER_FULL)) { - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] POLL BIT SET, STATUS REQUESTED:\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); - - /* Polling Info Saving for In and Out of Window PDU */ - /* avoid multi status trigger */ - if ((RLC_AM_GET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED)) || - !(RLC_AM_GET_STATUS(rlc_pP->status_requested,(RLC_AM_STATUS_TRIGGERED_POLL | RLC_AM_STATUS_TRIGGERED_T_REORDERING)))) - { - RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_POLL); - - if ((pdu_status != RLC_AM_DATA_PDU_STATUS_OK) || ((pdu_status == RLC_AM_DATA_PDU_STATUS_OK) && - (!(RLC_AM_SN_IN_WINDOW(pdu_info_p->sn,rlc_pP->vr_r)) || - (RLC_AM_DIFF_SN(pdu_info_p->sn,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r))) - ) - ) - { - /* Conditions are met for sending a Status Report */ - /* Then clear Delay Flag and reset its corresponding sn */ - RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED); - rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED; - } - else if (rlc_pP->sn_status_triggered_delayed == RLC_SN_UNDEFINED) - { - /* Delay status trigger if pdustatus OK and sn>= vr_ms */ - /* Note: vr_r and vr_ms have been updated */ - RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED); - rlc_pP->sn_status_triggered_delayed = pdu_info_p->sn; - } - } - } - - /* ReEnable a previously delayed Status Trigger if PDU discarded or */ - /* sn no more in RxWindow due to RxWindow advance or sn < vr_ms */ - if ((RLC_AM_GET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED)) && - (pdu_status == RLC_AM_DATA_PDU_STATUS_OK) && - (!(RLC_AM_SN_IN_WINDOW(rlc_pP->sn_status_triggered_delayed,rlc_pP->vr_r)) || - (RLC_AM_DIFF_SN(rlc_pP->sn_status_triggered_delayed,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r))) - ) - { - RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED); - rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED; - } - - - } else { - pdu_status = RLC_AM_DATA_PDU_STATUS_HEADER_ERROR; - LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED BAD HEADER FORMAT SN=%d\n", - PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_info_p->sn); - } - - if (pdu_status != RLC_AM_DATA_PDU_STATUS_OK) { - /* Discard received block if out of window, duplicate or header error */ - free_mem_block (tb_pP, __func__); - } - else if (reassemble) { - /* Reassemble SDUs */ - rlc_am_rx_list_reassemble_rlc_sdus(ctxt_pP, rlc_pP); - } -} -- GitLab From df49d8a90845c52a35ed9317d5b065cff1fffb72 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Mon, 11 Mar 2019 15:00:36 +0100 Subject: [PATCH 269/308] No more 'none' value. Successfully writing the log file ue_080101.log and finding the sync marker. Initialize OAI UE is working. BuildOAIUE action seems ok. Must fix the log file path for the InitializeOAIUE action. Doing the work in /tmp, not in the repository of the main.py script being executed. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 406 +++++++++++++----- ci-scripts/xml_files/ue_band20_test_10mhz.xml | 35 +- ci-scripts/xml_files/ue_sfr_796.xml | 44 ++ 3 files changed, 378 insertions(+), 107 deletions(-) create mode 100644 ci-scripts/xml_files/ue_sfr_796.xml diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 355d75cd1d..5e113dd413 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -1,4 +1,3 @@ -#/* # * 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. @@ -132,17 +131,17 @@ class SSHConnection(): #self.UECpuNb = '' #self.UECpuModel = '' self.UEIPAddress = '' - self.UERepository = '' self.UEBranch = '' #self.UE_AllowMerge = False self.UECommitID = '' #self.UETargetBranch = '' self.UEUserName = '' self.UEPassword = '' + self.UE_instance = '' #self.UESourceCodePath = '' #self.UECpuMHz = '' - self.Build_eNB_args = '' - self.Initialize_eNB_args = '' + self.Build_OAI_UE_args = '' + self.Initialize_OAI_UE_args = '' def open(self, ipaddress, username, password): @@ -345,40 +344,41 @@ class SSHConnection(): self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) def BuildOAIUE(self): - if self.UEIPAddress == '' or self.UERepository == '' or self.UEBranch == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': + return + if self.UEIPAddress == '' or self.eNBRepository == '' or self.eNBBranch == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': Usage() sys.exit('Insufficient Parameter') self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) self.command('mkdir -p ' + self.UESourceCodePath, '\$', 5) self.command('cd ' + self.UESourceCodePath, '\$', 5) - self.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + self.UERepository + ' .; else stdbuf -o0 git fetch; fi', '\$', 600) + self.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + self.eNBRepository + ' .; else stdbuf -o0 git fetch; fi', '\$', 600) # here add a check if git clone or git fetch went smoothly self.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) self.command('git config user.name "OAI Jenkins"', '\$', 5) self.command('echo ' + self.UEPassword + ' | sudo -S git clean -x -d -ff', '\$', 30) # if the commit ID is provided use it to point to it - if self.UECommitID != '': - self.command('git checkout -f ' + self.UECommitID, '\$', 5) + if self.eNBCommitID != '': + self.command('git checkout -f ' + self.eNBCommitID, '\$', 5) # if the branch is not develop, then it is a merge request and we need to do # the potential merge. Note that merge conflicts should already been checked earlier - if (self.UE_AllowMerge): - if self.UETargetBranch == '': - if (self.UEBranch != 'develop') and (self.UEBranch != 'origin/develop'): + if (self.eNB_AllowMerge): + if self.eNBTargetBranch == '': + if (self.eNBBranch != 'develop') and (self.eNBBranch != 'origin/develop'): self.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) else: - logging.debug('Merging with the target branch: ' + self.UETargetBranch) - self.command('git merge --ff origin/' + self.UETargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + logging.debug('Merging with the target branch: ' + self.eNBTargetBranch) + self.command('git merge --ff origin/' + self.eNBTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) self.command('source oaienv', '\$', 5) self.command('cd cmake_targets', '\$', 5) self.command('mkdir -p log', '\$', 5) self.command('chmod 777 log', '\$', 5) # no need to remove in log (git clean did the trick) - self.command('stdbuf -o0 ./build_oai ' + self.Build_UE_args + ' 2>&1 | stdbuf -o0 tee -a compile_oai_ue.log', 'Bypassing the Tests', 600) + self.command('stdbuf -o0 ./build_oai ' + self.Build_OAI_UE_args + ' 2>&1 | stdbuf -o0 tee -a compile_oai_ue.log', 'Bypassing the Tests', 600) self.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) self.command('mv compile_oai_ue.log ' + 'build_log_' + self.testCase_id, '\$', 5) self.close() - self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) + self.CreateHtmlTestRow(self.Build_OAI_UE_args, 'OK', ALL_PROCESSES_OK) def InitializeHSS(self): @@ -493,8 +493,8 @@ class SSHConnection(): # Launch eNB with the modified config file self.command('source oaienv', '\$', 5) self.command('cd cmake_targets', '\$', 5) - self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5) - self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5) + self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) + self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5) self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(self.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) if not rruCheck: @@ -561,7 +561,6 @@ class SSHConnection(): def InitializeUE(self): if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': Usage() - print('InitializeUE') sys.exit('Insufficient Parameter') multi_jobs = [] for device_id in self.UEDevices: @@ -576,92 +575,84 @@ class SSHConnection(): def InitializeOAIUE(self): if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': Usage() - print('DEBUG InitializeOAIUE 1') sys.exit('Insufficient Parameter') - initialize_UE_flag = True - pStatus = self.CheckProcessExist(initialize_UE_flag) - if (pStatus < 0): - self.CreateHtmlTestRow(self.Initialize_UE_args, 'KO', pStatus) - self.CreateHtmlTabFooter(False) - sys.exit(1) + #initialize_OAI_UE_flag = True + #pStatus = self.CheckOAIUEProcessExist(initialize_OAI_UE_flag) + #if (pStatus < 0): + # self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'KO', pStatus) + # self.CreateHtmlTabFooter(False) + # sys.exit(1) self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) self.command('cd ' + self.UESourceCodePath, '\$', 5) - # Initialize_UE_args usually start with -O and followed by the location in repository - full_config_file = self.Initialize_UE_args.replace('-O ','') - extIdx = full_config_file.find('.conf') - if (extIdx > 0): - extra_options = full_config_file[extIdx + 5:] - # if tracer options is on, compiling and running T Tracer - result = re.search('T_stdout', str(extra_options)) - if result is not None: - logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m') - self.command('cd common/utils/T/tracer', '\$', 5) - self.command('make', '\$', 10) - self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.UESourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.UESourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.log 2>&1 &', self.UEUserName, 5) - self.command('cd ' + self.UESourceCodePath, '\$', 5) - full_config_file = full_config_file[:extIdx + 5] - config_path, config_file = os.path.split(full_config_file) - else: - print('DEBUG InitializeOAIUE 2') - sys.exit('Insufficient Parameter') - ci_full_config_file = config_path + '/ci-' + config_file - rruCheck = False - result = re.search('rru', str(config_file)) - if result is not None: - rruCheck = True - # Make a copy and adapt to EPC / UE IP addresses - self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) - self.command('sed -i -e \'s/CI_UE_IP_ADDR/' + self.UEIPAddress + '/\' ' + ci_full_config_file, '\$', 2); + # Initialize_OAI_UE_args usually start with -C and followed by the location in repository + #full_config_file = self.Initialize_OAI_UE_args.replace('-O ','') + #extIdx = full_config_file.find('.conf') + #if (extIdx > 0): + # extra_options = full_config_file[extIdx + 5:] + # # if tracer options is on, compiling and running T Tracer + # result = re.search('T_stdout', str(extra_options)) + ## if result is not None: + # logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m') + # self.command('cd common/utils/T/tracer', '\$', 5) + # self.command('make', '\$', 10) + # self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.UESourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.log 2>&1 &', self.UEUserName, 5) + # self.command('cd ' + self.UESourceCodePath, '\$', 5) + # full_config_file = full_config_file[:extIdx + 5] + # config_path, config_file = os.path.split(full_config_file) + #ci_full_config_file = config_path + '/ci-' + config_file + #rruCheck = False + #result = re.search('rru', str(config_file)) + #if result is not None: + # rruCheck = True + ## Make a copy and adapt to EPC / UE IP addresses + #self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) + #self.command('sed -i -e \'s/CI_UE_IP_ADDR/' + self.UEIPAddress + '/\' ' + ci_full_config_file, '\$', 2); # Launch UE with the modified config file self.command('source oaienv', '\$', 5) - self.command('cd cmake_targets', '\$', 5) - self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.UESourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.UE_instance) + '.sh ', '\$', 5) - self.command('chmod 775 ./my-lte-softmodem-run' + str(self.UE_instance) + '.sh ', '\$', 5) - self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ue_' + self.testCase_id + '.log', '\$', 5) - self.command('echo ' + self.UEPassword + ' | sudo -S -E daemon --inherit --unsafe --name=ue' + str(self.UE_instance) + '_daemon --chdir=' + self.UESourceCodePath + '/cmake_targets -o ' + self.UESourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) - if not rruCheck: - self.UELogFile = 'enb_' + self.testCase_id + '.log' + self.command('cd cmake_targets/lte_build_oai/build', '\$', 5) + self.command('echo "ulimit -c unlimited && ./lte-uesoftmodem ' + self.Initialize_OAI_UE_args + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) + self.command('chmod 775 ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S -E daemon --inherit --unsafe --name=ue' + str(self.UE_instance) + '_daemon --chdir=' + self.UESourceCodePath + '/cmake_targets/lte_build_oai/build -o ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) + self.UELogFile = 'ue_' + self.testCase_id + '.log' time.sleep(6) + self.command('cd ../..', '\$', 5) doLoop = True loopCounter = 10 while (doLoop): loopCounter = loopCounter - 1 if (loopCounter == 0): # In case of T tracer recording, we may need to kill it - result = re.search('T_stdout', str(self.Initialize_UE_args)) - if result is not None: - self.command('killall --signal SIGKILL record', '\$', 5) + #result = re.search('T_stdout', str(self.Initialize_OAI_UE_args)) + #if result is not None: + # self.command('killall --signal SIGKILL record', '\$', 5) self.close() doLoop = False logging.error('\u001B[1;37;41m UE logging system did not show got sync! \u001B[0m') - self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'KO', ALL_PROCESSES_OK) + self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'KO', ALL_PROCESSES_OK) self.CreateHtmlTabFooter(False) - # In case of T tracer recording, we need to kill tshark on EPC side - result = re.search('T_stdout', str(self.Initialize_UE_args)) - if result is not None: - self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - logging.debug('\u001B[1m Stopping tshark \u001B[0m') - self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) - self.close() - time.sleep(1) - pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap' - copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.') - if (copyin_res == 0): - self.copyout(self.UEIPAddress, self.UEUserName, self.UEPassword, pcap_log_file, self.UESourceCodePath + '/cmake_targets/.') + ## In case of T tracer recording, we need to kill tshark on EPC side + #result = re.search('T_stdout', str(self.Initialize_OAI_UE_args)) + #if result is not None: + # self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + # logging.debug('\u001B[1m Stopping tshark \u001B[0m') + # self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) + # self.close() + # time.sleep(1) + # pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap' + # copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.') + # if (copyin_res == 0): + # self.copyout(self.UEIPAddress, self.UEUserName, self.UEPassword, pcap_log_file, self.UESourceCodePath + '/cmake_targets/.') sys.exit(1) else: - self.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4) - if rruCheck: - result = re.search('wait RUs', str(self.ssh.before)) - else: - result = re.search('got sync', str(self.ssh.before)) + self.command('stdbuf -o0 cat ue_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4) + result = re.search('got sync', str(self.ssh.before)) if result is None: time.sleep(6) else: doLoop = False - self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'OK', ALL_PROCESSES_OK) - logging.debug('\u001B[1m Initialize UE Completed\u001B[0m') - + self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'OK', ALL_PROCESSES_OK) + logging.debug('\u001B[1m Initialize OAI UE Completed\u001B[0m') self.close() def checkDevTTYisUnlocked(self): @@ -1674,6 +1665,48 @@ class SSHConnection(): result = logStatus return result + def CheckOAIUEProcessExist(self, initialize_OAI_UE_flag): + multi_jobs = [] + status_queue = SimpleQueue() + if initialize_OAI_UE_flag == False: + p = Process(target = SSH.CheckOAIUEProcess, args = (status_queue,)) + p.daemon = True + p.start() + multi_jobs.append(p) + for job in multi_jobs: + job.join() + + if (status_queue.empty()): + return -15 + else: + result = 0 + while (not status_queue.empty()): + status = status_queue.get() + if (status < 0): + result = status + if result == OAI_UE_PROCESS_FAILED: + fileCheck = re.search('enb_', str(self.UELogFile)) + if fileCheck is not None: + self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + self.UELogFile, '.') + logStatus = self.AnalyzeLogFile_UE(self.UELogFile) + if logStatus < 0: + result = logStatus + return result + + def CheckOAIUEProcess(self, status_queue): + try: + self.open(self.OAIUEIPAddress, self.OAIUEUserName, self.OAIUEPassword) + self.command('stdbuf -o0 ps -aux | grep -v grep | grep --color=never lte-uesoftmodem', '\$', 5) + result = re.search('lte-uesoftmodem', str(self.ssh.before)) + if result is None: + logging.debug('\u001B[1;37;41m OAI UE Process Not Found! \u001B[0m') + status_queue.put(OAI_UE_PROCESS_FAILED) + else: + status_queue.put(OAI_UE_PROCESS_OK) + self.close() + except: + os.kill(os.getppid(),signal.SIGUSR1) + def CheckeNBProcess(self, status_queue): try: self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) @@ -1881,6 +1914,162 @@ class SSHConnection(): return ENB_PROCESS_REALTIME_ISSUE return 0 + def AnalyzeLogFile_UE(self, UElogFile): + if (not os.path.isfile('./' + UElogFile)): + return -1 + ue_log_file = open('./' + UElogFile, 'r') + foundAssertion = False + msgAssertion = '' + msgLine = 0 + foundSegFault = False + foundRealTimeIssue = False + rrcSetupRequest = 0 + rrcSetupComplete = 0 + rrcReleaseRequest = 0 + rrcReconfigRequest = 0 + rrcReconfigComplete = 0 + rrcReestablishRequest = 0 + rrcReestablishComplete = 0 + rrcReestablishReject = 0 + rlcDiscardBuffer = 0 + rachCanceledProcedure = 0 + uciStatMsgCount = 0 + pdcpFailure = 0 + ulschFailure = 0 + for line in ue_log_file.readlines(): + result = re.search('[Ss]egmentation [Ff]ault', str(line)) + if result is not None: + foundSegFault = True + result = re.search('[Cc]ore [dD]ump', str(line)) + if result is not None: + foundSegFault = True + result = re.search('[Aa]ssertion', str(line)) + if result is not None: + foundAssertion = True + result = re.search('LLL', str(line)) + if result is not None: + foundRealTimeIssue = True + if foundAssertion and (msgLine < 3): + msgLine += 1 + msgAssertion += str(line) + result = re.search('uci->stat', str(line)) + if result is not None: + uciStatMsgCount += 1 + # full pattern + # No cell synchronization found, abandoning + + # MIB Information => FDD, NORMAL, NidCell 421, N_RB_DL 50, PHICH DURATION 0, PHICH RESOURCE 1/6, TX_ANT 2 + # mask --> FDD NORMAl 421 50 0 1/6 2 + # Measured Carrier Frequency 816000688 Hz (offset 12 Hz) + # mask --> 816000688 + # Found Orange FR (name from internal table) + # mask Orange FR + # SIB5 InterFreqCarrierFreq element 0/3 + # mask -- 0 and 3 + # DL Carrier Frequency/ARFCN : 2645000000/3000 + # mask 2645000000 + # AllowedMeasBandwidth : 100 + # mask 100 + result = re.search('Generating LTE_RRCConnectionSetup', str(line)) + if result is not None: + rrcSetupRequest += 1 + result = re.search('LTE_RRCConnectionSetupComplete from UE', str(line)) + if result is not None: + rrcSetupComplete += 1 + result = re.search('Generate LTE_RRCConnectionRelease', str(line)) + if result is not None: + rrcReleaseRequest += 1 + result = re.search('Generate LTE_RRCConnectionReconfiguration', str(line)) + if result is not None: + rrcReconfigRequest += 1 + result = re.search('LTE_RRCConnectionReconfigurationComplete from UE rnti', str(line)) + if result is not None: + rrcReconfigComplete += 1 + result = re.search('LTE_RRCConnectionReestablishmentRequest', str(line)) + if result is not None: + rrcReestablishRequest += 1 + result = re.search('LTE_RRCConnectionReestablishmentComplete', str(line)) + if result is not None: + rrcReestablishComplete += 1 + result = re.search('LTE_RRCConnectionReestablishmentReject', str(line)) + if result is not None: + rrcReestablishReject += 1 + result = re.search('PDCP.*Out of Resources.*reason', str(line)) + if result is not None: + pdcpFailure += 1 + result = re.search('ULSCH in error in round', str(line)) + if result is not None: + ulschFailure += 1 + result = re.search('BAD all_segments_received', str(line)) + if result is not None: + rlcDiscardBuffer += 1 + result = re.search('Canceled RA procedure for UE rnti', str(line)) + if result is not None: + rachCanceledProcedure += 1 + ue_log_file.close() + self.htmlUEFailureMsg = '' + if uciStatMsgCount > 0: + statMsg = 'UE showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)' + logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') + self.htmlUEFailureMsg += statMsg + '\n' + if pdcpFailure > 0: + statMsg = 'UE showed ' + str(pdcpFailure) + ' "PDCP Out of Resources" message(s)' + logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') + self.htmlUEFailureMsg += statMsg + '\n' + if ulschFailure > 0: + statMsg = 'UE showed ' + str(ulschFailure) + ' "ULSCH in error in round" message(s)' + logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') + self.htmlUEFailureMsg += statMsg + '\n' + if rrcSetupRequest > 0 or rrcSetupComplete > 0: + rrcMsg = 'UE requested ' + str(rrcSetupRequest) + ' RRC Connection Setup(s)' + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rrcMsg + '\n' + rrcMsg = ' -- ' + str(rrcSetupComplete) + ' were completed' + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rrcMsg + '\n' + if rrcReleaseRequest > 0: + rrcMsg = 'UE requested ' + str(rrcReleaseRequest) + ' RRC Connection Release(s)' + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rrcMsg + '\n' + if rrcReconfigRequest > 0 or rrcReconfigComplete > 0: + rrcMsg = 'UE requested ' + str(rrcReconfigRequest) + ' RRC Connection Reconfiguration(s)' + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rrcMsg + '\n' + rrcMsg = ' -- ' + str(rrcReconfigComplete) + ' were completed' + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rrcMsg + '\n' + if rrcReestablishRequest > 0 or rrcReestablishComplete > 0 or rrcReestablishReject > 0: + rrcMsg = 'UE requested ' + str(rrcReestablishRequest) + ' RRC Connection Reestablishment(s)' + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rrcMsg + '\n' + rrcMsg = ' -- ' + str(rrcReestablishComplete) + ' were completed' + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rrcMsg + '\n' + rrcMsg = ' -- ' + str(rrcReestablishReject) + ' were rejected' + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rrcMsg + '\n' + if rachCanceledProcedure > 0: + rachMsg = 'UE cancelled ' + str(rachCanceledProcedure) + ' RA procedure(s)' + logging.debug('\u001B[1;30;43m ' + rachMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rachMsg + '\n' + if foundSegFault: + logging.debug('\u001B[1;37;41m UE ended with a Segmentation Fault! \u001B[0m') + return ENB_PROCESS_SEG_FAULT + if foundAssertion: + logging.debug('\u001B[1;37;41m UE ended with an assertion! \u001B[0m') + self.htmlUEFailureMsg += msgAssertion + return ENB_PROCESS_ASSERTION + if foundRealTimeIssue: + logging.debug('\u001B[1;37;41m UE faced real time issues! \u001B[0m') + self.htmlUEFailureMsg += 'UE faced real time issues!\n' + #return ENB_PROCESS_REALTIME_ISSUE + if rlcDiscardBuffer > 0: + rlcMsg = 'UE RLC discarded ' + str(rlcDiscardBuffer) + ' buffer(s)' + logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m') + self.htmlUEFailureMsg += rlcMsg + '\n' + return ENB_PROCESS_REALTIME_ISSUE + return 0 + def TerminateeNB(self): self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) self.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5) @@ -2035,7 +2224,7 @@ class SSHConnection(): time.sleep(5) self.close() # If tracer options is on, stopping tshark on EPC side - result = re.search('T_stdout', str(self.Initialize_UE_args)) + result = re.search('T_stdout', str(self.Initialize_OAI_UE_args)) if result is not None: self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) logging.debug('\u001B[1m Stopping tshark \u001B[0m') @@ -2063,7 +2252,7 @@ class SSHConnection(): self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) self.UELogFile = '' else: - result = re.search('enb_', str(self.UELogFile)) + result = re.search('ue_', str(self.UELogFile)) if result is not None: copyin_res = self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + self.UELogFile, '.') if (copyin_res == -1): @@ -2528,7 +2717,7 @@ def Usage(): print('------------------------------------------------------------') def CheckClassValidity(action,id): - if action != 'Build_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'IdleSleep': + if action != 'Build_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Build_OAI_UE' and action != 'Initialize_OAI_UE' and action != 'Terminate_OAI_UE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'IdleSleep': logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action) return False return True @@ -2555,6 +2744,20 @@ def GetParametersFromXML(action): else: SSH.nbMaxUEtoAttach = int(nbMaxUEtoAttach) + if action == 'Build_OAI_UE': + SSH.Build_OAI_UE_args = test.findtext('Build_OAI_UE_args') + + if action == 'Initialize_OAI_UE': + SSH.Initialize_OAI_UE_args = test.findtext('Initialize_OAI_UE_args') + SSH.UE_instance = test.findtext('UE_instance') + if (SSH.UE_instance is None): + SSH.UE_instance = '0' + + if action == 'Terminate_OAI_UE': + SSH.eNB_instance = test.findtext('UE_instance') + if (SSH.UE_instance is None): + SSH.UE_instance = '0' + if action == 'Ping': SSH.ping_args = test.findtext('ping_args') SSH.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold') @@ -2672,9 +2875,6 @@ while len(argvs) > 1: elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE) SSH.UEIPAddress = matchReg.group(1) - elif re.match('^\-\-UERepository=(.+)$', myArgv, re.IGNORECASE): - matchReg = re.match('^\-\-UERepository=(.+)$', myArgv, re.IGNORECASE) - SSH.UERepository = matchReg.group(1) elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE) SSH.UEUserName = matchReg.group(1) @@ -2684,12 +2884,6 @@ while len(argvs) > 1: elif re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE) SSH.UESourceCodePath = matchReg.group(1) - elif re.match('^\-\-UEBranch=(.+)$', myArgv, re.IGNORECASE): - matchReg = re.match('^\-\-UEBranch=(.+)$', myArgv, re.IGNORECASE) - SSH.UEBranch = matchReg.group(1) - elif re.match('^\-\-UECommitID=(.*)$', myArgv, re.IGNORECASE): - matchReg = re.match('^\-\-UECommitID=(.*)$', myArgv, re.IGNORECASE) - SSH.UECommitID = matchReg.group(1) elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE) finalStatus = matchReg.group(1) @@ -2710,6 +2904,12 @@ elif re.match('^TerminateUE$', mode, re.IGNORECASE): sys.exit('Insufficient Parameter') signal.signal(signal.SIGUSR1, receive_signal) SSH.TerminateUE() +elif re.match('^TerminateOAIUE$', mode, re.IGNORECASE): + if SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == '': + Usage() + sys.exit('Insufficient Parameter') + signal.signal(signal.SIGUSR1, receive_signal) + SSH.TerminateUE() elif re.match('^TerminateHSS$', mode, re.IGNORECASE): if SSH.EPCIPAddress == '' or SSH.EPCUserName == '' or SSH.EPCPassword == '' or SSH.EPCType == '' or SSH.EPCSourceCodePath == '': Usage() @@ -2761,7 +2961,7 @@ elif re.match('^LogCollectIperf$', mode, re.IGNORECASE): sys.exit('Insufficient Parameter') SSH.LogCollectIperf() elif re.match('^InitiateHtml$', mode, re.IGNORECASE): - if SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '': + if (SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '') and (SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == ''): Usage() sys.exit('Insufficient Parameter') count = 0 @@ -2782,17 +2982,11 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re Usage() sys.exit('Insufficient Parameter') - if (SSH.EPCIPAddress != 'none'): + if (SSH.EPCIPAddress != ''): SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp") SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp") else: - print('SSH.UEIPAddress=' + SSH.UEIPAddress) - print('SSH.UERepository=' + SSH.UERepository) - print('SSH.UEBranch=' + SSH.UEBranch) - print('SSH.UEUserName=' + SSH.UEUserName) - print('SSH.UEPassword=' + SSH.UEPassword) - print('SSH.UESourceCodePath=' + SSH.UESourceCodePath) - if SSH.UEIPAddress == '' or SSH.UERepository == '' or SSH.UEBranch == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '': + if SSH.UEIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '': Usage() sys.exit('UE: Insufficient Parameter') @@ -2878,6 +3072,12 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re SSH.AttachUE() elif action == 'Detach_UE': SSH.DetachUE() + elif action == 'Build_OAI_UE': + SSH.BuildOAIUE() + elif action == 'Initialize_OAI_UE': + SSH.InitializeOAIUE() + elif action == 'Terminate_OAI_UE': + SSH.TerminateOAIUE() elif action == 'Initialize_CatM_module': SSH.InitializeCatM() elif action == 'Terminate_CatM_module': diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz.xml b/ci-scripts/xml_files/ue_band20_test_10mhz.xml index 72b6a81ec1..38e1aa6b7a 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz.xml @@ -21,12 +21,39 @@ --> <testCaseList> - <TestCaseRequestedList>080101</TestCaseRequestedList> + <TestCaseRequestedList> +090101 +090102 000001 090104 +090103 000001 090104 + </TestCaseRequestedList> - <testCase id="080101"> + <testCase id="090101"> + <class>Build_OAI_UE</class> + <desc>Build OAI UE</desc> + <Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args> + </testCase> + + <testCase id="090102"> + <class>Initialize_OAI_UE</class> + <desc>Initialize OAI UE -- sniffing SFR frequency</desc> + <Initialize_OAI_UE_args>-C 806000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> + </testCase> + + <testCase id="090103"> + <class>Initialize_OAI_UE</class> + <desc>Initialize OAI UE -- sniffing Orange frequency</desc> + <Initialize_OAI_UE_args>-C 816000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> + </testCase> + + <testCase id="000001"> <class>IdleSleep</class> - <desc>Sleep OAI UE</desc> - <nbMaxUEtoAttach>1</nbMaxUEtoAttach> + <desc>Sleep</desc> + <idle_sleep_time_in_sec>30</idle_sleep_time_in_sec> + </testCase> + + <testCase id="090104"> + <class>Terminate_OAI_UE</class> + <desc>Terminate OAI UE</desc> </testCase> </testCaseList> diff --git a/ci-scripts/xml_files/ue_sfr_796.xml b/ci-scripts/xml_files/ue_sfr_796.xml new file mode 100644 index 0000000000..7600d371c1 --- /dev/null +++ b/ci-scripts/xml_files/ue_sfr_796.xml @@ -0,0 +1,44 @@ +<!-- + + 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 + +--> +<testCaseList> + <TestCaseRequestedList>080102 080103 080104</TestCaseRequestedList> + + <testCase id="080102"> + <class>Initialize_OAI_UE</class> + <desc>Initialize OAI UE</desc> + <Initialize_OAI_UE_args>-C 796000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> + <eNB_instance>0</eNB_instance> + </testCase> + + <testCase id="080103"> + <class>IdleSleep</class> + <desc>Sleep</desc> + </testCase> + + <testCase id="080104"> + <class>Terminate_OAI_UE</class> + <desc>Terminate OAI UE</desc> + <eNB_instance>0</eNB_instance> + </testCase> + +</testCaseList> -- GitLab From 6d93c9c522c1cba6dc6a7b467296b83fc1d546c4 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Tue, 19 Mar 2019 09:49:04 +0100 Subject: [PATCH 270/308] Using os.getcwd() instead of sys.path[0] to work with pdb. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 101 ++++++++++----------------------------------- 1 file changed, 22 insertions(+), 79 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 5e113dd413..89ead0a016 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -1923,19 +1923,13 @@ class SSHConnection(): msgLine = 0 foundSegFault = False foundRealTimeIssue = False - rrcSetupRequest = 0 - rrcSetupComplete = 0 - rrcReleaseRequest = 0 - rrcReconfigRequest = 0 - rrcReconfigComplete = 0 - rrcReestablishRequest = 0 - rrcReestablishComplete = 0 - rrcReestablishReject = 0 rlcDiscardBuffer = 0 rachCanceledProcedure = 0 uciStatMsgCount = 0 pdcpFailure = 0 ulschFailure = 0 + no_cell_sync_found = False + marker1 = False for line in ue_log_file.readlines(): result = re.search('[Ss]egmentation [Ff]ault', str(line)) if result is not None: @@ -1957,55 +1951,29 @@ class SSHConnection(): uciStatMsgCount += 1 # full pattern # No cell synchronization found, abandoning - + result = re.search('No cell synchronization found, abandoning', str(line)) + if result is not None: + no_cell_sync_found = True # MIB Information => FDD, NORMAL, NidCell 421, N_RB_DL 50, PHICH DURATION 0, PHICH RESOURCE 1/6, TX_ANT 2 # mask --> FDD NORMAl 421 50 0 1/6 2 + result = re.search("MIB Information => ([a-zA-Z]{1,10}), ([a-zA-Z]{1,10}), NidCell (?P<nidcell>\d{1,3}), N_RB_DL (?P<n_rb_dl>\d{1,3}), PHICH DURATION (?P<phich_duration>\d), PHICH RESOURCE (?P<phich_resource>\d/\d), TX_ANT (?P<tx_ant>\d)", str(line)) + if result is not None: + if result.group(0) != 'FDD' or result.group(1) != 'NORMAL' or result.group('nidcell') != '421' or result.group('n_rb_dl') != '421' or result.group('phich_duration') != '0' or result.group('phich_resource') != '1/6' or result.group('tx_ant') != '2': + marker1 = True # Measured Carrier Frequency 816000688 Hz (offset 12 Hz) - # mask --> 816000688 + # mask --> 816000688i + # Found Orange FR (name from internal table) # mask Orange FR + # SIB5 InterFreqCarrierFreq element 0/3 # mask -- 0 and 3 + # DL Carrier Frequency/ARFCN : 2645000000/3000 # mask 2645000000 + # AllowedMeasBandwidth : 100 # mask 100 - result = re.search('Generating LTE_RRCConnectionSetup', str(line)) - if result is not None: - rrcSetupRequest += 1 - result = re.search('LTE_RRCConnectionSetupComplete from UE', str(line)) - if result is not None: - rrcSetupComplete += 1 - result = re.search('Generate LTE_RRCConnectionRelease', str(line)) - if result is not None: - rrcReleaseRequest += 1 - result = re.search('Generate LTE_RRCConnectionReconfiguration', str(line)) - if result is not None: - rrcReconfigRequest += 1 - result = re.search('LTE_RRCConnectionReconfigurationComplete from UE rnti', str(line)) - if result is not None: - rrcReconfigComplete += 1 - result = re.search('LTE_RRCConnectionReestablishmentRequest', str(line)) - if result is not None: - rrcReestablishRequest += 1 - result = re.search('LTE_RRCConnectionReestablishmentComplete', str(line)) - if result is not None: - rrcReestablishComplete += 1 - result = re.search('LTE_RRCConnectionReestablishmentReject', str(line)) - if result is not None: - rrcReestablishReject += 1 - result = re.search('PDCP.*Out of Resources.*reason', str(line)) - if result is not None: - pdcpFailure += 1 - result = re.search('ULSCH in error in round', str(line)) - if result is not None: - ulschFailure += 1 - result = re.search('BAD all_segments_received', str(line)) - if result is not None: - rlcDiscardBuffer += 1 - result = re.search('Canceled RA procedure for UE rnti', str(line)) - if result is not None: - rachCanceledProcedure += 1 ue_log_file.close() self.htmlUEFailureMsg = '' if uciStatMsgCount > 0: @@ -2020,34 +1988,6 @@ class SSHConnection(): statMsg = 'UE showed ' + str(ulschFailure) + ' "ULSCH in error in round" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') self.htmlUEFailureMsg += statMsg + '\n' - if rrcSetupRequest > 0 or rrcSetupComplete > 0: - rrcMsg = 'UE requested ' + str(rrcSetupRequest) + ' RRC Connection Setup(s)' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') - self.htmlUEFailureMsg += rrcMsg + '\n' - rrcMsg = ' -- ' + str(rrcSetupComplete) + ' were completed' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') - self.htmlUEFailureMsg += rrcMsg + '\n' - if rrcReleaseRequest > 0: - rrcMsg = 'UE requested ' + str(rrcReleaseRequest) + ' RRC Connection Release(s)' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') - self.htmlUEFailureMsg += rrcMsg + '\n' - if rrcReconfigRequest > 0 or rrcReconfigComplete > 0: - rrcMsg = 'UE requested ' + str(rrcReconfigRequest) + ' RRC Connection Reconfiguration(s)' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') - self.htmlUEFailureMsg += rrcMsg + '\n' - rrcMsg = ' -- ' + str(rrcReconfigComplete) + ' were completed' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') - self.htmlUEFailureMsg += rrcMsg + '\n' - if rrcReestablishRequest > 0 or rrcReestablishComplete > 0 or rrcReestablishReject > 0: - rrcMsg = 'UE requested ' + str(rrcReestablishRequest) + ' RRC Connection Reestablishment(s)' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') - self.htmlUEFailureMsg += rrcMsg + '\n' - rrcMsg = ' -- ' + str(rrcReestablishComplete) + ' were completed' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') - self.htmlUEFailureMsg += rrcMsg + '\n' - rrcMsg = ' -- ' + str(rrcReestablishReject) + ' were rejected' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') - self.htmlUEFailureMsg += rrcMsg + '\n' if rachCanceledProcedure > 0: rachMsg = 'UE cancelled ' + str(rachCanceledProcedure) + ' RA procedure(s)' logging.debug('\u001B[1;30;43m ' + rachMsg + ' \u001B[0m') @@ -2068,6 +2008,8 @@ class SSHConnection(): logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m') self.htmlUEFailureMsg += rlcMsg + '\n' return ENB_PROCESS_REALTIME_ISSUE + if marker1: + logging.debug('\u001B[1;37;41m Wrong MIB Information line! \u001B[0m') return 0 def TerminateeNB(self): @@ -2800,6 +2742,7 @@ SSH = SSHConnection() argvs = sys.argv argc = len(argvs) +cwd = os.getcwd() while len(argvs) > 1: myArgv = argvs.pop(1) # 0th is this file's name @@ -2966,7 +2909,7 @@ elif re.match('^InitiateHtml$', mode, re.IGNORECASE): sys.exit('Insufficient Parameter') count = 0 while (count < SSH.nbTestXMLfiles): - xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[count] + xml_test_file = cwd + "/" + SSH.testXMLfiles[count] xmlTree = ET.parse(xml_test_file) xmlRoot = xmlTree.getroot() SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count))) @@ -2983,8 +2926,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re sys.exit('Insufficient Parameter') if (SSH.EPCIPAddress != ''): - SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp") - SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp") + SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, cwd + "/tcp_iperf_stats.awk", "/tmp") + SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, cwd + "/active_net_interfaces.awk", "/tmp") else: if SSH.UEIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '': Usage() @@ -2993,9 +2936,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re #read test_case_list.xml file # if no parameters for XML file, use default value if (SSH.nbTestXMLfiles != 1): - xml_test_file = sys.path[0] + "/test_case_list.xml" + xml_test_file = cwd + "/test_case_list.xml" else: - xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[0] + xml_test_file = cwd + "/" + SSH.testXMLfiles[0] xmlTree = ET.parse(xml_test_file) xmlRoot = xmlTree.getroot() -- GitLab From 1affd5ff59a8e2215683507a22e56eedcf5c97ea Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Tue, 19 Mar 2019 16:11:17 +0100 Subject: [PATCH 271/308] Printing information from the UE log file. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 54 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 89ead0a016..a1851fcec8 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -1877,7 +1877,7 @@ class SSHConnection(): self.htmleNBFailureMsg += rrcMsg + '\n' if rrcReconfigRequest > 0 or rrcReconfigComplete > 0: rrcMsg = 'eNB requested ' + str(rrcReconfigRequest) + ' RRC Connection Reconfiguration(s)' - logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') + logging.debug('\u001B[1;30;43m ' + rrcMsig + ' \u001B[0m') self.htmleNBFailureMsg += rrcMsg + '\n' rrcMsg = ' -- ' + str(rrcReconfigComplete) + ' were completed' logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') @@ -1929,7 +1929,6 @@ class SSHConnection(): pdcpFailure = 0 ulschFailure = 0 no_cell_sync_found = False - marker1 = False for line in ue_log_file.readlines(): result = re.search('[Ss]egmentation [Ff]ault', str(line)) if result is not None: @@ -1955,25 +1954,58 @@ class SSHConnection(): if result is not None: no_cell_sync_found = True # MIB Information => FDD, NORMAL, NidCell 421, N_RB_DL 50, PHICH DURATION 0, PHICH RESOURCE 1/6, TX_ANT 2 - # mask --> FDD NORMAl 421 50 0 1/6 2 - result = re.search("MIB Information => ([a-zA-Z]{1,10}), ([a-zA-Z]{1,10}), NidCell (?P<nidcell>\d{1,3}), N_RB_DL (?P<n_rb_dl>\d{1,3}), PHICH DURATION (?P<phich_duration>\d), PHICH RESOURCE (?P<phich_resource>\d/\d), TX_ANT (?P<tx_ant>\d)", str(line)) + # mask --> FDD NORMAL 421 50 0 1/6 2 + result = re.search("MIB Information => ([a-zA-Z]{1,10}), ([a-zA-Z]{1,10}), NidCell (?P<nidcell>\d{1,3}), N_RB_DL (?P<n_rb_dl>\d{1,3}), PHICH DURATION (?P<phich_duration>\d), PHICH RESOURCE (?P<phich_resource>.{1,4}), TX_ANT (?P<tx_ant>\d)", str(line)) if result is not None: - if result.group(0) != 'FDD' or result.group(1) != 'NORMAL' or result.group('nidcell') != '421' or result.group('n_rb_dl') != '421' or result.group('phich_duration') != '0' or result.group('phich_resource') != '1/6' or result.group('tx_ant') != '2': - marker1 = True + try: + print('\033[94m' + "MIB Information: " + result.group(1) + ', ' + result.group(2) + '\033[0m') + print('\033[94m' + "nidcell = " + result.group('nidcell') + '\033[0m') + print('\033[94m' + "n_rb_dl = " + result.group('n_rb_dl') + '\033[0m') + print('\033[94m' + "phich_duration = " + result.group('phich_duration') + '\033[0m') + print('\033[94m' + "phich_resource = " + result.group('phich_resource') + '\033[0m') + print('\033[94m' + "tx_ant = " + result.group('tx_ant') + '\033[0m') + except Exception as e: + print('\033[91m' + "a marker was not found" + '\033[0m') # Measured Carrier Frequency 816000688 Hz (offset 12 Hz) # mask --> 816000688i - + result = re.search("Measured Carrier Frequency (?P<measured_carrier_frequency>\d{1,15}) Hz", str(line)) + if result is not None: + try: + print('\033[94m' + "Measured Carrier Frequency = " + result.group('measured_carrier_frequency') + '\033[0m') + except Exception as e: + print('\033[91m' + "Measured Carrier Frequency not found" + '\033[0m') # Found Orange FR (name from internal table) # mask Orange FR - + result = re.search("Found (?P<operator>[\w,\s]{1,15}) \(name from internal table\)", str(line)) + if result is not None: + try: + print('\033[94m' + "The operator is: " + result.group('operator') + '\033[0m') + except Exception as e: + print('\033[91m' + "Operator name not found" + '\033[0m') # SIB5 InterFreqCarrierFreq element 0/3 # mask -- 0 and 3 - + result = re.search("SIB5 InterFreqCarrierFreq element (.{1,4})/(.{1,4})", str(line)) + if result is not None: + try: + print('\033[94m' + "SIB5 InterFreqCarrierFreq element " + result.group(1) + '/' + result.group(2) + '\033[0m') + except Exception as e: + print('\033[91m' + "SIB5 InterFreqCarrierFreq element not found" + '\033[0m') # DL Carrier Frequency/ARFCN : 2645000000/3000 # mask 2645000000 - + result = re.search("DL Carrier Frequency/ARFCN : (?P<carrier_frequency>)\d{1,15}/\d{1,4}", str(line)) + if result is not None: + try: + print('\033[94m' + "DL Carrier Frequency is: " + result.group('carrier_frequency') + '\033[0m') + except Exception as e: + print('\033[91m' + "DL Carrier Frequency not found" + '\033[0m') # AllowedMeasBandwidth : 100 # mask 100 + result = re.search("AllowedMeasBandwidth : (?P<allowed_bandwidth>\d{1,7})", str(line)) + if result is not None: + try: + print('\033[94m' + "AllowedMeasBandwidth: " + result.group('allowed_bandwidth') + '\033[0m') + except Exception as e: + print('\033[91m' + "AllowedMeasBandwidth not found" + '\033[0m') ue_log_file.close() self.htmlUEFailureMsg = '' if uciStatMsgCount > 0: @@ -2008,8 +2040,6 @@ class SSHConnection(): logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m') self.htmlUEFailureMsg += rlcMsg + '\n' return ENB_PROCESS_REALTIME_ISSUE - if marker1: - logging.debug('\u001B[1;37;41m Wrong MIB Information line! \u001B[0m') return 0 def TerminateeNB(self): -- GitLab From 32be9dcbb8edb814060a90b64eacdd535c573fda Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Wed, 20 Mar 2019 10:10:24 +0100 Subject: [PATCH 272/308] Testing 2 frequencies for each operator (Orange and SFR). Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index a1851fcec8..f3caa1f23f 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -344,7 +344,6 @@ class SSHConnection(): self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) def BuildOAIUE(self): - return if self.UEIPAddress == '' or self.eNBRepository == '' or self.eNBBranch == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': Usage() sys.exit('Insufficient Parameter') -- GitLab From dccf64ac571d6de310e86df0bebd2fa3f5cedb07 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Wed, 20 Mar 2019 15:48:03 +0100 Subject: [PATCH 273/308] Deleting ue_sfr_796.xml. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/xml_files/ue_sfr_796.xml | 44 ----------------------------- 1 file changed, 44 deletions(-) delete mode 100644 ci-scripts/xml_files/ue_sfr_796.xml diff --git a/ci-scripts/xml_files/ue_sfr_796.xml b/ci-scripts/xml_files/ue_sfr_796.xml deleted file mode 100644 index 7600d371c1..0000000000 --- a/ci-scripts/xml_files/ue_sfr_796.xml +++ /dev/null @@ -1,44 +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 - ---> -<testCaseList> - <TestCaseRequestedList>080102 080103 080104</TestCaseRequestedList> - - <testCase id="080102"> - <class>Initialize_OAI_UE</class> - <desc>Initialize OAI UE</desc> - <Initialize_OAI_UE_args>-C 796000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> - <eNB_instance>0</eNB_instance> - </testCase> - - <testCase id="080103"> - <class>IdleSleep</class> - <desc>Sleep</desc> - </testCase> - - <testCase id="080104"> - <class>Terminate_OAI_UE</class> - <desc>Terminate OAI UE</desc> - <eNB_instance>0</eNB_instance> - </testCase> - -</testCaseList> -- GitLab From c396e42ab2e6af266eb5c62c5de5b29e6345bba8 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Thu, 21 Mar 2019 11:49:10 +0100 Subject: [PATCH 274/308] Adding the reset procedure using b2xx_fx3_utils. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 98 +++++++++++-------- .../xml_files/ue_band20_test_10mhz_orange.xml | 62 ++++++++++++ .../xml_files/ue_band20_test_10mhz_sfr.xml | 62 ++++++++++++ 3 files changed, 181 insertions(+), 41 deletions(-) create mode 100644 ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml create mode 100644 ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml diff --git a/ci-scripts/main.py b/ci-scripts/main.py index f3caa1f23f..ec2d526910 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -119,17 +119,12 @@ class SSHConnection(): self.htmlTabNames = [] self.htmlTabIcons = [] self.finalStatus = False - self.eNBOsVersion = '' - self.eNBKernelVersion = '' - self.eNBUhdVersion = '' - self.eNBCpuNb = '' - self.eNBCpuModel = '' - self.eNBCpuMHz = '' - #self.UEOsVersion = '' - #self.UEKernelVersion = '' - #self.UEUhdVersion = '' - #self.UECpuNb = '' - #self.UECpuModel = '' + self.OsVersion = '' + self.KernelVersion = '' + self.UhdVersion = '' + self.CpuNb = '' + self.CpuModel = '' + self.CpuMHz = '' self.UEIPAddress = '' self.UEBranch = '' #self.UE_AllowMerge = False @@ -344,6 +339,7 @@ class SSHConnection(): self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) def BuildOAIUE(self): + return if self.UEIPAddress == '' or self.eNBRepository == '' or self.eNBBranch == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': Usage() sys.exit('Insufficient Parameter') @@ -582,6 +578,16 @@ class SSHConnection(): # self.CreateHtmlTabFooter(False) # sys.exit(1) self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) + # b2xx_fx3_utils reset procedure + self.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 5) + result = re.search('type: b200', str(self.ssh.before)) + if result is not None: + logging.debug('Found a B2xx device --> resetting it') + self.command('echo ' + self.UEPassword + ' | sudo -S sudo b2xx_fx3_utils --reset-device', '\$', 5) + # Reloading FGPA bin firmware + self.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 5) + else: + logging.debug('Did not find any B2xx device') self.command('cd ' + self.UESourceCodePath, '\$', 5) # Initialize_OAI_UE_args usually start with -C and followed by the location in repository #full_config_file = self.Initialize_OAI_UE_args.replace('-O ','') @@ -2336,41 +2342,52 @@ class SSHConnection(): def RetrieveSystemVersion(self): if self.eNBIPAddress == 'none': - self.eNBOsVersion = 'Ubuntu 16.04.5 LTS' - self.eNBKernelVersion = '4.15.0-45-generic' - self.eNBUhdVersion = '3.13.0.1-0' - self.eNBCpuNb = '4' - self.eNBCpuModel = 'Intel(R) Core(TM) i5-6200U' - self.eNBCpuMHz = '2399.996 MHz' + self.OsVersion = 'Ubuntu 16.04.5 LTS' + self.KernelVersion = '4.15.0-45-generic' + self.UhdVersion = '3.13.0.1-0' + self.CpuNb = '4' + self.CpuModel = 'Intel(R) Core(TM) i5-6200U' + self.CpuMHz = '2399.996 MHz' return - if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '': + machine = None + if self.eNBIPAddress != '' and self.eNBUserName != '' and self.eNBPassword != '': + machine = 'eNB' + self.IPAddress = self.eNBIPAddress + self.UserName = self.eNBUserName + self.Password = self.eNBPassword + if self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != '': + machine = 'UE' + self.IPAddress = self.UEIPAddress + self.UserName = self.UEUserName + self.Password = self.UEPassword + if machine is None: Usage() sys.exit('Insufficient Parameter') - self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) + self.open(self.IPAddress, self.UserName, self.Password) self.command('lsb_release -a', '\$', 5) result = re.search('Description:\\\\t(?P<os_type>[a-zA-Z0-9\-\_\.\ ]+)', str(self.ssh.before)) if result is not None: - self.eNBOsVersion = result.group('os_type') - logging.debug('OS is: ' + self.eNBOsVersion) + self.OsVersion = result.group('os_type') + logging.debug('OS is: ' + self.OsVersion) self.command('uname -r', '\$', 5) result = re.search('uname -r\\\\r\\\\n(?P<kernel_version>[a-zA-Z0-9\-\_\.]+)', str(self.ssh.before)) if result is not None: - self.eNBKernelVersion = result.group('kernel_version') - logging.debug('Kernel Version is: ' + self.eNBKernelVersion) + self.KernelVersion = result.group('kernel_version') + logging.debug('Kernel Version is: ' + self.KernelVersion) self.command('dpkg --list | egrep --color=never libuhd003', '\$', 5) result = re.search('libuhd003:amd64 *(?P<uhd_version>[0-9\.]+)', str(self.ssh.before)) if result is not None: - self.eNBUhdVersion = result.group('uhd_version') - logging.debug('UHD Version is: ' + self.eNBUhdVersion) + self.UhdVersion = result.group('uhd_version') + logging.debug('UHD Version is: ' + self.UhdVersion) self.command('lscpu', '\$', 5) result = re.search('CPU\(s\): *(?P<nb_cpus>[0-9]+).*Model name: *(?P<model>[a-zA-Z0-9\-\_\.\ \(\)]+).*CPU MHz: *(?P<cpu_mhz>[0-9\.]+)', str(self.ssh.before)) if result is not None: - self.eNBCpuNb = result.group('nb_cpus') - logging.debug('nb_cpus: ' + self.eNBCpuNb) - self.eNBCpuModel = result.group('model') - logging.debug('model: ' + self.eNBCpuModel) - self.eNBCpuMHz = result.group('cpu_mhz') + ' MHz' - logging.debug('cpu_mhz: ' + self.eNBCpuMHz) + self.CpuNb = result.group('nb_cpus') + logging.debug('nb_cpus: ' + self.CpuNb) + self.CpuModel = result.group('model') + logging.debug('model: ' + self.CpuModel) + self.CpuMHz = result.group('cpu_mhz') + ' MHz' + logging.debug('cpu_mhz: ' + self.CpuMHz) self.close() #----------------------------------------------------------- @@ -2459,10 +2476,9 @@ class SSHConnection(): if (self.ADBIPAddress != 'none'): self.GetAllUEDevices(terminate_ue_flag) self.GetAllCatMDevices(terminate_ue_flag) - self.htmlUEConnected = len(self.UEDevices) - - self.htmlFile.write(' <h2><span class="glyphicon glyphicon-phone"></span> <span class="glyphicon glyphicon-menu-right"></span> ' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server</h2>\n') - self.htmlFile.write(' <h2><span class="glyphicon glyphicon-phone"></span> <span class="glyphicon glyphicon-menu-right"></span> ' + str(len(self.CatMDevices)) + ' CAT-M UE(s) is(are) connected to bench server</h2>\n') + self.htmlUEConnected = len(self.UEDevices) + self.htmlFile.write(' <h2><span class="glyphicon glyphicon-phone"></span> <span class="glyphicon glyphicon-menu-right"></span> ' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server</h2>\n') + self.htmlFile.write(' <h2><span class="glyphicon glyphicon-phone"></span> <span class="glyphicon glyphicon-menu-right"></span> ' + str(len(self.CatMDevices)) + ' CAT-M UE(s) is(are) connected to bench server</h2>\n') self.htmlFile.write(' <br>\n') self.htmlFile.write(' <ul class="nav nav-pills">\n') count = 0 @@ -2535,19 +2551,19 @@ class SSHConnection(): self.htmlFile.write(' </tr>\n') self.htmlFile.write(' <tr>\n') self.htmlFile.write(' <td>OS Version</td>\n') - self.htmlFile.write(' <td><span class="label label-default">' + self.eNBOsVersion + '</span></td>\n') + self.htmlFile.write(' <td><span class="label label-default">' + self.OsVersion + '</span></td>\n') self.htmlFile.write(' <td>Kernel Version</td>\n') - self.htmlFile.write(' <td><span class="label label-default">' + self.eNBKernelVersion + '</span></td>\n') + self.htmlFile.write(' <td><span class="label label-default">' + self.KernelVersion + '</span></td>\n') self.htmlFile.write(' <td>UHD Version</td>\n') - self.htmlFile.write(' <td><span class="label label-default">' + self.eNBUhdVersion + '</span></td>\n') + self.htmlFile.write(' <td><span class="label label-default">' + self.UhdVersion + '</span></td>\n') self.htmlFile.write(' </tr>\n') self.htmlFile.write(' <tr>\n') self.htmlFile.write(' <td>Nb CPUs</td>\n') - self.htmlFile.write(' <td><span class="label label-default">' + self.eNBCpuNb + '</span></td>\n') + self.htmlFile.write(' <td><span class="label label-default">' + self.CpuNb + '</span></td>\n') self.htmlFile.write(' <td>CPU Model Name</td>\n') - self.htmlFile.write(' <td><span class="label label-default">' + self.eNBCpuModel + '</span></td>\n') + self.htmlFile.write(' <td><span class="label label-default">' + self.CpuModel + '</span></td>\n') self.htmlFile.write(' <td>CPU Frequency</td>\n') - self.htmlFile.write(' <td><span class="label label-default">' + self.eNBCpuMHz + '</span></td>\n') + self.htmlFile.write(' <td><span class="label label-default">' + self.CpuMHz + '</span></td>\n') self.htmlFile.write(' </tr>\n') self.htmlFile.write(' <tr>\n') self.htmlFile.write(' <th colspan=4 bgcolor = "#33CCFF">Final Status</th>\n') diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml new file mode 100644 index 0000000000..4b5e2137de --- /dev/null +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml @@ -0,0 +1,62 @@ +<!-- + + 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 + +--> +<testCaseList> + <htmlTabRef>test-10mhz-orange</htmlTabRef> + <htmlTabName>Test-10Mhz-Orange</htmlTabName> + <htmlTabIcon>tasks</htmlTabIcon> + <TestCaseRequestedList> +090101 +090102 000001 090104 +090103 000001 090104 + </TestCaseRequestedList> + + <testCase id="090101"> + <class>Build_OAI_UE</class> + <desc>Build OAI UE</desc> + <Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args> + </testCase> + + <testCase id="090102"> + <class>Initialize_OAI_UE</class> + <desc>Initialize OAI UE -- sniffing Orange frequency</desc> + <Initialize_OAI_UE_args>-C 816000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> + </testCase> + + <testCase id="090103"> + <class>Initialize_OAI_UE</class> + <desc>Initialize OAI UE -- sniffing Orange frequency</desc> + <Initialize_OAI_UE_args>-C 812000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> + </testCase> + + <testCase id="000001"> + <class>IdleSleep</class> + <desc>Sleep</desc> + <idle_sleep_time_in_sec>30</idle_sleep_time_in_sec> + </testCase> + + <testCase id="090104"> + <class>Terminate_OAI_UE</class> + <desc>Terminate OAI UE</desc> + </testCase> + +</testCaseList> diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml new file mode 100644 index 0000000000..481f6b2699 --- /dev/null +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml @@ -0,0 +1,62 @@ +<!-- + + 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 + +--> +<testCaseList> + <htmlTabRef>test-10mHz-sfr</htmlTabRef> + <htmlTabName>Test-10MHz-SFR</htmlTabName> + <htmlTabIcon>tasks</htmlTabIcon> + <TestCaseRequestedList> +090101 +090102 000001 090104 +090103 000001 090104 + </TestCaseRequestedList> + + <testCase id="090101"> + <class>Build_OAI_UE</class> + <desc>Build OAI UE</desc> + <Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args> + </testCase> + + <testCase id="090102"> + <class>Initialize_OAI_UE</class> + <desc>Initialize OAI UE -- sniffing SFR frequency</desc> + <Initialize_OAI_UE_args>-C 806000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> + </testCase> + + <testCase id="090103"> + <class>Initialize_OAI_UE</class> + <desc>Initialize OAI UE -- sniffing SFR frequency</desc> + <Initialize_OAI_UE_args>-C 802000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> + </testCase> + + <testCase id="000001"> + <class>IdleSleep</class> + <desc>Sleep</desc> + <idle_sleep_time_in_sec>30</idle_sleep_time_in_sec> + </testCase> + + <testCase id="090104"> + <class>Terminate_OAI_UE</class> + <desc>Terminate OAI UE</desc> + </testCase> + +</testCaseList> -- GitLab From e360232e56fda4a480aeb1d7025df1e68a9a2c08 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Thu, 21 Mar 2019 13:58:20 +0100 Subject: [PATCH 275/308] Fixing a typo. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 5153ef51b1..d98bb60eca 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -348,7 +348,6 @@ class SSHConnection(): self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) def BuildOAIUE(self): - return if self.UEIPAddress == '' or self.eNBRepository == '' or self.eNBBranch == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': Usage() sys.exit('Insufficient Parameter') @@ -2543,7 +2542,7 @@ class SSHConnection(): if result is not None: self.UhdVersion = result.group('uhd_version') logging.debug('UHD Version is: ' + self.UhdVersion) - self.command('echo ' + self.eNBPassword + ' | sudo -S uhd_find_devices', '\$', 5) + self.command('echo ' + self.Password + ' | sudo -S uhd_find_devices', '\$', 5) result = re.search('product: (?P<usrp_board>[0-9A-Za-z]+)\\\\r\\\\n', str(self.ssh.before)) if result is not None: self.UsrpBoard = result.group('usrp_board') -- GitLab From 982aa940a76010206b3e5c6003243872f8da17f1 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Thu, 21 Mar 2019 15:50:00 +0100 Subject: [PATCH 276/308] First test of the pipeline. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/Jenkinsfile-tmp-ue | 302 ++++++++++++++++++++++++++++++++++ ci-scripts/main.py | 4 +- 2 files changed, 304 insertions(+), 2 deletions(-) create mode 100644 ci-scripts/Jenkinsfile-tmp-ue diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue new file mode 100644 index 0000000000..f7e39f7e83 --- /dev/null +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -0,0 +1,302 @@ +#!/bin/groovy +/* + * 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 + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the phone resource +def ciSmartPhoneResource = params.smartphonesResource + +// Terminate Status +def termUE = 0 +def termENB = 1 +def termSPGW = 2 +def termMME = 3 +def termHSS = 4 +def termStatusArray = new Boolean[termHSS + 1] +termStatusArray[termUE] = false +termStatusArray[termENB] = false +termStatusArray[termSPGW] = false +termStatusArray[termMME] = false +termStatusArray[termHSS] = false + +// Global Parameters. Normally they should be populated when the master job +// triggers the slave job with parameters +def eNB_Repository +def eNB_Branch +def eNB_CommitID +def eNB_AllowMergeRequestProcess = false +def eNB_TargetBranch + +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + ansiColor('xterm') + lock (ciSmartPhoneResource) + } + // the following parameter options are commented out so it shows the ones + // that you SHALL have to run the job. + // You can use them as template + /* + parameters { + //node-test parameters + string(name: 'pythonExecutor', defaultValue: 'nodea', description: 'Node where the pipeline - python scripts will be executed') + string(name: 'pythonTestXmlFile', defaultValue: 'enb_usrpB210_band7_50PRB.xml', description: 'Location of the Test XML to be run') + string(name: 'pipelineTestStageName', defaultValue: 'Test COTS-UE - OAI eNB - LTEBOX EPC', description: 'Naming of the Test Stage') + booleanParam(name: 'pipelineZipsConsoleLog', defaultValue: 'True', description: 'If true, the pipeline script retrieves the job console log, zips it and archives it as artifact') + string(name: 'smartphonesResource', defaultValue: 'CI-Bench-1-Phones', description: 'Lockeable Resource to prevent multiple jobs to run simultaneously with the same resource') + + //eNB parameters + string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB') + credentials(name: 'eNB_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for eNB') + string(name: 'eNB_SourceCodePath', defaultValue: '/tmp/CI-enb', description: 'Full path of eNB source code') + + //EPC parameters + string(name: 'EPC_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of EPC') + string(name: 'EPC_Type', defaultValue: 'ltebox', description: 'EPC type: OAI or ltebox') + credentials(name: 'EPC_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for EPC') + string(name: 'EPC_SourceCodePath', defaultValue: '/tmp/CI-enb', description: 'Full path of EPC source code') + + //ADB server parameters + string(name: 'ADB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of ADB server') + credentials(name: 'ADB_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for ADB') + } + */ + + stages { + stage ("Verify Parameters") { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + def allParametersPresent = true + + // It is already to late to check it + if (params.pythonExecutor != null) { + echo "eNB CI executor node : ${pythonExecutor}" + } + // If not present picking a default XML file + if (params.pythonTestXmlFile == null) { + // picking default + testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml' + echo "Test XML file(default): ${testXMLFile}" + mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " + } else { + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists("ci-scripts/" + xmlFile)) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + } + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Template Test Stage' + } + + if (params.smartphonesResource == null) { + allParametersPresent = false + } + if (params.UE_IPAddress == null) { + allParametersPresent = false + } + if (params.UE_SourceCodePath == null) { + allParametersPresent = false + } + if (params.UE_Credentials == null) { + allParametersPresent = false + } + // the following 4 parameters should be pushed by the master trigger + // if not present, take the job GIT variables (used for developing) + if (params.eNB_Repository == null) { + eNB_Repository = env.GIT_URL + } else { + eNB_Repository = params.eNB_Repository + } + echo "eNB_Repository : ${eNB_Repository}" + if (params.eNB_Branch == null) { + eNB_Branch = env.GIT_BRANCH + } else { + eNB_Branch = params.eNB_Branch + } + echo "eNB_Branch : ${eNB_Branch}" + if (params.eNB_CommitID == null) { + eNB_CommitID = env.GIT_COMMIT + } else { + eNB_CommitID = params.eNB_CommitID + } + echo "eNB_CommitID : ${eNB_CommitID}" + if (params.eNB_mergeRequest != null) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } + } +/* + if (params.EPC_IPAddress == null) { + allParametersPresent = false + } + if (params.EPC_Type == null) { + allParametersPresent = false + } + if (params.EPC_SourceCodePath == null) { + allParametersPresent = false + } + if (params.EPC_Credentials == null) { + allParametersPresent = false + } +*/ + if (params.ADB_IPAddress == null) { + allParametersPresent = false + } + if (params.ADB_Credentials == null) { + allParametersPresent = false + } + + if (allParametersPresent) { + echo "All parameters are present" + if (eNB_AllowMergeRequestProcess) { + sh "git fetch" + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" + } else { + sh "git fetch" + sh "git checkout -f ${eNB_CommitID}" + } + } else { + echo "Some parameters are missing" + sh "./ci-scripts/fail.sh" + } + } + } + } + stage ("Build and Test") { + steps { + script { + dir ('ci-scripts') { + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + try { + sh "python3 main.py --mode=TestUE --UEIPAddress=${params.UE_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --UEUserName=${UE_Username} --eNBPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + } + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password}" + } + } + } + } + } + stage('Log Collection') { + parallel { + stage('Log Collection (eNB - Build)') { + steps { + echo '\u2705 \u001B[32mLog Collection (eNB - Build)\u001B[0m' +/* + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("build.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "build.log.${env.BUILD_ID}.zip" + } +*/ + } + } + } + stage('Log Collection (eNB - Run)') { + steps { + echo '\u2705 \u001B[32mLog Collection (eNB - Run)\u001B[0m' +// withCredentials([ +// [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] +// ]) { +// sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" +// +// echo '\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m' +// sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true" +// } + script { + if(fileExists("enb.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "enb.log.${env.BUILD_ID}.zip" + } + if(fileExists("ci-scripts/test_results.html")) { + sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" + archiveArtifacts "test_results-${JOB_NAME}.html" + } + } + } + } + } + } + } + + post { + always { + script { + if (params.pipelineZipsConsoleLog != null) { + if (params.pipelineZipsConsoleLog) { + echo "Archiving Jenkins console log" + sh "wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true" + sh "zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true" + if(fileExists("consoleText.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "consoleText.log.${env.BUILD_ID}.zip" + } + } + } + } + } + } +} diff --git a/ci-scripts/main.py b/ci-scripts/main.py index d98bb60eca..f79665eb38 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -2640,8 +2640,8 @@ class SSHConnection(): self.htmlFile.write(' </tr>\n') self.htmlFile.write(' </table>\n') - terminate_ue_flag = True if (self.ADBIPAddress != 'none'): + terminate_ue_flag = True self.GetAllUEDevices(terminate_ue_flag) self.GetAllCatMDevices(terminate_ue_flag) self.htmlUEConnected = len(self.UEDevices) @@ -3121,7 +3121,7 @@ elif re.match('^LogCollectIperf$', mode, re.IGNORECASE): sys.exit('Insufficient Parameter') SSH.LogCollectIperf() elif re.match('^InitiateHtml$', mode, re.IGNORECASE): - if (SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '') and (SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == ''): + if (SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == ''): Usage() sys.exit('Insufficient Parameter') count = 0 -- GitLab From 82b742368ea8c32126fcede47c8207eb22ad2f4e Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Thu, 21 Mar 2019 15:57:14 +0100 Subject: [PATCH 277/308] fix Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/Jenkinsfile-tmp-ue | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue index f7e39f7e83..c8508fb9ad 100644 --- a/ci-scripts/Jenkinsfile-tmp-ue +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -239,21 +239,19 @@ pipeline { stage('Log Collection (eNB - Build)') { steps { echo '\u2705 \u001B[32mLog Collection (eNB - Build)\u001B[0m' -/* - withCredentials([ - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] - ]) { - sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" - - echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m' - sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" - } - script { - if(fileExists("build.log.${env.BUILD_ID}.zip")) { - archiveArtifacts "build.log.${env.BUILD_ID}.zip" - } -*/ - } +// withCredentials([ +// [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] +// ]) { +// sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" +// +// echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m' +// sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" +// } +// script { +// if(fileExists("build.log.${env.BUILD_ID}.zip")) { +// archiveArtifacts "build.log.${env.BUILD_ID}.zip" +// } +// } } } stage('Log Collection (eNB - Run)') { -- GitLab From 77582d06c56cb9d366450d4e918637fadf23c3c9 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Thu, 21 Mar 2019 16:03:26 +0100 Subject: [PATCH 278/308] fix again Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/Jenkinsfile-tmp-ue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue index c8508fb9ad..16ba3ef4c6 100644 --- a/ci-scripts/Jenkinsfile-tmp-ue +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -221,7 +221,7 @@ pipeline { for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TestUE --UEIPAddress=${params.UE_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --UEUserName=${UE_Username} --eNBPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TestUE --UEIPAddress=${params.UE_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false -- GitLab From f4bdf53c4e1fec9b285e9f303d6177a928b3a49d Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 09:40:09 +0100 Subject: [PATCH 279/308] Splitting two xml files into three xml files. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/xml_files/ue_band20_test_10mhz.xml | 25 ------------------- .../xml_files/ue_band20_test_10mhz_orange.xml | 7 +++--- .../xml_files/ue_band20_test_10mhz_sfr.xml | 11 ++++---- 3 files changed, 10 insertions(+), 33 deletions(-) diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz.xml b/ci-scripts/xml_files/ue_band20_test_10mhz.xml index 38e1aa6b7a..eeea2e359c 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz.xml @@ -23,8 +23,6 @@ <testCaseList> <TestCaseRequestedList> 090101 -090102 000001 090104 -090103 000001 090104 </TestCaseRequestedList> <testCase id="090101"> @@ -33,27 +31,4 @@ <Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args> </testCase> - <testCase id="090102"> - <class>Initialize_OAI_UE</class> - <desc>Initialize OAI UE -- sniffing SFR frequency</desc> - <Initialize_OAI_UE_args>-C 806000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> - </testCase> - - <testCase id="090103"> - <class>Initialize_OAI_UE</class> - <desc>Initialize OAI UE -- sniffing Orange frequency</desc> - <Initialize_OAI_UE_args>-C 816000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> - </testCase> - - <testCase id="000001"> - <class>IdleSleep</class> - <desc>Sleep</desc> - <idle_sleep_time_in_sec>30</idle_sleep_time_in_sec> - </testCase> - - <testCase id="090104"> - <class>Terminate_OAI_UE</class> - <desc>Terminate OAI UE</desc> - </testCase> - </testCaseList> diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml index 4b5e2137de..f49a26c2f7 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml @@ -26,9 +26,10 @@ <htmlTabIcon>tasks</htmlTabIcon> <TestCaseRequestedList> 090101 -090102 000001 090104 -090103 000001 090104 +090102 000001 090109 +090103 000001 090109 </TestCaseRequestedList> + <TestCaseExclusionList>090101</TestCaseExclusionList> <testCase id="090101"> <class>Build_OAI_UE</class> @@ -54,7 +55,7 @@ <idle_sleep_time_in_sec>30</idle_sleep_time_in_sec> </testCase> - <testCase id="090104"> + <testCase id="090109"> <class>Terminate_OAI_UE</class> <desc>Terminate OAI UE</desc> </testCase> diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml index 481f6b2699..f37df7ef42 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml @@ -26,9 +26,10 @@ <htmlTabIcon>tasks</htmlTabIcon> <TestCaseRequestedList> 090101 -090102 000001 090104 -090103 000001 090104 +090104 000001 090109 +090105 000001 090109 </TestCaseRequestedList> + <TestCaseExclusionList>090101</TestCaseExclusionList> <testCase id="090101"> <class>Build_OAI_UE</class> @@ -36,13 +37,13 @@ <Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args> </testCase> - <testCase id="090102"> + <testCase id="090104"> <class>Initialize_OAI_UE</class> <desc>Initialize OAI UE -- sniffing SFR frequency</desc> <Initialize_OAI_UE_args>-C 806000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> </testCase> - <testCase id="090103"> + <testCase id="090105"> <class>Initialize_OAI_UE</class> <desc>Initialize OAI UE -- sniffing SFR frequency</desc> <Initialize_OAI_UE_args>-C 802000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> @@ -54,7 +55,7 @@ <idle_sleep_time_in_sec>30</idle_sleep_time_in_sec> </testCase> - <testCase id="090104"> + <testCase id="090109"> <class>Terminate_OAI_UE</class> <desc>Terminate OAI UE</desc> </testCase> -- GitLab From d8bc658ab4db31fba46ba94a72b5e89559300386 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 10:51:11 +0100 Subject: [PATCH 280/308] Adding CollectOAIUE mode. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index f79665eb38..480a0ad661 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -2195,8 +2195,8 @@ class SSHConnection(): logging.debug('\u001B[1;37;41m UE ended with a Segmentation Fault! \u001B[0m') return ENB_PROCESS_SEG_FAULT if foundAssertion: - logging.debug('\u001B[1;37;41m UE ended with an assertion! \u001B[0m') - self.htmlUEFailureMsg += msgAssertion + logging.debug('\u001B[1;37;43m UE ended with an assertion! \u001B[0m') + self.htmlUEFailureMsg += msgAssertion return ENB_PROCESS_ASSERTION if foundRealTimeIssue: logging.debug('\u001B[1;37;41m UE faced real time issues! \u001B[0m') @@ -2428,7 +2428,15 @@ class SSHConnection(): self.CreateHtmlTestRow(str(self.idle_sleep_time) + ' sec', 'OK', ALL_PROCESSES_OK) def LogCollectBuild(self): - self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) + if (self.eNBIPAddress != '' and self.eNBUserName != '' and self.eNBPassword != ''): + self.IPAddress = self.eNBIPAddress + self.UserName = self.eNBUserName + self.Password = self.eNBPassword + elif (self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != ''): + self.IPAddress = self.UEIPAddress + self.UserName = self.UEUserName + self.Password = self.UEPassword + self.open(self.IPAddress, self.UserName, self.Password) self.command('cd ' + self.eNBSourceCodePath, '\$', 5) self.command('cd cmake_targets', '\$', 5) self.command('rm -f build.log.zip', '\$', 5) @@ -2502,6 +2510,15 @@ class SSHConnection(): self.command('zip spgw.log.zip xGwLog.0', '\$', 60) self.close() + def LogCollectOAIUE(self): + self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) + self.command('cd ' + self.UESourceCodePath, '\$', 5) + self.command('cd cmake_targets', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S rm -f ue.log.zip', '\$', 5) + self.command('echo ' + self.UEPassword + ' | sudo -S zip ue.log.zip ue*.log core* ue_*record.raw ue_*.pcap ue_*txt', '\$', 60) + self.command('echo ' + self.UEPassword + ' | sudo -S rm ue*.log core* ue_*record.raw ue_*.pcap ue_*txt', '\$', 5) + self.close() + def RetrieveSystemVersion(self): if self.eNBIPAddress == 'none': self.OsVersion = 'Ubuntu 16.04.5 LTS' @@ -3086,7 +3103,7 @@ elif re.match('^TerminateSPGW$', mode, re.IGNORECASE): sys.exit('Insufficient Parameter') SSH.TerminateSPGW() elif re.match('^LogCollectBuild$', mode, re.IGNORECASE): - if SSH.eNBIPAddress == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '': + if (SSH.eNBIPAddress == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '') and (SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == ''): Usage() sys.exit('Insufficient Parameter') SSH.LogCollectBuild() @@ -3120,6 +3137,11 @@ elif re.match('^LogCollectIperf$', mode, re.IGNORECASE): Usage() sys.exit('Insufficient Parameter') SSH.LogCollectIperf() +elif re.match('^LogCollectOAIUE$', mode, re.IGNORECASE): + if SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '': + Usage() + sys.exit('Insufficient Parameter') + SSH.LogCollectOAIUE() elif re.match('^InitiateHtml$', mode, re.IGNORECASE): if (SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == ''): Usage() -- GitLab From 0146f8bf59824861819c4469f65dda52d8094dee Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 11:34:53 +0100 Subject: [PATCH 281/308] Renamed xml_files/ue_band20_test_10mhz.xml to xml_files/ue_band20_build.xml. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- .../xml_files/{ue_band20_test_10mhz.xml => ue_band20_build.xml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ci-scripts/xml_files/{ue_band20_test_10mhz.xml => ue_band20_build.xml} (100%) diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz.xml b/ci-scripts/xml_files/ue_band20_build.xml similarity index 100% rename from ci-scripts/xml_files/ue_band20_test_10mhz.xml rename to ci-scripts/xml_files/ue_band20_build.xml -- GitLab From b53e7e65462868f157859f2a7dd7fb0f4bba7154 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 11:38:05 +0100 Subject: [PATCH 282/308] Removing 2 frequencies. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/Jenkinsfile-gitlab | 6 ++++++ ci-scripts/xml_files/ue_band20_build.xml | 4 ++++ ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml | 7 ------- ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml | 7 ------- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 5fa46ddcc0..c1675e5992 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -133,6 +133,7 @@ pipeline { script { def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI" addGitLabMRComment comment: message + currentBuild.result = 'FAILURE' } } } @@ -283,6 +284,11 @@ pipeline { } } post { + failure { + script { + currentBuild.result = 'FAILURE' + } + } always { script { dir ('archives') { diff --git a/ci-scripts/xml_files/ue_band20_build.xml b/ci-scripts/xml_files/ue_band20_build.xml index eeea2e359c..9ca1a2b234 100644 --- a/ci-scripts/xml_files/ue_band20_build.xml +++ b/ci-scripts/xml_files/ue_band20_build.xml @@ -21,9 +21,13 @@ --> <testCaseList> + <htmlTabRef>build-tab</htmlTabRef> + <htmlTabName>Build</htmlTabName> + <htmlTabIcon>wrench</htmlTabIcon> <TestCaseRequestedList> 090101 </TestCaseRequestedList> + <TestCaseExclusionList></TestCaseExclusionList> <testCase id="090101"> <class>Build_OAI_UE</class> diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml index f49a26c2f7..6e5e26c4a5 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml @@ -27,7 +27,6 @@ <TestCaseRequestedList> 090101 090102 000001 090109 -090103 000001 090109 </TestCaseRequestedList> <TestCaseExclusionList>090101</TestCaseExclusionList> @@ -43,12 +42,6 @@ <Initialize_OAI_UE_args>-C 816000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> </testCase> - <testCase id="090103"> - <class>Initialize_OAI_UE</class> - <desc>Initialize OAI UE -- sniffing Orange frequency</desc> - <Initialize_OAI_UE_args>-C 812000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> - </testCase> - <testCase id="000001"> <class>IdleSleep</class> <desc>Sleep</desc> diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml index f37df7ef42..02b310f9c3 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml @@ -27,7 +27,6 @@ <TestCaseRequestedList> 090101 090104 000001 090109 -090105 000001 090109 </TestCaseRequestedList> <TestCaseExclusionList>090101</TestCaseExclusionList> @@ -43,12 +42,6 @@ <Initialize_OAI_UE_args>-C 806000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> </testCase> - <testCase id="090105"> - <class>Initialize_OAI_UE</class> - <desc>Initialize OAI UE -- sniffing SFR frequency</desc> - <Initialize_OAI_UE_args>-C 802000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args> - </testCase> - <testCase id="000001"> <class>IdleSleep</class> <desc>Sleep</desc> -- GitLab From 2c2d34dc85abb90c8dcb31cd0260d5505b558dbe Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Fri, 22 Mar 2019 11:59:22 +0100 Subject: [PATCH 283/308] CI: fix when XML file is missing during HtmlInit Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/main.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 480a0ad661..3cdfae3af7 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -3147,14 +3147,20 @@ elif re.match('^InitiateHtml$', mode, re.IGNORECASE): Usage() sys.exit('Insufficient Parameter') count = 0 + foundCount = 0 while (count < SSH.nbTestXMLfiles): xml_test_file = cwd + "/" + SSH.testXMLfiles[count] - xmlTree = ET.parse(xml_test_file) - xmlRoot = xmlTree.getroot() - SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count))) - SSH.htmlTabNames.append(xmlRoot.findtext('htmlTabName',default='Test-' + str(count))) - SSH.htmlTabIcons.append(xmlRoot.findtext('htmlTabIcon',default='info-sign')) + xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[count] + if (os.path.isfile(xml_test_file)): + xmlTree = ET.parse(xml_test_file) + xmlRoot = xmlTree.getroot() + SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count))) + SSH.htmlTabNames.append(xmlRoot.findtext('htmlTabName',default='Test-' + str(count))) + SSH.htmlTabIcons.append(xmlRoot.findtext('htmlTabIcon',default='info-sign')) + foundCount += 1 count += 1 + if foundCount != SSH.nbTestXMLfiles: + SSH.nbTestXMLfiles = foundCount SSH.CreateHtmlHeader() elif re.match('^FinalizeHtml$', mode, re.IGNORECASE): SSH.CreateHtmlFooter(SSH.finalStatus) -- GitLab From 290a22e1baa4db042ed593e38845ebdd02f88f09 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 13:26:39 +0100 Subject: [PATCH 284/308] Adapting log collection in Jenkins script. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/Jenkinsfile-tmp-ue | 54 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue index 16ba3ef4c6..617d7c25ae 100644 --- a/ci-scripts/Jenkinsfile-tmp-ue +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -236,38 +236,38 @@ pipeline { } stage('Log Collection') { parallel { - stage('Log Collection (eNB - Build)') { + stage('Log Collection (OAI UE - Build)') { steps { - echo '\u2705 \u001B[32mLog Collection (eNB - Build)\u001B[0m' -// withCredentials([ -// [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] -// ]) { -// sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" -// -// echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m' -// sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" -// } -// script { -// if(fileExists("build.log.${env.BUILD_ID}.zip")) { -// archiveArtifacts "build.log.${env.BUILD_ID}.zip" -// } -// } + echo '\u2705 \u001B[32mLog Collection (OAI UE - Build)\u001B[0m' + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'] + ]) { + sh "python3 ci-scripts/main.py --mode=LogCollectBuild --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (UE - Build)\u001B[0m' + sh "sshpass -p \'${UE_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${UE_Username}@${params.UE_IPAddress}:${UE_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("build.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "build.log.${env.BUILD_ID}.zip" + } + } } } - stage('Log Collection (eNB - Run)') { + stage('Log Collection (OAI UE - Run)') { steps { - echo '\u2705 \u001B[32mLog Collection (eNB - Run)\u001B[0m' -// withCredentials([ -// [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] -// ]) { -// sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" -// -// echo '\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m' -// sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true" -// } + echo '\u2705 \u001B[32mLog Collection (OAI UE - Run)\u001B[0m' + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'] + ]) { + sh "python3 ci-scripts/main.py --mode=LogCollectUE --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (UE - Run)\u001B[0m' + sh "sshpass -p \'${UE_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${UE_Username}@${params.UE_IPAddress}:${UE_SourceCodePath}/cmake_targets/ue.log.zip ./ue.log.${env.BUILD_ID}.zip || true" + } script { - if(fileExists("enb.log.${env.BUILD_ID}.zip")) { - archiveArtifacts "enb.log.${env.BUILD_ID}.zip" + if(fileExists("ue.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "ue.log.${env.BUILD_ID}.zip" } if(fileExists("ci-scripts/test_results.html")) { sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html" -- GitLab From a282bea31c46f938cb29e38014efdc287ba5c2f8 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 13:42:05 +0100 Subject: [PATCH 285/308] fix Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 3cdfae3af7..aa3c890649 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -2432,16 +2432,20 @@ class SSHConnection(): self.IPAddress = self.eNBIPAddress self.UserName = self.eNBUserName self.Password = self.eNBPassword + self.SourceCodePath = self.eNBSourceCodePath elif (self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != ''): self.IPAddress = self.UEIPAddress self.UserName = self.UEUserName self.Password = self.UEPassword + self.SourceCodePath = self.UESourceCodePath + else: + sys.exit('Insufficient Parameter') self.open(self.IPAddress, self.UserName, self.Password) - self.command('cd ' + self.eNBSourceCodePath, '\$', 5) + self.command('cd ' + self.SourceCodePath, '\$', 5) self.command('cd cmake_targets', '\$', 5) self.command('rm -f build.log.zip', '\$', 5) self.command('zip build.log.zip build_log_*/*', '\$', 60) - self.command('echo ' + self.eNBPassword + ' | sudo -S rm -rf build_log_*', '\$', 5) + self.command('echo ' + self.Password + ' | sudo -S rm -rf build_log_*', '\$', 5) self.close() def LogCollecteNB(self): -- GitLab From b15ad72f846cf3661d058cdb23bb0d3ea3ee01a1 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 13:54:50 +0100 Subject: [PATCH 286/308] fix Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/Jenkinsfile-tmp-ue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue index 617d7c25ae..70fe29879f 100644 --- a/ci-scripts/Jenkinsfile-tmp-ue +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -260,7 +260,7 @@ pipeline { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'] ]) { - sh "python3 ci-scripts/main.py --mode=LogCollectUE --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath}" + sh "python3 ci-scripts/main.py --mode=LogCollectOAIUE --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath}" echo '\u2705 \u001B[32mLog Transfer (UE - Run)\u001B[0m' sh "sshpass -p \'${UE_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${UE_Username}@${params.UE_IPAddress}:${UE_SourceCodePath}/cmake_targets/ue.log.zip ./ue.log.${env.BUILD_ID}.zip || true" -- GitLab From a7f841ad741cf8ec82eb2f63931072f61693a92c Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 15:24:12 +0100 Subject: [PATCH 287/308] Printing UE in report and eNB by default. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index aa3c890649..851977a375 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -381,7 +381,7 @@ class SSHConnection(): self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) self.command('mv compile_oai_ue.log ' + 'build_log_' + self.testCase_id, '\$', 5) self.close() - self.CreateHtmlTestRow(self.Build_OAI_UE_args, 'OK', ALL_PROCESSES_OK) + self.CreateHtmlTestRow(self.Build_OAI_UE_args, 'OK', ALL_PROCESSES_OK, 'OAI UE') def InitializeHSS(self): @@ -657,7 +657,7 @@ class SSHConnection(): self.close() doLoop = False logging.error('\u001B[1;37;41m UE logging system did not show got sync! \u001B[0m') - self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'KO', ALL_PROCESSES_OK) + self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'KO', ALL_PROCESSES_OK, 'OAI UE') self.CreateHtmlTabFooter(False) ## In case of T tracer recording, we need to kill tshark on EPC side #result = re.search('T_stdout', str(self.Initialize_OAI_UE_args)) @@ -679,7 +679,7 @@ class SSHConnection(): time.sleep(6) else: doLoop = False - self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'OK', ALL_PROCESSES_OK) + self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'OK', ALL_PROCESSES_OK, 'OAI UE') logging.debug('\u001B[1m Initialize OAI UE Completed\u001B[0m') self.close() @@ -2388,7 +2388,10 @@ class SSHConnection(): self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + extracted_log_file, '.') logging.debug('\u001B[1m Analyzing UE replay logfile \u001B[0m') logStatus = self.AnalyzeLogFile_UE(extracted_log_file) - self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + html_cell = '<pre style="background-color:white">BLA\nBLA BLA ' + html_cell += '</pre>' + html_queue.put(html_cell) + self.CreateHtmlTestRow(html_queue, 'OK', ALL_PROCESSES_OK) self.UELogFile = '' else: result = re.search('ue_', str(self.UELogFile)) @@ -2772,7 +2775,7 @@ class SSHConnection(): self.htmlFile.write('</html>\n') self.htmlFile.close() - def CreateHtmlTestRow(self, options, status, processesStatus): + def CreateHtmlTestRow(self, options, status, processesStatus, machine='eNB'): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): self.htmlFile.write(' <tr>\n') self.htmlFile.write(' <td bgcolor = "lightcyan" >' + self.testCase_id + '</td>\n') @@ -2784,13 +2787,13 @@ class SSHConnection(): if (processesStatus == 0): self.htmlFile.write(' <td bgcolor = "lightcoral" >' + str(status) + '</td>\n') elif (processesStatus == ENB_PROCESS_FAILED): - self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - eNB process not found</td>\n') + self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process not found</td>\n') elif (processesStatus == ENB_PROCESS_SEG_FAULT): - self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - eNB process ended in Segmentation Fault</td>\n') + self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process ended in Segmentation Fault</td>\n') elif (processesStatus == ENB_PROCESS_ASSERTION): - self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - eNB process ended in Assertion</td>\n') + self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process ended in Assertion</td>\n') elif (processesStatus == ENB_PROCESS_REALTIME_ISSUE): - self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - eNB process faced Real Time issue(s)</td>\n') + self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process faced Real Time issue(s)</td>\n') elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE): self.htmlFile.write(' <td bgcolor = "orange" >OK</td>\n') elif (processesStatus == HSS_PROCESS_FAILED): -- GitLab From 20b13d64fbac2667a14b44259db2ca9cf532ec03 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 16:17:42 +0100 Subject: [PATCH 288/308] Replacing N/A with success message in cell. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 851977a375..e116620e93 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -2388,9 +2388,6 @@ class SSHConnection(): self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + extracted_log_file, '.') logging.debug('\u001B[1m Analyzing UE replay logfile \u001B[0m') logStatus = self.AnalyzeLogFile_UE(extracted_log_file) - html_cell = '<pre style="background-color:white">BLA\nBLA BLA ' - html_cell += '</pre>' - html_queue.put(html_cell) self.CreateHtmlTestRow(html_queue, 'OK', ALL_PROCESSES_OK) self.UELogFile = '' else: @@ -2410,10 +2407,10 @@ class SSHConnection(): self.CreateHtmlTabFooter(False) sys.exit(1) else: - self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.CreateHtmlTestRow('<pre style="background-color:white">sniffing successful/pre>', 'OK', ALL_PROCESSES_OK) self.UELogFile = '' else: - self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.CreateHtmlTestRow('<pre style="background-color:white">sniffing successful/pre>', 'OK', ALL_PROCESSES_OK) def AutoTerminateUEandeNB(self): self.testCase_id = 'AUTO-KILL-UE' -- GitLab From ee06bb4fd1ee216a919510ecfe7890db82c8d5e1 Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Fri, 22 Mar 2019 16:29:08 +0100 Subject: [PATCH 289/308] typo Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index e116620e93..1c90b6119a 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -2407,10 +2407,10 @@ class SSHConnection(): self.CreateHtmlTabFooter(False) sys.exit(1) else: - self.CreateHtmlTestRow('<pre style="background-color:white">sniffing successful/pre>', 'OK', ALL_PROCESSES_OK) + self.CreateHtmlTestRow('<pre style="background-color:white">sniffing successful</pre>', 'OK', ALL_PROCESSES_OK) self.UELogFile = '' else: - self.CreateHtmlTestRow('<pre style="background-color:white">sniffing successful/pre>', 'OK', ALL_PROCESSES_OK) + self.CreateHtmlTestRow('<pre style="background-color:white">sniffing successful</pre>', 'OK', ALL_PROCESSES_OK) def AutoTerminateUEandeNB(self): self.testCase_id = 'AUTO-KILL-UE' -- GitLab From dac4ceb7cba2a477f4712757fa16f9fc02e2fa40 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Fri, 22 Mar 2019 16:48:58 +0100 Subject: [PATCH 290/308] CI: adding call to new slave UE job from master pipeline Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/Jenkinsfile-gitlab | 55 +++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index c1675e5992..cd2d783638 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -398,7 +398,7 @@ pipeline { } } } - stage ("Test FDD - Band 7 - B210") { + stage ("Test MONOLITHIC - FDD - Band 7 - B210") { steps { script { if ("MERGE".equals(env.gitlabActionType)) { @@ -449,7 +449,7 @@ pipeline { } } } - stage ("Test TDD - Band 40 - B210") { + stage ("Test MONOLITHIC - TDD - Band 40 - B210") { steps { script { if ("MERGE".equals(env.gitlabActionType)) { @@ -653,6 +653,57 @@ pipeline { } } } + stage ("Test OAI UE Sniffing - FDD - Band 20 - B200") { + steps { + script { + if ("MERGE".equals(env.gitlabActionType)) { + //gitlabCommitStatus(name: "Test-OAI-UE-FDD-Band20") { + build job: 'UE-CI-FDD-Band20-B200', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: true), + string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch)) + ] + //} + } else { + //gitlabCommitStatus(name: "Test-OAI-UE-FDD-Band20") { + build job: 'UE-CI-FDD-Band20-B200', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), + string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), + booleanParam(name: 'eNB_mergeRequest', value: false) + ] + //} + } + } + } + post { + // In case of any non-success, we are retrieving the HTML report of the last completed + // slave job. + // The only drop-back is that we may retrieve the HTML report of a previous build + always { + script { + if (!fileExists('test_results-UE-CI-FDD-Band20-B200.html')) { + copyArtifacts(projectName: 'UE-CI-FDD-Band20-B200', + filter: 'test_results*.html', + selector: lastCompleted()) + if (fileExists('test_results-UE-CI-FDD-Band20-B200.html')) { + sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-UE-CI-FDD-Band20-B200.html" + archiveArtifacts artifacts: 'test_results-UE-CI-FDD-Band20-B200.html' + } + } + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } } post { always { -- GitLab From 7519b8e06159fc017e918820cfd314a4498f2eaf Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 23 Mar 2019 16:20:43 +0100 Subject: [PATCH 291/308] Free UE in RRC/S1/GTP if not DU --- openair2/RRC/LTE/rrc_eNB.c | 42 +++++++++++++------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index ea476d68db..adeede9c65 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7436,7 +7436,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1); - if (EPC_MODE_ENABLED) + if (EPC_MODE_ENABLED && RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p); else ue_to_be_removed = ue_context_p; @@ -7489,44 +7489,30 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) ue_context_p->ue_context.ue_release_timer_rrc = 1; ue_context_p->ue_context.ue_release_timer_thres_rrc = 100; - if (EPC_MODE_ENABLED) { - int e_rab = 0; - MessageDef *msg_complete_p = NULL; - MessageDef *msg_delete_tunnels_p = NULL; - uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id; - + if (EPC_MODE_ENABLED && RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) { if (rrc_release_info.RRC_release_ctrl[release_num].flag == 4) { // if timer_s1 == 0 - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_S1AP_ENB, NULL, 0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); - msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); - S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_complete_p); + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(ctxt_pP->module_id, + ue_context_p->ue_context.eNB_ue_s1ap_id); } - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id); - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - // do not wait response - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - - for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = - ue_context_p->ue_context.enb_gtp_ebi[e_rab]; - // erase data + rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(ctxt_pP->module_id, + ue_context_p); + // erase data of GTP tunnels in UE context + for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); - ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], + 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; - rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id); + rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, + ue_context_p->ue_context.eNB_ue_s1ap_id); if (rrc_ue_s1ap_ids != NULL) { rrc_eNB_S1AP_remove_ue_ids(RC.rrc[ctxt_pP->module_id], rrc_ue_s1ap_ids); } - } /* EPC_MODE_ENABLED */ + } /* EPC_MODE_ENABLED && node_type != ngran_eNB_DU */ rrc_release_info.RRC_release_ctrl[release_num].flag = 0; rrc_release_info.num_UEs--; -- GitLab From 9611a22a653f55a017dc2b3ff9d8555ba1f900a7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 23 Mar 2019 16:40:47 +0100 Subject: [PATCH 292/308] Remove warnings in RRC --- openair2/RRC/LTE/rrc_eNB.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index adeede9c65..500faa158a 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7628,8 +7628,6 @@ void *rrc_enb_process_itti_msg(void *notUsed) { const char *msg_name_p; instance_t instance; int result; - SRB_INFO *srb_info_p; - int CC_id; protocol_ctxt_t ctxt; memset(&ctxt, 0, sizeof(ctxt)); @@ -7662,7 +7660,10 @@ void *rrc_enb_process_itti_msg(void *notUsed) { msg_p->ittiMsgHeader.lte_time.slot); LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + instance, + RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, + &ctxt, + RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) { LOG_I(RRC, "CCCH message has size %d > %d\n", -- GitLab From 10a5e5fd759a80c6ac17098b69d69a85a10a86a5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 23 Mar 2019 16:57:26 +0100 Subject: [PATCH 293/308] Use OAI NUM_ENB/UE defines for F1U (removes warnings) --- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 2 -- openair2/LAYER2/PROTO_AGENT/proto_agent_common.c | 2 -- openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h | 7 +++---- openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c | 6 +++--- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index c6416cd5f9..0c5cd3fa8d 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -38,8 +38,6 @@ #ifndef PROTO_AGENT_H_ #define PROTO_AGENT_H_ #include "ENB_APP/enb_config.h" // for enb properties -/* avoid warnings */ -#undef NUM_MAX_ENB #include "proto_agent_common.h" diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 4d3abfdab5..1eca32b162 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -39,8 +39,6 @@ #include <time.h> #include "PHY/phy_extern.h" -/* avoid warnings */ -#undef NUM_MAX_ENB #include "proto_agent_common.h" #include "common/utils/LOG/log.h" diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h index 8724906d1a..08c91e7085 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h @@ -41,10 +41,9 @@ #include <pthread.h> #include <string.h> +#include "openairinterface5g_limits.h" #include "UTIL/ASYNC_IF/link_manager.h" -#define NUM_MAX_ENB 10 -#define NUM_MAX_UE 2048 #define DEFAULT_PROTO_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_PROTO_AGENT_PORT 2210 #define DEFAULT_PROTO_AGENT_CACHE "/mnt/oai_agent_cache" @@ -108,8 +107,8 @@ typedef struct { uint32_t total_rx_msg; uint32_t total_tx_msg; - uint32_t rx_msg[NUM_MAX_ENB]; - uint32_t tx_msg[NUM_MAX_ENB]; + uint32_t rx_msg[NUMBER_OF_eNB_MAX]; + uint32_t tx_msg[NUMBER_OF_eNB_MAX]; } proto_agent_info_t; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index d396748d76..f64a58f8e1 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -37,7 +37,7 @@ #include "proto_agent_net_comm.h" #include "common/utils/LOG/log.h" -proto_agent_channel_t *proto_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; +proto_agent_channel_t *proto_channel[NUMBER_OF_eNB_MAX][ENB_AGENT_MAX]; proto_agent_channel_instance_t channel_instance; int proto_agent_channel_id = 0; @@ -106,7 +106,7 @@ int proto_agent_destroy_channel(int channel_id) { } /*Unregister the channel from all agents*/ - for (i = 0; i < NUM_MAX_ENB; i++) { + for (i = 0; i < NUMBER_OF_eNB_MAX; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { if (proto_channel[i][j] != NULL) { if (proto_channel[i][j]->channel_id == e->channel_id) { @@ -130,7 +130,7 @@ err_code_t proto_agent_init_channel_container(void) { RB_INIT(&channel_instance.proto_agent_head); - for (i = 0; i < NUM_MAX_ENB; i++) { + for (i = 0; i < NUMBER_OF_eNB_MAX; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { proto_channel[i][j] = NULL; } -- GitLab From 4f6b1e46a5da45e78ed6097406a6976b4423c933 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 23 Mar 2019 17:10:43 +0100 Subject: [PATCH 294/308] Remove warnings for DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER() include --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 4 +++- openair2/RRC/LTE/L2_interface.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 1a0494eccc..bb477f5696 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -756,7 +756,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, int UE_id, rnti_t rntiP, - uint8_t *sduP, + const uint8_t *sduP, sdu_size_t sdu_lenP) { F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 6ffc3914fe..1406e48f3d 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -34,6 +34,8 @@ #ifndef F1AP_DU_RRC_MESSAGE_TRANSFER_H_ #define F1AP_DU_RRC_MESSAGE_TRANSFER_H_ +#include "f1ap_common.h" + int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, @@ -45,7 +47,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, int UE_id, rnti_t rntiP, - uint8_t *sduP, + const uint8_t *sduP, sdu_size_t sdu_lenP); #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index b9e95f9bd6..295847542a 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -42,7 +42,8 @@ #endif #include "flexran_agent_extern.h" - +#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace +#include "f1ap_du_rrc_message_transfer.h" extern RAN_CONTEXT_t RC; -- GitLab From c1f142cc445c3be2f7ccf2971fb5b785e8ebe674 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sat, 23 Mar 2019 17:32:28 +0100 Subject: [PATCH 295/308] Fix warnings: space between literal and identifier in macro This resolves the following warning: "error: invalid suffix on literal; C++11 requires a space between literal and identifier" Since this file might be included from a C++11 file. It only adds spaces. --- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h | 6 +++--- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h index 75213116a7..c6a5ca7213 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h @@ -65,7 +65,7 @@ (rLC_Pp->is_data_plane) ? "DRB AM" : "SRB AM",\ rLC_Pp->rb_id -#define PROTOCOL_RLC_AM_MSC_FMT "[RNTI %"PRIx16" %s %02u]" +#define PROTOCOL_RLC_AM_MSC_FMT "[RNTI %" PRIx16 " %s %02u]" #define PROTOCOL_RLC_AM_MSC_ARGS(CTXT_Pp, rLC_Pp) \ CTXT_Pp->rnti,\ (rLC_Pp->is_data_plane) ? "DRB AM" : "SRB AM",\ @@ -79,13 +79,13 @@ if (pmtl_rc != 0){\ if (pmtl_rc == EBUSY) {\ MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" Warning try lock %s busy",\ + "0 " PROTOCOL_RLC_AM_MSC_FMT " Warning try lock %s busy",\ PROTOCOL_RLC_AM_MSC_ARGS(cTXT,rLC),\ #mUTEX);\ pthread_mutex_lock(mUTEX);\ } else {\ MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" Error try lock %s %d",\ + "0 " PROTOCOL_RLC_AM_MSC_FMT " Error try lock %s %d",\ PROTOCOL_RLC_AM_MSC_ARGS(cTXT,rLC),\ #mUTEX, pmtl_rc);\ }\ diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h index f2f91ff68e..fc6e449acf 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h @@ -56,7 +56,7 @@ rLC_Pp->rb_id,\ __FUNCTION__ -#define PROTOCOL_RLC_UM_MSC_FMT "[RNTI %"PRIx16" %s %02u]" +#define PROTOCOL_RLC_UM_MSC_FMT "[RNTI %" PRIx16 " %s %02u]" #define PROTOCOL_RLC_UM_MSC_ARGS(CTXT_Pp, rLC_Pp) \ CTXT_Pp->rnti,\ (rLC_Pp->is_data_plane) ? "DRB UM" : "SRB UM",\ @@ -69,13 +69,13 @@ if (pmtl_rc != 0){\ if (pmtl_rc == EBUSY) {\ MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_UM_MSC_FMT" Warning try lock %s busy",\ + "0 " PROTOCOL_RLC_UM_MSC_FMT " Warning try lock %s busy",\ PROTOCOL_RLC_UM_MSC_ARGS(cTXT,rLC),\ #mUTEX);\ pthread_mutex_lock(mUTEX);\ } else {\ MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_UM_MSC_FMT" Error try lock %s %d",\ + "0 " PROTOCOL_RLC_UM_MSC_FMT " Error try lock %s %d",\ PROTOCOL_RLC_UM_MSC_ARGS(cTXT,rLC),\ #mUTEX, pmtl_rc);\ }\ -- GitLab From cdc2d921c16f98ea7a48b8578c44aaa3f71d618d Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 24 Mar 2019 16:45:32 +0100 Subject: [PATCH 296/308] FlexRAN: fix total_size_ul_mac_sdus parameter --- openair2/ENB_APP/flexran_agent_ran_api.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 8ada30cc82..249d0cffdb 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -225,7 +225,11 @@ uint32_t flexran_get_total_size_dl_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id uint32_t flexran_get_total_size_ul_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id) { if (!mac_is_present(mod_id)) return 0; - return RC.mac[mod_id]->eNB_stats[cc_id].total_ulsch_bytes_rx; + uint64_t bytes = 0; + for (int i = 0; i < NB_RB_MAX; ++i) { + bytes += RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].num_bytes_rx[i]; + } + return bytes; } uint32_t flexran_get_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id) -- GitLab From 0f9fbef24dabbd877f3cac3f730935b0b4c04773 Mon Sep 17 00:00:00 2001 From: laurent <laurent.thomas@open-cells.com> Date: Mon, 25 Mar 2019 10:09:04 +0100 Subject: [PATCH 297/308] add thread pool feature --- common/utils/threadPool/thread-pool.c | 53 ++++++++++++++++---------- common/utils/threadPool/thread-pool.h | 20 +++++----- common/utils/threadPool/thread-pool.md | 6 ++- 3 files changed, 46 insertions(+), 33 deletions(-) diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c index 8a706d9246..4cc56fc9b8 100644 --- a/common/utils/threadPool/thread-pool.c +++ b/common/utils/threadPool/thread-pool.c @@ -10,7 +10,9 @@ #include <fcntl.h> #include <string.h> #include <unistd.h> -#include <thread-pool.h> +#include <ctype.h> +#include <sys/sysinfo.h> +#include <threadPool/thread-pool.h> void displayList(notifiedFIFO_t *nf) { int n=0; @@ -46,12 +48,16 @@ static inline notifiedFIFO_elt_t *pullNotifiedFifoRemember( notifiedFIFO_t *nf, void *one_thread(void *arg) { struct one_thread *myThread=(struct one_thread *) arg; struct thread_pool *tp=myThread->pool; + // configure the thread core assignment // TBD: reserve the core for us exclusively - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - CPU_SET(myThread->coreID, &cpuset); - pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + if ( myThread->coreID >= 0 && myThread->coreID < get_nprocs_conf()) { + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(myThread->coreID, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + } + //Configure the thread scheduler policy for Linux struct sched_param sparam= {0}; sparam.sched_priority = sched_get_priority_max(SCHED_RR); @@ -112,22 +118,27 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { curptr=strtok_r(params,",",&saveptr); while ( curptr!=NULL ) { - if (curptr[0] == 'u' || curptr[0] == 'U') { - pool->restrictRNTI=true; - } else if ( curptr[0]>='0' && curptr[0]<='9' ) { - struct one_thread *tmp=pool->allthreads; - pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread)); - pool->allthreads->next=tmp; - printf("create a thread for core %d\n", atoi(curptr)); - pool->allthreads->coreID=atoi(curptr); - pool->allthreads->id=pool->nbThreads; - pool->allthreads->pool=pool; - pthread_create(&pool->allthreads->threadID, NULL, one_thread, (void *)pool->allthreads); - pool->nbThreads++; - } else if (curptr[0] == 'n' || curptr[0] == 'N') { - pool->activated=false; - } else - printf("Error in options for thread pool: %s\n",curptr); + int c=toupper(curptr[0]); + + switch (c) { + case 'U': + pool->restrictRNTI=true; + break; + + case 'N': + pool->activated=false; + break; + + default: + pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread)); + pool->allthreads->next=pool->allthreads; + printf("create a thread for core %d\n", atoi(curptr)); + pool->allthreads->coreID=atoi(curptr); + pool->allthreads->id=pool->nbThreads; + pool->allthreads->pool=pool; + pthread_create(&pool->allthreads->threadID, NULL, one_thread, (void *)pool->allthreads); + pool->nbThreads++; + } curptr=strtok_r(NULL,",",&saveptr); } diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 5c36364fc9..6f34508c5a 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -10,7 +10,7 @@ #include <pthread.h> #include <sys/syscall.h> #include <assertions.h> -#include <log.h> +#include <LOG/log.h> #ifdef DEBUG #define THREADINIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP @@ -52,8 +52,7 @@ static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size, notifiedFIFO_t *reponseFifo, void (*processingFunc)(void *)) { notifiedFIFO_elt_t *ret; - size_t sz=sizeof(notifiedFIFO_elt_t)+size; - AssertFatal( NULL != (ret=(notifiedFIFO_elt_t *) malloc((sz/32+1)*32)), ""); + AssertFatal( NULL != (ret=(notifiedFIFO_elt_t *) malloc(sizeof(notifiedFIFO_elt_t)+size+32)), ""); ret->next=NULL; ret->key=key; ret->reponseFifo=reponseFifo; @@ -69,8 +68,6 @@ static inline void *NotifiedFifoData(notifiedFIFO_elt_t *elt) { } static inline void delNotifiedFIFO_elt(notifiedFIFO_elt_t *elt) { - bool tmp=elt->malloced; - if (elt->malloced) { elt->malloced=false; free(elt); @@ -121,9 +118,10 @@ static inline notifiedFIFO_elt_t *pullNotifiedFIFO(notifiedFIFO_t *nf) { static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) { int tmp=mutextrylock(nf->lockF); + if (tmp != 0 ) return NULL; - + notifiedFIFO_elt_t *ret=nf->outF; if (ret!=NULL) @@ -194,21 +192,22 @@ static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_ msg->returnTime=rdtsc(); if (t->traceFd) - (void)write(t->traceFd, msg, sizeof(*msg)); + if(write(t->traceFd, msg, sizeof(*msg))); return msg; } static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) { - notifiedFIFO_elt_t *msg= pullNotifiedFIFO(responseFifo); + notifiedFIFO_elt_t *msg= pollNotifiedFIFO(responseFifo); + if (msg == NULL) return NULL; - + if (t->measurePerf) msg->returnTime=rdtsc(); if (t->traceFd) - (void)write(t->traceFd, msg, sizeof(*msg)); + if(write(t->traceFd, msg, sizeof(*msg))); return msg; } @@ -240,5 +239,6 @@ static inline void abortTpool(tpool_t *t, uint64_t key) { mutexunlock(nf->lockF); } +void initTpool(char *params,tpool_t *pool, bool performanceMeas); #endif diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md index 92cc21b975..2b6336fb60 100644 --- a/common/utils/threadPool/thread-pool.md +++ b/common/utils/threadPool/thread-pool.md @@ -11,7 +11,7 @@ All the thread pool functions are thread safe, nevertheless the working function ## license Author: Laurent Thomas, Open cells project -The owner share the code usage to Openairsoftware alliance as per OSA license terms +The owner share this piece code to Openairsoftware alliance as per OSA license terms # jobs @@ -41,6 +41,8 @@ abort_notifiedFIFO() allows the customer to delete all waiting jobs that match w The clients can create one or more thread pools with init_tpool() the params string structure: describes a list of cores, separated by "," that run a worker thread +If the core exists on the CPU, the thread pool initialization sets the affinity between this thread and the related code (use negative values is allowed, so the thread will never be mapped on a specific core). + The threads are all Linux real time scheduler, their name is set automatically is "Tpool_<core id>" ## adding jobs @@ -66,4 +68,4 @@ A performance measurement is integrated: the pool will automacillay fill timesta if you set the environement variable: thread-pool-measurements to a valid file name These measurements will be wrote to this Linux pipe. -A tool to read the linux fifo and display it in ascii will be provided (TBD) +A tool to read the linux fifo and display it in ascii is provided: see the local directory Makefile for this tool and to compile the thread pool unitary tests. -- GitLab From 27a8abfe51de12377cc5025e54a63dba52f8fe7b Mon Sep 17 00:00:00 2001 From: Boris Djalal <boris.djalal@eurecom.fr> Date: Mon, 25 Mar 2019 15:50:19 +0100 Subject: [PATCH 298/308] Removing a wrong change in match TerminateUE. Code cleaning. Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr> --- ci-scripts/main.py | 64 +++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 37 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 1c90b6119a..430d64a6c0 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -42,6 +42,7 @@ ENB_PROCESS_SEG_FAULT = -11 ENB_PROCESS_ASSERTION = -12 ENB_PROCESS_REALTIME_ISSUE = -13 ENB_PROCESS_NOLOGFILE_TO_ANALYZE = -14 +UE_PROCESS_NOLOGFILE_TO_ANALYZE = -20 HSS_PROCESS_FAILED = -2 HSS_PROCESS_OK = +2 MME_PROCESS_FAILED = -3 @@ -129,24 +130,13 @@ class SSHConnection(): self.CpuModel = '' self.CpuMHz = '' self.UEIPAddress = '' - self.UEBranch = '' - #self.UE_AllowMerge = False - self.UECommitID = '' - #self.UETargetBranch = '' self.UEUserName = '' self.UEPassword = '' self.UE_instance = '' - #self.UESourceCodePath = '' - #self.UECpuMHz = '' + self.UESourceCodePath = '' self.Build_OAI_UE_args = '' self.Initialize_OAI_UE_args = '' self.eNBOsVersion = '' - #self.eNBKernelVersion = '' - #self.eNBUsrpBoard = '' - #self.eNBUhdVersion = '' - #self.eNBCpuNb = '' - #self.eNBCpuModel = '' - #self.eNBCpuMHz = '' def open(self, ipaddress, username, password): count = 0 @@ -610,7 +600,7 @@ class SSHConnection(): # Reloading FGPA bin firmware self.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 5) else: - logging.debug('Did not find any B2xx device') + logging.debug('Did not find any B2xx device') self.command('cd ' + self.UESourceCodePath, '\$', 5) # Initialize_OAI_UE_args usually start with -C and followed by the location in repository #full_config_file = self.Initialize_OAI_UE_args.replace('-O ','') @@ -2044,7 +2034,7 @@ class SSHConnection(): self.htmleNBFailureMsg += rrcMsg + '\n' if rrcReconfigRequest > 0 or rrcReconfigComplete > 0: rrcMsg = 'eNB requested ' + str(rrcReconfigRequest) + ' RRC Connection Reconfiguration(s)' - logging.debug('\u001B[1;30;43m ' + rrcMsig + ' \u001B[0m') + logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') self.htmleNBFailureMsg += rrcMsg + '\n' rrcMsg = ' -- ' + str(rrcReconfigComplete) + ' were completed' logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') @@ -2397,7 +2387,7 @@ class SSHConnection(): if (copyin_res == -1): logging.debug('\u001B[1;37;41m Could not copy UE logfile to analyze it! \u001B[0m') self.htmlUEFailureMsg = 'Could not copy UE logfile to analyze it!' - self.CreateHtmlTestRow('N/A', 'KO', ENB_PROCESS_NOLOGFILE_TO_ANALYZE) + self.CreateHtmlTestRow('N/A', 'KO', UE_PROCESS_NOLOGFILE_TO_ANALYZE) self.UELogFile = '' return logging.debug('\u001B[1m Analyzing UE logfile \u001B[0m') @@ -2429,23 +2419,23 @@ class SSHConnection(): def LogCollectBuild(self): if (self.eNBIPAddress != '' and self.eNBUserName != '' and self.eNBPassword != ''): - self.IPAddress = self.eNBIPAddress - self.UserName = self.eNBUserName - self.Password = self.eNBPassword - self.SourceCodePath = self.eNBSourceCodePath + IPAddress = self.eNBIPAddress + UserName = self.eNBUserName + Password = self.eNBPassword + SourceCodePath = self.eNBSourceCodePath elif (self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != ''): - self.IPAddress = self.UEIPAddress - self.UserName = self.UEUserName - self.Password = self.UEPassword - self.SourceCodePath = self.UESourceCodePath + IPAddress = self.UEIPAddress + UserName = self.UEUserName + Password = self.UEPassword + SourceCodePath = self.UESourceCodePath else: sys.exit('Insufficient Parameter') - self.open(self.IPAddress, self.UserName, self.Password) - self.command('cd ' + self.SourceCodePath, '\$', 5) + self.open(IPAddress, UserName, Password) + self.command('cd ' + SourceCodePath, '\$', 5) self.command('cd cmake_targets', '\$', 5) self.command('rm -f build.log.zip', '\$', 5) self.command('zip build.log.zip build_log_*/*', '\$', 60) - self.command('echo ' + self.Password + ' | sudo -S rm -rf build_log_*', '\$', 5) + self.command('echo ' + Password + ' | sudo -S rm -rf build_log_*', '\$', 5) self.close() def LogCollecteNB(self): @@ -2536,18 +2526,18 @@ class SSHConnection(): machine = None if self.eNBIPAddress != '' and self.eNBUserName != '' and self.eNBPassword != '': machine = 'eNB' - self.IPAddress = self.eNBIPAddress - self.UserName = self.eNBUserName - self.Password = self.eNBPassword - if self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != '': + IPAddress = self.eNBIPAddress + UserName = self.eNBUserName + Password = self.eNBPassword + elif self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != '': machine = 'UE' - self.IPAddress = self.UEIPAddress - self.UserName = self.UEUserName - self.Password = self.UEPassword + IPAddress = self.UEIPAddress + UserName = self.UEUserName + Password = self.UEPassword if machine is None: Usage() sys.exit('Insufficient Parameter') - self.open(self.IPAddress, self.UserName, self.Password) + self.open(IPAddress, UserName, Password) self.command('lsb_release -a', '\$', 5) result = re.search('Description:\\\\t(?P<os_type>[a-zA-Z0-9\-\_\.\ ]+)', str(self.ssh.before)) if result is not None: @@ -2563,7 +2553,7 @@ class SSHConnection(): if result is not None: self.UhdVersion = result.group('uhd_version') logging.debug('UHD Version is: ' + self.UhdVersion) - self.command('echo ' + self.Password + ' | sudo -S uhd_find_devices', '\$', 5) + self.command('echo ' + Password + ' | sudo -S uhd_find_devices', '\$', 5) result = re.search('product: (?P<usrp_board>[0-9A-Za-z]+)\\\\r\\\\n', str(self.ssh.before)) if result is not None: self.UsrpBoard = result.group('usrp_board') @@ -2791,7 +2781,7 @@ class SSHConnection(): self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process ended in Assertion</td>\n') elif (processesStatus == ENB_PROCESS_REALTIME_ISSUE): self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process faced Real Time issue(s)</td>\n') - elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE): + elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE) or (processesStatus == UE_PROCESS_NOLOGFILE_TO_ANALYZE): self.htmlFile.write(' <td bgcolor = "orange" >OK</td>\n') elif (processesStatus == HSS_PROCESS_FAILED): self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - HSS process not found</td>\n') @@ -3080,7 +3070,7 @@ if re.match('^TerminateeNB$', mode, re.IGNORECASE): sys.exit('Insufficient Parameter') SSH.TerminateeNB() elif re.match('^TerminateUE$', mode, re.IGNORECASE): - if SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == '': + if (SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == ''): Usage() sys.exit('Insufficient Parameter') signal.signal(signal.SIGUSR1, receive_signal) -- GitLab From bc234f200fe64da8954685824bc48546945cf7db Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Tue, 26 Mar 2019 09:21:06 +0100 Subject: [PATCH 299/308] bugfix: initialize SRB1 data even for monolithic eNB --- openair2/ENB_APP/enb_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 0a2b6c0726..648ddf9457 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -1297,7 +1297,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { } // node_type!=ngran_eNB_DU } - if ( (rrc->node_type == ngran_eNB_CU) || (rrc->node_type == ngran_ng_eNB_CU) || (rrc->node_type == ngran_gNB_CU) ) { + if (rrc->node_type == ngran_eNB || rrc->node_type == ngran_eNB_CU || rrc->node_type == ngran_ng_eNB_CU || rrc->node_type == ngran_gNB_CU) { char srb1path[MAX_OPTNAME_SIZE*2 + 8]; sprintf(srb1path,"%s.%s",enbpath,ENB_CONFIG_STRING_SRB1); config_get( SRB1Params,sizeof(SRB1Params)/sizeof(paramdef_t), srb1path); -- GitLab From dc9a68ff3084c9f27fccc0180ea21e176a9bd160 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 26 Mar 2019 10:49:47 +0100 Subject: [PATCH 300/308] Correct condition to read MIB/SIB1 params only when not CU --- openair2/ENB_APP/enb_config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 648ddf9457..db688a7965 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -441,7 +441,8 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { //printf("Component carrier %d\n",component_carrier); nb_cc++; - if ( (rrc->node_type != ngran_eNB_CU) || (rrc->node_type != ngran_ng_eNB_CU) || (rrc->node_type != ngran_gNB_CU) ) { + if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU && rrc->node_type != ngran_gNB_CU) { + // Cell params, MIB/SIB1 in DU RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = ccparams_lte.tdd_config; AssertFatal (ccparams_lte.tdd_config <= LTE_TDD_Config__subframeAssignment_sa6, "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!", -- GitLab From f0fced85f27ebb0dffd0ce4238b02592fb71a23d Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 26 Mar 2019 10:50:11 +0100 Subject: [PATCH 301/308] Execute pdcp_run from rrc_data_req only when in CU mode --- openair2/RRC/LTE/L2_interface_common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index 49592ba261..8f7909a375 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -44,6 +44,8 @@ //#define RRC_DATA_REQ_DEBUG //#define DEBUG_RRC 1 +extern RAN_CONTEXT_t RC; + //------------------------------------------------------------------------------ uint8_t rrc_data_req( @@ -106,8 +108,11 @@ rrc_data_req( ctxt_pP->instance, message_p); LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n"); - // RS/BK: Fix ME - pdcp_run(ctxt_pP); + /* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads + * Ideally, PDCP would not neet to be triggered like this but react to ITTI + * messages automatically */ + if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) + pdcp_run(ctxt_pP); return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. -- GitLab From 024007716a586068e6106df3808a46338a217cb4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 26 Mar 2019 13:15:02 +0100 Subject: [PATCH 302/308] Check type of node using NODE_IS_CU/DU/MONOLITHIC macros --- common/ngran_types.h | 4 ++ openair2/ENB_APP/enb_app.c | 8 +-- openair2/ENB_APP/enb_config.c | 10 +-- openair2/LAYER2/MAC/eNB_scheduler.c | 3 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 15 ++--- openair2/LAYER2/RLC/rlc.c | 2 +- openair2/RRC/LTE/L2_interface.c | 2 +- openair2/RRC/LTE/L2_interface_common.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 86 +++++++++----------------- targets/COMMON/create_tasks.c | 48 ++++++-------- targets/RT/USER/lte-softmodem.c | 9 +-- 11 files changed, 72 insertions(+), 117 deletions(-) diff --git a/common/ngran_types.h b/common/ngran_types.h index 1fe48e372b..224a85def5 100644 --- a/common/ngran_types.h +++ b/common/ngran_types.h @@ -44,4 +44,8 @@ typedef enum { ngran_gNB_DU = 7 } ngran_node_t; +#define NODE_IS_MONOLITHIC(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB || (nOdE_TyPe) == ngran_ng_eNB || (nOdE_TyPe) == ngran_gNB) +#define NODE_IS_CU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_CU || (nOdE_TyPe) == ngran_ng_eNB_CU || (nOdE_TyPe) == ngran_gNB_CU) +#define NODE_IS_DU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_DU || (nOdE_TyPe) == ngran_gNB_DU) + #endif diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index f2e7aeec30..0580f0eb52 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -69,7 +69,7 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { { - if (node_type == ngran_eNB_DU) { // F1AP registration + if (NODE_IS_DU(node_type)) { // F1AP registration // configure F1AP here for F1C LOG_I(ENB_APP,"ngran_eNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); @@ -143,7 +143,7 @@ void *eNB_app_task(void *args_p) { } /* Try to register each eNB with each other */ - if (is_x2ap_enabled() && RC.rrc[0]->node_type == ngran_eNB) { // CU or DU do not need + if (is_x2ap_enabled() && !NODE_IS_DU(RC.rrc[0]->node_type)) { x2_register_enb_pending = eNB_app_register_x2 (enb_id_start, enb_id_end); } @@ -167,7 +167,7 @@ void *eNB_app_task(void *args_p) { break; case S1AP_REGISTER_ENB_CNF: - AssertFatal(RC.rrc[0]->node_type != ngran_eNB_DU, "Should not have received S1AP_REGISTER_ENB_CNF\n"); + AssertFatal(!NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received S1AP_REGISTER_ENB_CNF\n"); if (EPC_MODE_ENABLED) { LOG_I(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); @@ -206,7 +206,7 @@ void *eNB_app_task(void *args_p) { break; case F1AP_SETUP_RESP: - AssertFatal(RC.rrc[0]->node_type == ngran_eNB_DU, "Should not have received F1AP_REGISTER_ENB_CNF in CU/eNB\n"); + AssertFatal(NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received F1AP_REGISTER_ENB_CNF in CU/eNB\n"); LOG_I(ENB_APP, "Received %s: associated ngran_eNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p), F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index db688a7965..189cf01e0e 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -441,7 +441,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { //printf("Component carrier %d\n",component_carrier); nb_cc++; - if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU && rrc->node_type != ngran_gNB_CU) { + if (!NODE_IS_CU(rrc->node_type)) { // Cell params, MIB/SIB1 in DU RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = ccparams_lte.tdd_config; AssertFatal (ccparams_lte.tdd_config <= LTE_TDD_Config__subframeAssignment_sa6, @@ -533,7 +533,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = ccparams_lte.nb_antenna_ports; } - if (rrc->node_type != ngran_eNB_DU) {//this is CU or eNB, SIB2-20 in CU + if (!NODE_IS_DU(rrc->node_type)) { //this is CU or eNB, SIB2-20 in CU // Radio Resource Configuration (SIB2) RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_root = ccparams_lte.prach_root; @@ -1295,10 +1295,10 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if (SLconfig.sidelink_configured==1) fill_SL_configuration(msg_p,&SLconfig,i,j,RC.config_file_name); else printf("No SL configuration skipping it\n"); - } // node_type!=ngran_eNB_DU + } // !NODE_IS_DU(node_type) } - if (rrc->node_type == ngran_eNB || rrc->node_type == ngran_eNB_CU || rrc->node_type == ngran_ng_eNB_CU || rrc->node_type == ngran_gNB_CU) { + if (!NODE_IS_DU(rrc->node_type)) { char srb1path[MAX_OPTNAME_SIZE*2 + 8]; sprintf(srb1path,"%s.%s",enbpath,ENB_CONFIG_STRING_SRB1); config_get( SRB1Params,sizeof(SRB1Params)/sizeof(paramdef_t), srb1path); @@ -2618,6 +2618,6 @@ void read_config_and_init(void) RCconfig_RRC(enb_id, RC.rrc[enb_id],macrlc_has_f1[enb_id]); } - if (RC.rrc[0]->node_type != ngran_eNB_DU) + if (!NODE_IS_DU(RC.rrc[0]->node_type)) pdcp_layer_init(); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 23ffb7a236..ab2856c40c 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -404,8 +404,7 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id, // check threshold if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 4000) { // note: probably ul_failure_timer should be less than UE radio link failure time(see T310/N310/N311) - if (RC.rrc[module_idP]->node_type == ngran_eNB_DU - || RC.rrc[module_idP]->node_type == ngran_gNB_DU) { + if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rnti; F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 79b4a02865..b72f26780c 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -191,9 +191,7 @@ boolean_t pdcp_data_req( LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP); } #ifndef UETARGET - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU - || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU - || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { /* currently, there is no support to send also the source/destinationL2Id */ proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p); @@ -374,9 +372,7 @@ boolean_t pdcp_data_req( LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU - || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU - || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { /* currently, there is no support to send also the source/destinationL2Id */ proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); @@ -386,8 +382,7 @@ boolean_t pdcp_data_req( LOG_D(PDCP, "proto_agent_send_rlc_data_req for UE RNTI %x, rb %d, pdu size %d \n", ctxt_pP->rnti, rb_idP, pdcp_pdu_size); - } else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU - || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU){ + } else if (NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)){ LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type); ret=FALSE; } else @@ -429,9 +424,7 @@ boolean_t pdcp_data_req( { #ifndef UETARGET - if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)|| - (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) ) { + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { // DL transfer MessageDef *message_p; // Note: the acyual task must be TASK_PDCP_ENB, but this task is not created diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index d30f0fe27c..96803652e8 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -611,7 +611,7 @@ void rlc_data_ind ( AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU, "Can't be CU, bad node type %d\n", type); - if (type == ngran_eNB_DU || type == ngran_gNB_DU) { + if (NODE_IS_DU(type)) { if (srb_flagP == 1) { MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti; diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 295847542a..7bfeb43b53 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -244,7 +244,7 @@ mac_rrc_data_ind( { - if ( RC.rrc[module_idP]->node_type == ngran_eNB_DU) { + if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) { LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %d length %d for UE id %d RNTI %x \n", module_idP, srb_idP, sdu_lenP, UE_id, rntiP); diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index 8f7909a375..c313ddc86b 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -111,7 +111,7 @@ rrc_data_req( /* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads * Ideally, PDCP would not neet to be triggered like this but react to ITTI * messages automatically */ - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) pdcp_run(ctxt_pP); return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 500faa158a..f330399901 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -154,8 +154,7 @@ init_SI( PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); LOG_I(RRC,"[eNB %d] Node type %d \n ", ctxt_pP->module_id, rrc->node_type); - if ((rrc->node_type == ngran_eNB_DU) || - (rrc->node_type == ngran_eNB) ) { + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { // copy basic Cell parameters carrier->physCellId = configuration->Nid_cell[CC_id]; carrier->p_eNB = configuration->nb_antenna_ports[CC_id]; @@ -208,11 +207,7 @@ init_SI( #endif } - if (rrc->node_type != ngran_eNB_DU) { - - /*if ((rrc->node_type == ngran_eNB_CU) || - (rrc->node_type == ngran_ng_eNB_CU) || - (rrc->node_type == ngran_eNB)) { */ + if (!NODE_IS_DU(rrc->node_type)) { carrier->SIB23 = (uint8_t*) malloc16(64); AssertFatal(carrier->SIB23!=NULL,"cannot allocate memory for SIB"); carrier->sizeof_SIB23 = do_SIB23(ctxt_pP->module_id, @@ -376,7 +371,7 @@ init_SI( #if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) // LTE-M stuff here (take out CU-DU for now) - if (rrc->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(rrc->node_type)) { if ((carrier->mib.message.schedulingInfoSIB1_BR_r13>0) && (carrier->sib1_BR!=NULL)) { AssertFatal(carrier->sib1_BR->nonCriticalExtension!=NULL, @@ -457,7 +452,7 @@ init_SI( } else */ - if (rrc->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(rrc->node_type)) { LOG_D(RRC, "About to call rrc_mac_config_req_eNB for ngran_eNB\n"); rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, @@ -560,7 +555,7 @@ init_MCCH( // call mac_config_req with appropriate structure from ASN.1 description // LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); // LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); - if (rrc->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(rrc->node_type)) { rrc_mac_config_req_eNB(enb_mod_idP, CC_id, 0,0,0,0,0, #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) @@ -623,9 +618,7 @@ static void init_MBMS( , &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) ,NULL); - if ((RC.rrc[enb_mod_idP]->node_type != ngran_eNB_CU) || - (RC.rrc[enb_mod_idP]->node_type != ngran_ng_eNB_CU) || - (RC.rrc[enb_mod_idP]->node_type != ngran_gNB_CU) ) { + if (!NODE_IS_CU(RC.rrc[enb_mod_idP]->node_type)) { rrc_rlc_config_asn1_req(&ctxt, NULL, // LTE_SRB_ToAddModList NULL, // LTE_DRB_ToAddModList @@ -927,9 +920,7 @@ rrc_eNB_free_UE( } if(EPC_MODE_ENABLED) { - if (RC.rrc[enb_mod_idP]->node_type == ngran_eNB - || RC.rrc[enb_mod_idP]->node_type == ngran_eNB_CU - || RC.rrc[enb_mod_idP]->node_type == ngran_gNB_CU) { + if (!NODE_IS_DU(RC.rrc[enb_mod_idP]->node_type)) { if((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED)) { LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 21, radio connection with ue lost\n", enb_mod_idP, @@ -1085,14 +1076,12 @@ void release_UE_in_freeList(module_id_t mod_id) { } } - if (RC.rrc[mod_id]->node_type != ngran_eNB_CU - && RC.rrc[mod_id]->node_type != ngran_ng_eNB_CU - && RC.rrc[mod_id]->node_type != ngran_gNB_CU) { + if (!NODE_IS_CU(RC.rrc[mod_id]->node_type)) { rrc_mac_remove_ue(mod_id,rnti); rrc_rlc_remove_ue(&ctxt); pdcp_remove_UE(&ctxt); } - else if (RC.rrc[mod_id]->node_type == ngran_eNB_CU || RC.rrc[mod_id]->node_type == ngran_ng_eNB_CU) { + else { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; @@ -1187,8 +1176,7 @@ rrc_eNB_generate_SecurityModeCommand( rrc_eNB_mui, size); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU)) { + if (!NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) { LOG_I(RRC,"calling rrc_data_req :securityModeCommand\n"); rrc_data_req(ctxt_pP, @@ -1338,7 +1326,7 @@ rrc_eNB_generate_RRCConnectionReestablishment( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_config_req_eNB(ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, 0,0,0,0,0, @@ -1391,9 +1379,7 @@ rrc_eNB_generate_RRCConnectionReestablishment( PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReestablishment (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ue_p->Srb0.Tx_buffer.payload_size); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU)) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); if(UE_id != -1){ // activate release timer, if RRCComplete not received after 100 frames, remove UE @@ -1996,9 +1982,7 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( ) //----------------------------------------------------------------------------- { - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); if(UE_id != -1) { @@ -2103,8 +2087,7 @@ rrc_eNB_generate_RRCConnectionRelease( } pthread_mutex_unlock(&rrc_release_freelist); - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU - || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) { + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; @@ -5567,7 +5550,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; } - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_config_req_eNB(ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, 0,0,0,0,0, @@ -5610,9 +5593,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); */ - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_rlc_config_req(ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, @@ -5626,7 +5607,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_config_req_eNB(ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, 0,0,0,0,0, @@ -5990,7 +5971,7 @@ char openair_rrc_eNB_configuration( LOG_W(RRC, "[inst %d] RRC->MCC/MSG->MCC %d/%d \n", ctxt.module_id, RC.rrc[ctxt.module_id]->mcc, rrc_configuration_req->mcc); */ - if (RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) + if (NODE_IS_CU(RC.rrc[ctxt.module_id]->node_type)) // msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SCTP_REQ); // RCconfig_CU_F1(msg_p, enb_id); setup_ngran_CU(RC.rrc[ctxt.module_id]); @@ -6230,9 +6211,7 @@ rrc_eNB_decode_ccch( NULL , (LTE_PMCH_InfoList_r9_t *) NULL ,NULL); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU)&& - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_rlc_config_asn1_req(ctxt_pP, ue_context_p->ue_context.SRB_configList, (LTE_DRB_ToAddModList_t *) NULL, @@ -6313,9 +6292,7 @@ rrc_eNB_decode_ccch( if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); } else { @@ -6419,10 +6396,9 @@ rrc_eNB_decode_ccch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), random_value); - if (RC.rrc[ctxt_pP->module_id] == ngran_eNB) + if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); - else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || - RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) { + else if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; @@ -6484,9 +6460,7 @@ rrc_eNB_decode_ccch( #endif ,NULL); - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_rlc_config_asn1_req(ctxt_pP, ue_context_p->ue_context.SRB_configList, (LTE_DRB_ToAddModList_t *) NULL, @@ -6654,9 +6628,7 @@ rrc_eNB_decode_dcch( break; } - AssertFatal(RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU - && RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU - && RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU, + AssertFatal(!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type), "CU cannot decode DCCH: no access to RC.mac[]\n"); if(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag == 1) { @@ -6906,7 +6878,7 @@ rrc_eNB_decode_dcch( if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. present == LTE_RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - AssertFatal(RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU && RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU, + AssertFatal(!NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type), "should not be reached in DU\n"); rrc_eNB_process_RRCConnectionSetupComplete( ctxt_pP, @@ -7436,7 +7408,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1); - if (EPC_MODE_ENABLED && RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) + if (EPC_MODE_ENABLED && !NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p); else ue_to_be_removed = ue_context_p; @@ -7489,7 +7461,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) ue_context_p->ue_context.ue_release_timer_rrc = 1; ue_context_p->ue_context.ue_release_timer_thres_rrc = 100; - if (EPC_MODE_ENABLED && RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) { + if (EPC_MODE_ENABLED && !NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) { if (rrc_release_info.RRC_release_ctrl[release_num].flag == 4) { // if timer_s1 == 0 rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(ctxt_pP->module_id, ue_context_p->ue_context.eNB_ue_s1ap_id); @@ -7512,7 +7484,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) if (rrc_ue_s1ap_ids != NULL) { rrc_eNB_S1AP_remove_ue_ids(RC.rrc[ctxt_pP->module_id], rrc_ue_s1ap_ids); } - } /* EPC_MODE_ENABLED && node_type != ngran_eNB_DU */ + } /* EPC_MODE_ENABLED && !NODE_IS_DU */ rrc_release_info.RRC_release_ctrl[release_num].flag = 0; rrc_release_info.num_UEs--; @@ -7851,7 +7823,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { /* Messages from F1AP task */ case F1AP_SETUP_REQ: - AssertFatal(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU, + AssertFatal(NODE_IS_CU(RC.rrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST, need call by CU!\n"); LOG_I(RRC,"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); handle_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 1e06eba0ac..cfc2bc2215 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -64,39 +64,29 @@ int create_tasks(uint32_t enb_nb) { } - switch (type) { - case ngran_eNB_CU: - case ngran_ng_eNB_CU: - case ngran_gNB_CU: + if (EPC_MODE_ENABLED && !NODE_IS_DU(type)) { + rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for S1AP failed\n"); + if (!(get_softmodem_params()->emulate_rf)){ + rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for UDP failed\n"); + } + rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); + if (is_x2ap_enabled()) { + rc = itti_create_task(TASK_X2AP, x2ap_task, NULL); + AssertFatal(rc >= 0, "Create task for X2AP failed\n"); + } else { + LOG_I(X2AP, "X2AP is disabled.\n"); + } + } + + if (NODE_IS_CU(type)) { rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL); AssertFatal(rc >= 0, "Create task for CU F1AP failed\n"); - /* fall through */ - case ngran_eNB: - case ngran_ng_eNB: - case ngran_gNB: - if (EPC_MODE_ENABLED) { - rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for S1AP failed\n"); - if (!(get_softmodem_params()->emulate_rf)){ - rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for UDP failed\n"); - } - rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); - if (is_x2ap_enabled()) { - rc = itti_create_task(TASK_X2AP, x2ap_task, NULL); - AssertFatal(rc >= 0, "Create task for X2AP failed\n"); - } else { - LOG_I(X2AP, "X2AP is disabled.\n"); - } - } - break; - default: - /* intentionally left blank */ - break; } - if (type == ngran_eNB_DU || type == ngran_gNB_DU) { + if (NODE_IS_DU(type)) { rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL); AssertFatal(rc >= 0, "Create task for DU F1AP failed\n"); } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 966b363822..aa8d832ed3 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -688,8 +688,7 @@ int main( int argc, char **argv ) { RCconfig_L1(); } - if (RC.nb_inst > 0 - && (RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { + if (RC.nb_inst > 0 && NODE_IS_CU(RC.rrc[0]->node_type)) { protocol_ctxt_t ctxt; ctxt.module_id = 0 ; ctxt.instance = 0; @@ -699,8 +698,7 @@ int main( int argc, char **argv ) { } /* start threads if only L1 or not a CU */ - if (RC.nb_inst == 0 || - !(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { + if (RC.nb_inst == 0 || !NODE_IS_CU(RC.rrc[0]->node_type)) { // init UE_PF_PO and mutex lock pthread_mutex_init(&ue_pf_po_mutex, NULL); memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs); @@ -851,8 +849,7 @@ int main( int argc, char **argv ) { // stop threads - if (RC.nb_inst == 0 || - !(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { + if (RC.nb_inst == 0 || !NODE_IS_CU(RC.rrc[0]->node_type)) { int UE_id; #ifdef XFORMS printf("waiting for XFORMS thread\n"); -- GitLab From 896ea4a72a50909fbf6b853742ff4f22d0b611c1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 26 Mar 2019 13:37:14 +0100 Subject: [PATCH 303/308] Fix: Check for node type in L2_interface only when not UE --- openair2/RRC/LTE/L2_interface_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index c313ddc86b..c17318d601 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -108,11 +108,13 @@ rrc_data_req( ctxt_pP->instance, message_p); LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n"); +#ifndef UETARGET /* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads * Ideally, PDCP would not neet to be triggered like this but react to ITTI * messages automatically */ if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) pdcp_run(ctxt_pP); +#endif return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. -- GitLab From 551319ef87bf7e9bf845239f7c7af85da1b85d2f Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Tue, 26 Mar 2019 13:52:53 +0100 Subject: [PATCH 304/308] Fix segmentation fault. The si_Periodicity value was taking very lage values. Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- openair2/LAYER2/MAC/eNB_scheduler_bch.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index c1f2e85c6a..d49ebbb264 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -372,7 +372,15 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13]; // check if the SI is to be scheduled now - int period_in_sf = 80 << si_Periodicity; // 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms + int period_in_sf; + if ((si_Periodicity >= 0) && (si_Periodicity < 25)) { + // 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms + period_in_sf = 80 << ((int) si_Periodicity); + } else if (si_Periodicity < 0) { + period_in_sf = 80; + } else if (si_Periodicity > 24) { + period_in_sf = 80 << 24; + } int sf_mod_period = absSF % period_in_sf; int k = sf_mod_period & 3; // Note: definition of k and rvidx from 36.321 section 5.3.1 -- GitLab From cce291c5fc48d8aa25e8e931ef7163d5a54ef46c Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Wed, 27 Mar 2019 11:10:35 +0100 Subject: [PATCH 305/308] CI: fixing the cppcheck assertion non-check. fixed also new warnings Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/cppcheck_suppressions.list | 2 +- ci-scripts/oai-ci-vm-tool | 4 +- common/utils/assertions.h | 2 - common/utils/msc/msc.c | 2 +- openair1/PHY/LTE_UE_TRANSPORT/pch_ue.c | 2 +- openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c | 2 +- openair3/S1AP/s1ap_common.h | 2 +- openair3/S1AP/s1ap_eNB_handlers.c | 110 ++++++++---------- openair3/S1AP/s1ap_eNB_nas_procedures.c | 28 ++--- openair3/TEST/EPC_TEST/generate_scenario.c | 6 +- openair3/TEST/EPC_TEST/play_scenario.c | 6 +- openair3/TEST/EPC_TEST/play_scenario_parse.c | 2 +- openair3/TEST/EPC_TEST/play_scenario_s1ap.c | 4 +- .../EPC_TEST/play_scenario_s1ap_compare_ie.c | 2 +- openair3/UDP/udp_eNB_task.c | 2 +- 15 files changed, 76 insertions(+), 100 deletions(-) diff --git a/ci-scripts/cppcheck_suppressions.list b/ci-scripts/cppcheck_suppressions.list index cbe7f5f8fb..4536f57315 100644 --- a/ci-scripts/cppcheck_suppressions.list +++ b/ci-scripts/cppcheck_suppressions.list @@ -72,7 +72,7 @@ uninitvar:openair2/UTIL/OTG/otg_rx_socket.c // iteration of the loop. nullPointer:common/utils/T/local_tracer.c:243 //----------------------------------------------------------------------------- -// once again cppcheck is not to understand that fds is initialized in the +// once again cppcheck does not understand that fds is initialized in the // first iteration of the loop nullPointer:common/utils/T/tracer/multi.c:264 nullPointer:common/utils/T/tracer/multi.c:265 diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index 917b0e7491..4a545e78c8 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -264,7 +264,7 @@ case $key in ARCHIVES_LOC=cppcheck LOG_PATTERN=cppcheck.xml NB_PATTERN_FILES=1 - BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list" + BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4" NBARGS=$[$NBARGS+256] shift ;; @@ -344,7 +344,7 @@ case $key in ARCHIVES_LOC=cppcheck LOG_PATTERN=cppcheck.xml NB_PATTERN_FILES=1 - BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list" + BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4" NBARGS=$[$NBARGS+256] ;; enb-ethernet) diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 77e939affe..97f1866274 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -35,13 +35,11 @@ void output_log_mem(void); #define _Assert_Exit_ \ -{ \ fprintf(stderr, "\nExiting execution\n"); \ display_backtrace(); \ fflush(stdout); \ fflush(stderr); \ exit(EXIT_FAILURE); \ -} #define _Assert_(cOND, aCTION, fORMAT, aRGS...) \ do { \ diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c index cc5ed17bc7..ae87a8e326 100644 --- a/common/utils/msc/msc.c +++ b/common/utils/msc/msc.c @@ -150,7 +150,7 @@ int msc_init(const msc_env_t envP, const int max_threadsP) pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH); AssertFatal (pointer_p, "malloc failed!\n"); rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p ); - AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %u\n", i); + AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %d\n", i); } for (i = MIN_MSC_PROTOS; i < MAX_MSC_PROTOS; i++) { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pch_ue.c index aed3ddabc1..972dd83905 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pch_ue.c @@ -48,7 +48,7 @@ int init_ue_paging_info(PHY_VARS_UE *ue, long defaultPagingCycle, long nB) { else if (Ns==4) ue->PO = (fp->frame_type==FDD) ? (4*(i_s&1)+(5*(i_s>>1))) : ((i_s&1)+(5*(i_s>>1))); else - AssertFatal(1==0,"init_ue_paging_info: Ns is %d\n",Ns); + AssertFatal(1==0,"init_ue_paging_info: Ns is %u\n",Ns); return(0); } diff --git a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c index 535ab8f1fa..365d6d23a5 100644 --- a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c +++ b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c @@ -144,7 +144,7 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, AssertFatal((msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE) <= tpduOffset, "Mismatch GTPU len, msgExtraLen %u tpduOffset %u", msgExtraLen, - tpduOffset); + (uint32_t) tpduOffset); pMsg->msgBuf = tpdu; pMsg->msgBufLen = tpduLength + msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE; pMsg->msgBufOffset = tpduOffset - (msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE); diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h index fc872564c5..77d03f4ae4 100644 --- a/openair3/S1AP/s1ap_common.h +++ b/openair3/S1AP/s1ap_common.h @@ -105,8 +105,8 @@ extern int asn1_xer_print; } \ if (ie == NULL ) { \ S1AP_ERROR("S1AP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\ - if (mandatory) _Assert_Exit_ \ } \ + if (mandatory) DevAssert(ie != NULL); \ } while(0) /** \brief Function callback prototype. **/ diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 98bdbeb54d..0c3b1ee25b 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -272,15 +272,11 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container, S1AP_ProtocolIE_ID_id_Cause,true); - if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - if ((ie->value.choice.Cause.present == S1AP_Cause_PR_misc) && - (ie->value.choice.Cause.choice.misc == S1AP_CauseMisc_unspecified)) { - S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n"); - } else { - S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); - } + if ((ie->value.choice.Cause.present == S1AP_Cause_PR_misc) && + (ie->value.choice.Cause.choice.misc == S1AP_CauseMisc_unspecified)) { + S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n"); } else { - return -1; + S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); } mme_desc_p->state = S1AP_ENB_STATE_WAITING; @@ -318,68 +314,60 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, /* The list of served gummei can contain at most 8 elements. * LTE related gummei is the first element in the list, i.e with an id of 0. */ - if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - S1AP_DEBUG("servedGUMMEIs.list.count %d\n", ie->value.choice.ServedGUMMEIs.list.count); - DevAssert(ie->value.choice.ServedGUMMEIs.list.count > 0); - DevAssert(ie->value.choice.ServedGUMMEIs.list.count <= S1AP_maxnoofRATs); - - for (i = 0; i < ie->value.choice.ServedGUMMEIs.list.count; i++) { - S1AP_ServedGUMMEIsItem_t *gummei_item_p; - struct served_gummei_s *new_gummei_p; - int j; - gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i]; - new_gummei_p = calloc(1, sizeof(struct served_gummei_s)); - STAILQ_INIT(&new_gummei_p->served_plmns); - STAILQ_INIT(&new_gummei_p->served_group_ids); - STAILQ_INIT(&new_gummei_p->mme_codes); - S1AP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count); - - for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) { - S1AP_PLMNidentity_t *plmn_identity_p; - struct plmn_identity_s *new_plmn_identity_p; - plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j]; - new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); - TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, - new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length); - STAILQ_INSERT_TAIL(&new_gummei_p->served_plmns, new_plmn_identity_p, next); - new_gummei_p->nb_served_plmns++; - } - - for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) { - S1AP_MME_Group_ID_t *mme_group_id_p; - struct served_group_id_s *new_group_id_p; - mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j]; - new_group_id_p = calloc(1, sizeof(struct served_group_id_s)); - OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id); - STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next); - new_gummei_p->nb_group_id++; - } + S1AP_DEBUG("servedGUMMEIs.list.count %d\n", ie->value.choice.ServedGUMMEIs.list.count); + DevAssert(ie->value.choice.ServedGUMMEIs.list.count > 0); + DevAssert(ie->value.choice.ServedGUMMEIs.list.count <= S1AP_maxnoofRATs); + + for (i = 0; i < ie->value.choice.ServedGUMMEIs.list.count; i++) { + S1AP_ServedGUMMEIsItem_t *gummei_item_p; + struct served_gummei_s *new_gummei_p; + int j; + gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i]; + new_gummei_p = calloc(1, sizeof(struct served_gummei_s)); + STAILQ_INIT(&new_gummei_p->served_plmns); + STAILQ_INIT(&new_gummei_p->served_group_ids); + STAILQ_INIT(&new_gummei_p->mme_codes); + S1AP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count); + + for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) { + S1AP_PLMNidentity_t *plmn_identity_p; + struct plmn_identity_s *new_plmn_identity_p; + plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j]; + new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); + TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, + new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length); + STAILQ_INSERT_TAIL(&new_gummei_p->served_plmns, new_plmn_identity_p, next); + new_gummei_p->nb_served_plmns++; + } - for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) { - S1AP_MME_Code_t *mme_code_p; - struct mme_code_s *new_mme_code_p; - mme_code_p = gummei_item_p->servedMMECs.list.array[j]; - new_mme_code_p = calloc(1, sizeof(struct mme_code_s)); - OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code); - STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next); - new_gummei_p->nb_mme_code++; - } + for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) { + S1AP_MME_Group_ID_t *mme_group_id_p; + struct served_group_id_s *new_group_id_p; + mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j]; + new_group_id_p = calloc(1, sizeof(struct served_group_id_s)); + OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id); + STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next); + new_gummei_p->nb_group_id++; + } - STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); + for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) { + S1AP_MME_Code_t *mme_code_p; + struct mme_code_s *new_mme_code_p; + mme_code_p = gummei_item_p->servedMMECs.list.array[j]; + new_mme_code_p = calloc(1, sizeof(struct mme_code_s)); + OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code); + STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next); + new_gummei_p->nb_mme_code++; } - } else { - return -1; + + STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); } /* Set the capacity of this MME */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true); - if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; - } else { - return -1; - } + mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; /* Optionaly set the mme name */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index 6652ca0447..bd0fd13208 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -501,18 +501,12 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, container = &pdu->choice.initiatingMessage.value.choice.DownlinkNASTransport; S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true); - if (ie == NULL) { /* checked by macro, but cppcheck doesn't see it */ - return -1; - } else { - mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; - } + mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); - if (ie == NULL) { /* checked by macro, but cppcheck doesn't see it */ - return -1; - } else { - enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; - } + enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; + if ((ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance, enb_ue_s1ap_id)) == NULL) { MSC_LOG_RX_DISCARDED_MESSAGE( @@ -566,15 +560,11 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_NAS_PDU, true); /* Forward the NAS PDU to RRC */ - if (ie != NULL) { /* checked by macro, but cppcheck doesn't see it */ - s1ap_eNB_itti_send_nas_downlink_ind(s1ap_eNB_instance->instance, - ue_desc_p->ue_initial_id, - ue_desc_p->eNB_ue_s1ap_id, - ie->value.choice.NAS_PDU.buf, - ie->value.choice.NAS_PDU.size); - } else { - return -1; - } + s1ap_eNB_itti_send_nas_downlink_ind(s1ap_eNB_instance->instance, + ue_desc_p->ue_initial_id, + ue_desc_p->eNB_ue_s1ap_id, + ie->value.choice.NAS_PDU.buf, + ie->value.choice.NAS_PDU.size); return 0; } diff --git a/openair3/TEST/EPC_TEST/generate_scenario.c b/openair3/TEST/EPC_TEST/generate_scenario.c index b1a3297866..a8a3590945 100644 --- a/openair3/TEST/EPC_TEST/generate_scenario.c +++ b/openair3/TEST/EPC_TEST/generate_scenario.c @@ -353,7 +353,7 @@ void enb_config_init(const char const * lib_config_file_name_pP) setting_enb = config_setting_get_elem(setting, i); active_enb[i] = config_setting_get_string (setting_enb); AssertFatal (active_enb[i] != NULL, - "Failed to parse config file %s, %uth attribute %s \n", + "Failed to parse config file %s, %dth attribute %s \n", lib_config_file_name_pP, i, ENB_CONFIG_STRING_ACTIVE_ENBS); active_enb[i] = strdup(active_enb[i]); num_enb_properties += 1; @@ -393,7 +393,7 @@ void enb_config_init(const char const * lib_config_file_name_pP) ) ) { AssertError (0, parse_errors ++, - "Failed to parse eNB configuration file %s, %u th enb\n", + "Failed to parse eNB configuration file %s, %d th enb\n", lib_config_file_name_pP, i); continue; // FIXME this prevents segfaults below, not sure what happens after function exit } @@ -441,7 +441,7 @@ void enb_config_init(const char const * lib_config_file_name_pP) ) ) { AssertError (0, parse_errors ++, - "Failed to parse eNB configuration file %s, %u th enb %u th mme address !\n", + "Failed to parse eNB configuration file %s, %d th enb %d th mme address !\n", lib_config_file_name_pP, i, j); continue; // FIXME will prevent segfaults below, not sure what happens at function exit... } diff --git a/openair3/TEST/EPC_TEST/play_scenario.c b/openair3/TEST/EPC_TEST/play_scenario.c index a50eac95cf..3af47f21a8 100644 --- a/openair3/TEST/EPC_TEST/play_scenario.c +++ b/openair3/TEST/EPC_TEST/play_scenario.c @@ -473,7 +473,7 @@ void et_enb_config_init(const char const * lib_config_file_name_pP) setting_enb = config_setting_get_elem(setting, i); active_enb[i] = config_setting_get_string (setting_enb); AssertFatal (active_enb[i] != NULL, - "Failed to parse config file %s, %uth attribute %s \n", + "Failed to parse config file %s, %dth attribute %s \n", lib_config_file_name_pP, i, ENB_CONFIG_STRING_ACTIVE_ENBS); active_enb[i] = strdup(active_enb[i]); num_enb_properties += 1; @@ -513,7 +513,7 @@ void et_enb_config_init(const char const * lib_config_file_name_pP) ) ) { AssertError (0, parse_errors ++, - "Failed to parse eNB configuration file %s, %u th enb\n", + "Failed to parse eNB configuration file %s, %d th enb\n", lib_config_file_name_pP, i); continue; // FIXME this prevents segfaults below, not sure what happens after function exit } @@ -561,7 +561,7 @@ void et_enb_config_init(const char const * lib_config_file_name_pP) ) ) { AssertError (0, parse_errors ++, - "Failed to parse eNB configuration file %s, %u th enb %u th mme address !\n", + "Failed to parse eNB configuration file %s, %d th enb %d th mme address !\n", lib_config_file_name_pP, i, j); continue; // FIXME will prevent segfaults below, not sure what happens at function exit... } diff --git a/openair3/TEST/EPC_TEST/play_scenario_parse.c b/openair3/TEST/EPC_TEST/play_scenario_parse.c index d24fddddec..607ec34dfc 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_parse.c +++ b/openair3/TEST/EPC_TEST/play_scenario_parse.c @@ -104,7 +104,7 @@ void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * co rc = et_hex2data( &s1ap->binary_stream[s1ap->binary_stream_pos], xml_char, xmlStrlen(xml_char)); s1ap->binary_stream_pos += xmlStrlen(xml_char)/2; //et_display_node(cur_node, 0); - AssertFatal (rc >= 0, "ERROR in converting hex string %s len %d size %d rc %d\n", xml_char, xmlStrlen(xml_char), size, rc); + AssertFatal (rc >= 0, "ERROR in converting hex string %s len %d size %u rc %d\n", xml_char, xmlStrlen(xml_char), size, rc); go_deeper_in_tree = 0; //} xmlFree(xml_char); diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c index d2bf05c086..acc9b18f76 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c +++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c @@ -616,7 +616,7 @@ int et_scenario_set_packet_received(et_packet_t * const packet) if (0 != packet->timer_id) { rc = timer_remove(packet->timer_id); - AssertFatal(rc == 0, "TODO: Debug Timer on Rx packet num %d unknown", packet->packet_number); + AssertFatal(rc == 0, "TODO: Debug Timer on Rx packet num %u unknown", packet->packet_number); g_scenario->timer_count--; return rc; } @@ -919,7 +919,7 @@ void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id, break; default: - AssertFatal(0, "Unknown chunk_type %d packet num %d", packet->sctp_hdr.chunk_type, packet->packet_number); + AssertFatal(0, "Unknown chunk_type %d packet num %u", packet->sctp_hdr.chunk_type, packet->packet_number); ; } packet = packet->next; diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c index 001834fcab..bc7ca6afbd 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c +++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c @@ -122,7 +122,7 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con hex[2] = '\0'; end_ptr = hex; uli = strtoul(hex, &end_ptr, 16); - AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %ld errno %d", hex, uli, errno); + AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %lu errno %d", hex, uli, errno); s1ap->binary_stream[pos++] = (unsigned char)uli; } while (pos2 < (2*5)); // update ASN1 diff --git a/openair3/UDP/udp_eNB_task.c b/openair3/UDP/udp_eNB_task.c index fdcdeb037a..27f754badc 100644 --- a/openair3/UDP/udp_eNB_task.c +++ b/openair3/UDP/udp_eNB_task.c @@ -169,7 +169,7 @@ int udp_eNB_create_socket(int port, char *ip_addr, task_id_t task_id) if ((rc = bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in))) < 0) { close(sd); - AssertFatal(rc >= 0, "UDP: Failed to bind socket: (%s:%d) address %s port %u\n", + AssertFatal(rc >= 0, "UDP: Failed to bind socket: (%s:%d) address %s port %d\n", strerror(errno), errno, ip_addr, port); } -- GitLab From 783583880d69a2aded3ccccef2acb790b948e076 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Wed, 27 Mar 2019 15:06:01 +0100 Subject: [PATCH 306/308] CI: improved HTML reporting on OAI UE Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/main.py | 126 +++++++++++------- .../xml_files/ue_band20_test_10mhz_orange.xml | 9 +- .../xml_files/ue_band20_test_10mhz_sfr.xml | 9 +- 3 files changed, 83 insertions(+), 61 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 430d64a6c0..96d7397e46 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -43,6 +43,8 @@ ENB_PROCESS_ASSERTION = -12 ENB_PROCESS_REALTIME_ISSUE = -13 ENB_PROCESS_NOLOGFILE_TO_ANALYZE = -14 UE_PROCESS_NOLOGFILE_TO_ANALYZE = -20 +UE_PROCESS_COULD_NOT_SYNC = -21 +UE_PROCESS_ASSERTION = -22 HSS_PROCESS_FAILED = -2 HSS_PROCESS_OK = +2 MME_PROCESS_FAILED = -3 @@ -332,8 +334,6 @@ class SSHConnection(): self.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) self.command('mv compile_oai_enb.log ' + 'build_log_' + self.testCase_id, '\$', 5) - # Workaround to run with develop-nr - self.command('if [ -e ran_build ]; then cp -rf ran_build lte_build_oai; fi', '\$', 30) self.close() self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) @@ -2086,6 +2086,9 @@ class SSHConnection(): pdcpFailure = 0 ulschFailure = 0 no_cell_sync_found = False + mib_found = False + frequency_found = False + self.htmlUEFailureMsg = '' for line in ue_log_file.readlines(): result = re.search('[Ss]egmentation [Ff]ault', str(line)) if result is not None: @@ -2105,66 +2108,78 @@ class SSHConnection(): result = re.search('uci->stat', str(line)) if result is not None: uciStatMsgCount += 1 - # full pattern # No cell synchronization found, abandoning result = re.search('No cell synchronization found, abandoning', str(line)) if result is not None: no_cell_sync_found = True - # MIB Information => FDD, NORMAL, NidCell 421, N_RB_DL 50, PHICH DURATION 0, PHICH RESOURCE 1/6, TX_ANT 2 - # mask --> FDD NORMAL 421 50 0 1/6 2 result = re.search("MIB Information => ([a-zA-Z]{1,10}), ([a-zA-Z]{1,10}), NidCell (?P<nidcell>\d{1,3}), N_RB_DL (?P<n_rb_dl>\d{1,3}), PHICH DURATION (?P<phich_duration>\d), PHICH RESOURCE (?P<phich_resource>.{1,4}), TX_ANT (?P<tx_ant>\d)", str(line)) - if result is not None: + if result is not None and (not mib_found): try: - print('\033[94m' + "MIB Information: " + result.group(1) + ', ' + result.group(2) + '\033[0m') - print('\033[94m' + "nidcell = " + result.group('nidcell') + '\033[0m') - print('\033[94m' + "n_rb_dl = " + result.group('n_rb_dl') + '\033[0m') - print('\033[94m' + "phich_duration = " + result.group('phich_duration') + '\033[0m') - print('\033[94m' + "phich_resource = " + result.group('phich_resource') + '\033[0m') - print('\033[94m' + "tx_ant = " + result.group('tx_ant') + '\033[0m') + mibMsg = "MIB Information: " + result.group(1) + ', ' + result.group(2) + self.htmlUEFailureMsg += mibMsg + '\n' + logging.debug('\033[94m' + mibMsg + '\033[0m') + mibMsg = " nidcell = " + result.group('nidcell') + self.htmlUEFailureMsg += mibMsg + logging.debug('\033[94m' + mibMsg + '\033[0m') + mibMsg = " n_rb_dl = " + result.group('n_rb_dl') + self.htmlUEFailureMsg += mibMsg + '\n' + logging.debug('\033[94m' + mibMsg + '\033[0m') + mibMsg = " phich_duration = " + result.group('phich_duration') + self.htmlUEFailureMsg += mibMsg + logging.debug('\033[94m' + mibMsg + '\033[0m') + mibMsg = " phich_resource = " + result.group('phich_resource') + self.htmlUEFailureMsg += mibMsg + '\n' + logging.debug('\033[94m' + mibMsg + '\033[0m') + mibMsg = " tx_ant = " + result.group('tx_ant') + self.htmlUEFailureMsg += mibMsg + '\n' + logging.debug('\033[94m' + mibMsg + '\033[0m') + mib_found = True except Exception as e: - print('\033[91m' + "a marker was not found" + '\033[0m') - # Measured Carrier Frequency 816000688 Hz (offset 12 Hz) - # mask --> 816000688i + logging.error('\033[91m' + "MIB marker was not found" + '\033[0m') result = re.search("Measured Carrier Frequency (?P<measured_carrier_frequency>\d{1,15}) Hz", str(line)) - if result is not None: + if result is not None and (not frequency_found): try: - print('\033[94m' + "Measured Carrier Frequency = " + result.group('measured_carrier_frequency') + '\033[0m') + mibMsg = "Measured Carrier Frequency = " + result.group('measured_carrier_frequency') + ' Hz' + self.htmlUEFailureMsg += mibMsg + '\n' + logging.debug('\033[94m' + mibMsg + '\033[0m') + frequency_found = True except Exception as e: - print('\033[91m' + "Measured Carrier Frequency not found" + '\033[0m') - # Found Orange FR (name from internal table) - # mask Orange FR + logging.error('\033[91m' + "Measured Carrier Frequency not found" + '\033[0m') result = re.search("Found (?P<operator>[\w,\s]{1,15}) \(name from internal table\)", str(line)) if result is not None: try: - print('\033[94m' + "The operator is: " + result.group('operator') + '\033[0m') + mibMsg = "The operator is: " + result.group('operator') + self.htmlUEFailureMsg += mibMsg + '\n' + logging.debug('\033[94m' + mibMsg + '\033[0m') except Exception as e: - print('\033[91m' + "Operator name not found" + '\033[0m') - # SIB5 InterFreqCarrierFreq element 0/3 - # mask -- 0 and 3 + logging.error('\033[91m' + "Operator name not found" + '\033[0m') result = re.search("SIB5 InterFreqCarrierFreq element (.{1,4})/(.{1,4})", str(line)) if result is not None: try: - print('\033[94m' + "SIB5 InterFreqCarrierFreq element " + result.group(1) + '/' + result.group(2) + '\033[0m') + mibMsg = "SIB5 InterFreqCarrierFreq element " + result.group(1) + '/' + result.group(2) + self.htmlUEFailureMsg += mibMsg + ' -> ' + logging.debug('\033[94m' + mibMsg + '\033[0m') except Exception as e: - print('\033[91m' + "SIB5 InterFreqCarrierFreq element not found" + '\033[0m') - # DL Carrier Frequency/ARFCN : 2645000000/3000 - # mask 2645000000 - result = re.search("DL Carrier Frequency/ARFCN : (?P<carrier_frequency>)\d{1,15}/\d{1,4}", str(line)) + logging.error('\033[91m' + "SIB5 InterFreqCarrierFreq element not found" + '\033[0m') + result = re.search("DL Carrier Frequency/ARFCN : (?P<carrier_frequency>\d{1,15}/\d{1,4})", str(line)) if result is not None: try: - print('\033[94m' + "DL Carrier Frequency is: " + result.group('carrier_frequency') + '\033[0m') + freq = result.group('carrier_frequency') + new_freq = re.sub('/[0-9]+','',freq) + float_freq = float(new_freq) / 1000000 + self.htmlUEFailureMsg += 'DL Freq: ' + ('%.1f' % float_freq) + ' MHz' + logging.debug('\033[94m' + " DL Carrier Frequency is: " + freq + '\033[0m') except Exception as e: - print('\033[91m' + "DL Carrier Frequency not found" + '\033[0m') - # AllowedMeasBandwidth : 100 - # mask 100 + logging.error('\033[91m' + " DL Carrier Frequency not found" + '\033[0m') result = re.search("AllowedMeasBandwidth : (?P<allowed_bandwidth>\d{1,7})", str(line)) if result is not None: try: - print('\033[94m' + "AllowedMeasBandwidth: " + result.group('allowed_bandwidth') + '\033[0m') + prb = result.group('allowed_bandwidth') + self.htmlUEFailureMsg += ' -- PRB: ' + prb + '\n' + logging.debug('\033[94m' + " AllowedMeasBandwidth: " + prb + '\033[0m') except Exception as e: - print('\033[91m' + "AllowedMeasBandwidth not found" + '\033[0m') + logging.error('\033[91m' + " AllowedMeasBandwidth not found" + '\033[0m') ue_log_file.close() - self.htmlUEFailureMsg = '' if uciStatMsgCount > 0: statMsg = 'UE showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') @@ -2186,12 +2201,19 @@ class SSHConnection(): return ENB_PROCESS_SEG_FAULT if foundAssertion: logging.debug('\u001B[1;37;43m UE ended with an assertion! \u001B[0m') - self.htmlUEFailureMsg += msgAssertion - return ENB_PROCESS_ASSERTION + # removed for esthetics + #self.htmlUEFailureMsg += msgAssertion + self.htmlUEFailureMsg += 'UE ended with an assertion!\n' + if not mib_found or not frequency_found: + return UE_PROCESS_ASSERTION if foundRealTimeIssue: logging.debug('\u001B[1;37;41m UE faced real time issues! \u001B[0m') self.htmlUEFailureMsg += 'UE faced real time issues!\n' #return ENB_PROCESS_REALTIME_ISSUE + if no_cell_sync_found and not mib_found: + logging.debug('\u001B[1;37;41m UE could not synchronize ! \u001B[0m') + self.htmlUEFailureMsg += 'UE could not synchronize!\n' + return UE_PROCESS_COULD_NOT_SYNC if rlcDiscardBuffer > 0: rlcMsg = 'UE RLC discarded ' + str(rlcDiscardBuffer) + ' buffer(s)' logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m') @@ -2386,21 +2408,27 @@ class SSHConnection(): copyin_res = self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + self.UELogFile, '.') if (copyin_res == -1): logging.debug('\u001B[1;37;41m Could not copy UE logfile to analyze it! \u001B[0m') - self.htmlUEFailureMsg = 'Could not copy UE logfile to analyze it!' - self.CreateHtmlTestRow('N/A', 'KO', UE_PROCESS_NOLOGFILE_TO_ANALYZE) + optionsMsg = '<pre style="background-color:white">Could not copy UE logfile to analyze it!</pre>' + self.CreateHtmlTestRow(optionsMsg, 'KO', UE_PROCESS_NOLOGFILE_TO_ANALYZE, 'UE') self.UELogFile = '' return logging.debug('\u001B[1m Analyzing UE logfile \u001B[0m') logStatus = self.AnalyzeLogFile_UE(self.UELogFile) if (logStatus < 0): - self.CreateHtmlTestRow('N/A', 'KO', logStatus) + optionsMsg = '<pre style="background-color:white"><b>Sniffing Unsuccessful</b>\n' + optionsMsg += self.htmlUEFailureMsg + optionsMsg += '</pre>' + self.CreateHtmlTestRow(optionsMsg, 'KO', logStatus, 'UE') self.CreateHtmlTabFooter(False) sys.exit(1) else: - self.CreateHtmlTestRow('<pre style="background-color:white">sniffing successful</pre>', 'OK', ALL_PROCESSES_OK) + optionsMsg = '<pre style="background-color:white"><b>Sniffing Successful</b>\n' + optionsMsg += self.htmlUEFailureMsg + optionsMsg += '</pre>' + self.CreateHtmlTestRow(optionsMsg, 'OK', ALL_PROCESSES_OK) self.UELogFile = '' else: - self.CreateHtmlTestRow('<pre style="background-color:white">sniffing successful</pre>', 'OK', ALL_PROCESSES_OK) + self.CreateHtmlTestRow('<pre style="background-color:white">No Log File to analyze</pre>', 'OK', ALL_PROCESSES_OK) def AutoTerminateUEandeNB(self): self.testCase_id = 'AUTO-KILL-UE' @@ -2574,6 +2602,9 @@ class SSHConnection(): #----------------------------------------------------------- def CreateHtmlHeader(self): if (not self.htmlHeaderCreated): + logging.debug('\u001B[1m----------------------------------------\u001B[0m') + logging.debug('\u001B[1m Creating HTML header \u001B[0m') + logging.debug('\u001B[1m----------------------------------------\u001B[0m') self.htmlFile = open('test_results.html', 'w') self.htmlFile.write('<!DOCTYPE html>\n') self.htmlFile.write('<html class="no-js" lang="en-US">\n') @@ -2720,6 +2751,9 @@ class SSHConnection(): def CreateHtmlFooter(self, passStatus): if (os.path.isfile('test_results.html')): + logging.debug('\u001B[1m----------------------------------------\u001B[0m') + logging.debug('\u001B[1m Creating HTML footer \u001B[0m') + logging.debug('\u001B[1m----------------------------------------\u001B[0m') self.RetrieveSystemVersion() self.htmlFile = open('test_results.html', 'a') self.htmlFile.write('</div>\n') @@ -2777,12 +2811,14 @@ class SSHConnection(): self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process not found</td>\n') elif (processesStatus == ENB_PROCESS_SEG_FAULT): self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process ended in Segmentation Fault</td>\n') - elif (processesStatus == ENB_PROCESS_ASSERTION): + elif (processesStatus == ENB_PROCESS_ASSERTION) or (processesStatus == UE_PROCESS_ASSERTION): self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process ended in Assertion</td>\n') elif (processesStatus == ENB_PROCESS_REALTIME_ISSUE): self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - ' + machine + ' process faced Real Time issue(s)</td>\n') elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE) or (processesStatus == UE_PROCESS_NOLOGFILE_TO_ANALYZE): - self.htmlFile.write(' <td bgcolor = "orange" >OK</td>\n') + self.htmlFile.write(' <td bgcolor = "orange" >OK?</td>\n') + elif (processesStatus == UE_PROCESS_COULD_NOT_SYNC): + self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - UE could not sync</td>\n') elif (processesStatus == HSS_PROCESS_FAILED): self.htmlFile.write(' <td bgcolor = "lightcoral" >KO - HSS process not found</td>\n') elif (processesStatus == MME_PROCESS_FAILED): diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml index 6e5e26c4a5..0e61e75d56 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml @@ -25,16 +25,9 @@ <htmlTabName>Test-10Mhz-Orange</htmlTabName> <htmlTabIcon>tasks</htmlTabIcon> <TestCaseRequestedList> -090101 090102 000001 090109 </TestCaseRequestedList> - <TestCaseExclusionList>090101</TestCaseExclusionList> - - <testCase id="090101"> - <class>Build_OAI_UE</class> - <desc>Build OAI UE</desc> - <Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args> - </testCase> + <TestCaseExclusionList></TestCaseExclusionList> <testCase id="090102"> <class>Initialize_OAI_UE</class> diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml index 02b310f9c3..ae8aa0e668 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml @@ -25,16 +25,9 @@ <htmlTabName>Test-10MHz-SFR</htmlTabName> <htmlTabIcon>tasks</htmlTabIcon> <TestCaseRequestedList> -090101 090104 000001 090109 </TestCaseRequestedList> - <TestCaseExclusionList>090101</TestCaseExclusionList> - - <testCase id="090101"> - <class>Build_OAI_UE</class> - <desc>Build OAI UE</desc> - <Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args> - </testCase> + <TestCaseExclusionList></TestCaseExclusionList> <testCase id="090104"> <class>Initialize_OAI_UE</class> -- GitLab From 046089ac275a78e00df5e9e7bfb94a65f88e66c4 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Thu, 28 Mar 2019 15:01:25 +0100 Subject: [PATCH 307/308] CI: fixing image links in documentation Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- doc/L2NFAPI.md | 2 +- doc/L2NFAPI_S1.md | 4 ++-- doc/images/oai_final_logo.png | Bin 0 -> 24129 bytes 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 doc/images/oai_final_logo.png diff --git a/doc/L2NFAPI.md b/doc/L2NFAPI.md index 8d48bf8b34..4dcaaef3bc 100644 --- a/doc/L2NFAPI.md +++ b/doc/L2NFAPI.md @@ -2,7 +2,7 @@ <tr style="border-collapse: collapse; border: none;"> <td style="border-collapse: collapse; border: none;"> <a href="http://www.openairinterface.org/"> - <img src="../images/oai_final_logo.png" alt="" border=3 height=50 width=150> + <img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150> </img> </a> </td> diff --git a/doc/L2NFAPI_S1.md b/doc/L2NFAPI_S1.md index edaaab6af2..c1c83211e1 100644 --- a/doc/L2NFAPI_S1.md +++ b/doc/L2NFAPI_S1.md @@ -2,7 +2,7 @@ <tr style="border-collapse: collapse; border: none;"> <td style="border-collapse: collapse; border: none;"> <a href="http://www.openairinterface.org/"> - <img src="../images/oai_final_logo.png" alt="" border=3 height=50 width=150> + <img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150> </img> </a> </td> @@ -301,4 +301,4 @@ Testing on the CI process is currently limited at time of writing. Improvements [oai softmodem build procedure](BUILD.md) -[L2 nfapi simulator](L2NFAPI.md) \ No newline at end of file +[L2 nfapi simulator](L2NFAPI.md) diff --git a/doc/images/oai_final_logo.png b/doc/images/oai_final_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d2cc79f71ff4dd6495c74011a3849b20f54f1927 GIT binary patch literal 24129 zcmY&<1yoe;^FF(REFfLdOE)OpEZrb2sYrJt%_=S3($WpmjS4DDw@6EOm-PRle!jo+ zUyp~&vgf{YXXbt8nP=V&f2JyjiB5`+goK2tATO<fg!BN4gapEXJOtjM4qB=Mejr;) zs7N3oRmWglo1g%{gIqP_B#|ly$v1&tpr-N~Do9A)3`j`uAS9$q;4SzD5|aB9B&4mE zNJv8Ok&uX;GFsF{fImEZr6ebfba(&nLwivI@D7@jyq+uYQ~u9?*&bUlBqSp~1!)N_ z&*|OF@E4|*?RNopo$eJn6%`ZH`ZN05E)zfM&wi}xS6q42?-^{noa%3DlvOlL`(=6v zu|Deh{P{_L=SMRTUJdS#kNdXI<B_P*(4H(T9E-+sKk15vWzjJ%9{ab8aXPW|^tcYb z*}oE*xuXSEM`B{*;7nkAoC{hY=WQwK85UQh-}Q6*SQ41kSU-xtCVScXMHM^jdVz%d z#&~7kh5II_O|{2w=}KJZ{pO+#>P_o+3C^Es8y{*j-x;)))cC~ibS;mIuF{{+id+zP z*7=^Xky0RiT>c$k1qN0Vjw)EKUBQ+k7<uw2a^%aJgZIyI`8!s+rJ^F6jjL|VlQ}%m zIr<~fxc!K0*os_t-qT?<X@8cZT8#%cZR5okGLf{c&cVi25aq#OK<Wl7ij%(OQ; zE3b=6H;2sYPhOf+h*C?hzVu_&c01GD{!O4Vglc8t95*PbjD&=P1DF7<Jq#g2i1Epw z>bGoG@v2_l_K;rcS4Ven9H~$fFNhQtIaaL+)ASI;`sf~qj!n2_BdBC<>0AQzFhw0c zs#oSEmHLDhJ5HBD(2$T|FyM|zQC*_smCRJDP2L-g-l%@<Utup;Mn_U2P8B;?YEt1J zeXk?GEk=g#mDMpxRb>_1=FgpSOmEv2z5PMS;&H0sY`{rjyRE4~(;+@OD}zclZSCmC zDr#w;8=xz^LERp8tFJA0o>?-b1-qp|Ub&sP)?RU>xhv(;tZWZvyP@TIx?Y4B#Z%=# zLIU6WIG>ENfk5AoX67e>=%Q5~Rr18hdc?^|@KVw&^U87r83Yp1eI9Hz>*zMDbh_&X zgp52dVSGQmAp8P4z#fFpaoM%h^xK``21I%=sL{27tnGHHX)Hx1s<-^%Q&vfVc#07d z6#HWk#QLHY5lDlbGCAs?DN6EnD0-lOWb}wD#1@1Eg#w1aSkO4xHJ5`@vfS#%_*J#W zEQ8H_Rada6sb1Sbp|3NGbHquuH({>)sUhF3%{+{mSH><$f<8o|=QurzQddwSZhz@A z8Ysy(NE{m~eVY@8P<$?H(}Ic+-R=(Z0QM&`u!cO5p<U~GVB+MwnmAkIuw{^y?`5%S zT+A`b3R%I#i9vg&i@r~>SEm#=hKYGSYelCh>Fn|nMhJpeOo36qb)%V7_@*}Z3=FzR z`P~>0A);qq=<CDXEIUW=NN$)Fj0A@Riy+l}&2#US!`3r&lT+ZGW5{1Vn<yuY<)q*q zUKmi(8WC5_yM=u}$8y5PJdb_v6Ka)R@P<-Q4Ms`mWyjlEX0J6jA=d%JA%65PLUy6S z1@xoX&6^HJqH{XMMQSe5Ta##r6vfDslxf*f%;+)0<TLPr<*U>q6iKs9szP#GT2UQq zeMYES`PwE6ep0>LaFb(nGVkp2gMSvLy;*;~5#)JY*Q=V1GkO?a>|2hG*p(47hx}NK z_9yLon-yJA!!#Yrn71wDz3CNbo(UJx(^FCl7b)V_EE$u@n<oi_{Ab?t=Mj?4iecT@ zEafL7Z&@xqb5vI{;J$?j*m-(-51*I{F2MwPj(m{5>};Z?y&+&$gouH4?z*%pPZL5^ zI8=}Z2?+w+4GD)ZCPabrrm0tzioHBH26FM775YNJSW4~3>){VIE`;wkBI*}^)x|{f zw`}NTDiFpN2knebs%zU4U#vaA!TlTK&x1i2i`5s<oBB%a&DGx@W3g1VU}CQQ@|=9< z!|$o^%Nj=u^E&i|rp61y<g{Q}Wn3c|G(J%}HRo6wkA*89{7ps=yyG|-p`U!PY&NdZ z0Xa9fzBm?bn3!KbjFZP>#LWqWnFJ40?!Vl0(`?1Tu4RF?em&0+aTPsPQ8uCaX9>)s z3&nA4{E=VLtSlAYlJl|6bC`o@X%T8gMej4#NBHsM^L>^{;Ttm17SxpM$SX3L;l@AG zOG@hlEdr_Q`2V^WdIgat+D!fKa4DbjMhu$29B7NY!l><GlX|om?i>G0kcPq(Khd^S z7iEQBMpD_W_=oD;GX8UR44?vmkdR_2GPJ!#eNUpsh%Se&SuSB6sz4?t{?M@AXOc;N zc3rq6!UjR(d3`!&Y?{de^*OPaX6@M0pYEaR{0LZZziD6(yVT~->rY3zqqjD1E|N;& zvxXn?P}w+0v$1pHMxiu&sd_>djzGFyJz`)fcO6F55lhwlgU{4%X{hw45{LYAv_sE3 zzyV?}Y-pAdbRh->23RS{#m+C^W9b-Zfu<avXhv5@XS6@4qq`OUhm=;7{@!~TCnFS+ zJo7$H8icXf<R$syX=#K{zu<f9W|Woai6{Le)dC4ZU1AxF`Rn7v!zfw)8VwIwG>$TD z&pXMHd@x71LdycBVjfplAA)#1nPkF<gG{)emgC2g$Klzw<0K0507!oihA^L?l;n+t zK~?YbMHcTAc`aCn*LTUxdBGEJD{?V$zdhz&{wXa`&(rrC^6nIvO^nXB|DJQ&#DiM$ z6E`pG67GOcknb$(?EpS{-W#s4O+oRb>3bXNSg0%Cn8^RzHPD-;2h=TPqY{(r+M}52 z7l_G`%4Fk5&Arb&<&$#?j0j^z0`<O15AKQScM78XEgbm~U#5`!4ijbKVv2znSbeCG z;MZyHb@EIqzsv&la;Is71lc;$3@HfozM|{>-BWOaF@A2fY+)0P)xhH(Q(iN7pJ4$# zu##E#0TTt^j}oxU&n6n`i06gG|MG>!+v3{IM*(y0qpaBNRgm7r>sY@>s><pnQ8I+F zv^1CBb@U-}!vg>APS+QzhUh-jZ`pem%mRI#RhnlKfE1NbaIkXxG$!VqjeRNHDN=>w z1mHY>Fg{*xVW%w?8{f#M7zn3h%8a!gCE1T%WVF<S!DrPyh3N8cs-ycw$T3_c|2ejX z1S4ppma+c?r~~St3y<a~3!*2FEEyFL`Hsno{T|vd^s;Tl^bZ-O4K&bSKOs8F(8nfO zcif_I?j7aTtGv8%@v|DwrQb{wWu;i&^feVbr|By9zw~|^M3l0@81k@1Umm~%vDc%@ zdB+kwgIE@B(@Nbo6{T>3a5t=|m$iUJ_uJv~nVz9>A*$W3o4Z2+3$&54?2C;q3^!`A zhnc0cx)==9Whytd56=JWpJ9FCDio@-VyX?BfAN8_JBT>y!MJU{t*2HTwrVv3Eg`AR z)&GC~X$bK*dsiu54%pe!rJYZfCEW$bpvy0K4I_*-rCHTsM3Ka>BL8Q&Z)88}=31_e z_f@IyL0imRrN79;L$XevH_r_-OW}!O<MnkWF+gVj*~E6>IGIZib5SGuufS$FpJ-;P zX=}@yHW4Gw$srNvRZ~u|w#r}us7h0XZhp*>K?_q+b>KTgQLX8Dxgw#fl9qrVQd!1g zpJ_Qw$zL=|!e#B9aS-ikG9a@#M(6pFtp6pcVTQRn+ih7+#5_Yju+R%()4VCCv%S+V zxxa`yUs9##`s#AtlvRfNdwo}4;N%@WSA0a{O)pMxG2$$G^SkK{z}}7l_9nUF5a*-% zcw>?=>VzzAA(Ly=&z$!pg`2^<=DX?z=C0WmS)mv;gKG{-K~!xL$(=}MWo;Q)gJtRL z<>0@~{PMwXg?fLp_{xDYEtC~Ml#p_R!*}AAR?cx54%oZadxZ;HQyVkgQ75afMExqB z%Pj~L<~dT1jWx=2(7H?#p{z7Y!u$hD)Ak6P_uY7J6jnGT<@boav@COOelV2olH?!i ziL<kFS{h-0Irus*1R9yzVh+220y#JgqzTfXr9MG86-Q}d<C+!|*u~zMF!S-_p|qjy zQ4@;v-0mHY%OBySEqU^4*~HDY@^UZmrj%hFoGwE>q%Dn|$^qqd!!KAWPSo-OZ}rV{ zP^E9#Zg1wf>z|^mfZ{%7mgIbj5TQHLs0fUlyW!#EPT>`$Wz$lbYcGXo;5au4S$TzG zE<X6X9qhnE`@dgk*2c!TXv1z_*=wGGdd!-NsZLR?K9!|(7+4glVT}ClSEuk(^%Z>q z>tI1%31uS@VijF?Qny}5nv!KGUJzEAe;Kw$)Y*Ie{sW{>*~~gz^159fil=_t%7~LI zHWbN4oZnWP?XqQbB3&OviTAc94lZJ7EOl2}oYT#!l4xt6zqa@kJ%pBIffWyT*VK&< zK%Sby=#cM>PpFXpR{xKksS^A~nFcxN2>b2<p4QmrW3j{=<~G+8Y-;svVI7rhk<y|& zppIURoPv)EOdnq6RcE13U*6NTj^Vc_G^yFwYD1_cbD}EdyX|#-S^;n1*R8q9l=xnT zW{o&Ru0u#DLBnQTS*e0T+P2y#`Mpb@pRxVLB{&m-lu1hgqKSoS)y>G5FtuBh<f?9( zS5zv1kAJK}l1I$=o_GC#AarAN#{d?WPeoqT>?FNOuP|Y`dcJsm456;ZjC>Yd5l30Z zRe>MND3euMUO?<-!3C67yC;d&cs~W7032&mAA`5<H5#=PC**H`Axy*(a%ZvsfmIg( z=nr|c%WJew)xr$#E<<<iPkLxX{qjF3BDw`Z&Fu)7c;!b8^+~7-^4qivUlBCFSA%M@ z)TFJEKit7b$_3$B_*1&3w3c^If{BT__b!))ba(AEP*#*Hl4dn2XFdOB!;aP#qo13K zaS{Ms6jk&uLNMFWIoZc@q9rc-t8H3V<q79#?#t!u@nLA1tV@$<TJ}&46gkh_EW?F; z5Ln1CDcnOlmHEZ>73?9={`{043%4F2h#4RJs*d+%pyWULM1zqFxwdJ}oR8PcfgrS- zSG5F1;?%Qq%xywCUMzmVrWhF+paJkaC^kksHLZA#yG$f_h>j@unR}!fWYOw5Bed1c z!duUgA+RiBjoXR?<y^J?6ss8A*$$n1(DgnR>n|3ozK!@~+HNW-)~gM=h?`G+Dpl1q zN!w@&7t^u&fW5N4anF`Q33Y0s)GV*jjpM%2+mKM|hP;#k*ivTr83c_P;48y!YyD$- zkWd9j*HUmUez!OkWKkCR4<UG2^n^+;-{76?#!(<E*d>8!zSS?adhyqWZ|vSvp5dz_ z)=lx_GA+=Bp#mnM2j+-IvWg3q42{{=PTpLIkT&dWQ>AX<W#Q#KNJfk6O<cHwHmp}B zP1t)F1N`p+OkU5xY3?gqO0ClIHz?JMuKXA=1Do7)%1SMipwJg{wl;<80Z(j)hy%`W zt74+{$$p?AK!<+jQmiOMb>egpp`8=FEn1)wo+$*saA-R2pUnifv*c=mQHj{xBVVxW zQApjV^{?T#Pg|OYVf>VpKvw*qc|hnMV|MLS=BXFP7T;W}d!J=JxLg`G6^vB@#>d^_ ztLZr|)Re1bc%wh(!zo5Va5w;K2oFlf9re{^^tkrjz_h)am(4$Sw{*WQ8{J3KA~o3C z@><y8F?PUwM>umYaj>rz3=55#xwL-dXPxd?_h8M)@Q)I7`QRQ!Zr2SI&>ts5ZBwy= zHw(dmEKm__Guf`bJz425m&LV8@}bd{LuFdXD|0j=E4{UWuO}?f7Aa%!Y=KXD(V*}W zk&gUcIY||~69O$7<MjV`JEf`Bt)f1i)xg>+zh|}Gy{->$7dJkT9kB%YYB2*DM5V^- z!TJgu_7=mW)W+qW0=+EElavf$EaGKX8!^Tqie=$md;5<MCH05Uy16<>0R)n8!Pb2b z72`YYY39kG6dM&Q_$bSlf`Xtk(Z0-(epV+ULTh{L8Olo7i1IgH9T~~G>Dteo>dapQ zQSwL4a+0GtGUWg6j+&_4d371FT=0>vQnp3R>9-$ZEvoX}^<`j}z~5q3u1uz9%nH0p zN_}SA8#*ZYpP$PCJcNgrJFjQi{HaS_Lm4=i+kp9TXUBc90b*i?iL3s>|12M1XxrG^ zRvc}`J)LzQEfaytmv4)u%>vkY&C<KyIXG4Q3vE8S(pVc7tur~IP@C!NI&DZ{JI$Ym zE}ta-dI384^e-w+NoLL{>8@xMgOA|tMhV^4B<I5_7v3$G!|&jRDY_D&LZ~ChxQt3l zN@g~@&rtH^^GAPt*paUMW?IkFPz-)mBg{-5{)-O$w+F$zE^P>&_k1ZMRw<?>W1por zK(YK$T%Jl;M@n~HrxbkTDRmw_wJb%n_)Uh32S{c?hF8}1y6FA`na58XS)f7*N#7ZZ zoWTDw(9JV-u5ncdur0IHd*GA_;Ov{}gjg-_RsoXbuQ?NmwmuW2+s)F*f6vB7=f(4z zsZ|%lV(H7I2yrYUFuFee?Sc_*Snil;7Xo?ch!Tm$!sr-`!F7G_%?e2oATr;$SiN{! zB#Ei^k8J7;*?iWowQOpDTq*q_scD?O7TsLYs!NDtnwhlr05n_oFAgki8SKQz>L9N> zb=nJFzQK91#e&ys+Q1Xuf*+jr|K@eJJ6?pGdRq4ItQ0PtiA_%qOK?sbY@)f+iZUN% z6og|5%oI1(r$1_!T5(Z}^Kr-`N~wElXE!XWK+nqx(3{*wek+G86waQ$vX|BHji9g- zOswVaD1Wz+=H|(TjL8e2erA{Nrg?++V%SClvdi-t*AjtLjh52ZniWoKFkPAGd}w*2 zHOni1J}Iz?%4oZ3K<|CI_EgkQZpCNmit63<Jq^>b`Oqrk?>-8<^BI-@B(AM;9xmck zm`ut4v-o39RGRE853#=dOf0`KN#E2|1v)~3nzk~_U&ZKw2>-X~;d1n_`W$sZhkxYr z;gOvZXS+mP47c02FX%Nb?P-F19B;E1b9C9L%D_i`X(#<x@3A>Yd**R3>*po1Ie&~% z$OyG)uJkQkRS|AC&_M&lj8x83CWaTJDTOqp)VBKF%B!Qi8AWqHs@_;GQ^ug%wzEJj zmHE=ntZi}M-sa$H!yZ{+3|y=`AOA~2Yo|ANQ<_BDFbC#J^$;`b;Js8Y?{yOjqh=PU zukZ4kaR=FTH1^?~GtlMIA!$p+Gr2~pi4jW~Ku&T@dAyM|#&DT1sEAEMaZ*<hZv3%+ zcx+A9yZna)HksWCEZ9p5<dxqRLRnE<&@JQAe>%>$RVa_Ho4>UEvU8d6$V44^#jPT^ ze~?J!lneRo7kBWe@RKmI$A7_EInU9<Snq~~1sdS$X0!IQDP@_MSEYBJP8}pT&7D?r zzOLQ)u0?L6k5T!LzycJ_dhn49HKjObRUR>!P_YL>MXJ_64K4WF5WCS6-|)Nh&ZXSn z`xrbs>GW5_j|q7i#!Q7UZk9zrUM)4rSrt6$aqZzDMVkE784E=@c?N{B-1R!7q^`CW zOhkRL6*)45I6kJ_Ats=|``4O$hg@SN@R%X4#W}_zdSK~{34bsTd^ExRBXJ;M<78lD z$nEqbhgJxn4--P5iyzGRyY_p9szY|2-Cf5DmxXOw)3Xw4+gm{C!q8^$R>&`GPk+li zP4@%`U0o&<Xm)L)ROI(5$aPSV%l=!`#Od%_v|aPQ>91f|kbKVFeOB)xY~=sZ5I6Sq zigx@&rmx@<CT4`U?8dUp!%LVyuyXTuWU%75fOKM%<{e{@fBV$SFq_s(>&B5%bVLM= z&j|xdgHTWATR{?E@;ND5pht>0iHWpXOUq2nq-~!ng+MIL?8y1K{$gM%Sgo{!`b8Bw zVyG;g$JH(xE&ETQmT@;7^%0khP&$$KV{Bh{qHpK?1T?cV5txZH^J=$FHr`+hu*7KN zy})qu5TBy5;o1Ig>CsSWb`FmC`86$+d|9b>Xd7wr)FN<QP=Wt{3+`9oCSebb7~6|% zt{I25x~X~}m%`g_p3&EPt;b(x)neeb%>0z+U(p_IorECvZPKjl#NH=+JU$(K_U0Q< zR-=EXSw7Kpy?Z%oZs*ir@u$u{pfycP#TflD0bqQ^M2<WlLxaIUJO044rbI3YI}4sw zDS7o4JjPwb)<{Me`$CJK-hIkwU-G^Ghq9vWU|(sJm9Ai+>9Oe|WhOO7k#nj2Er3+S z{!Vk`(X_pLros5qH3oI)E(|?vYJ>^h&tCaAW%~PPC||7_Si1gGfk-~{vyk8GMurus zjI#mN^<(K+_n7n}1HDvfX*TB965h@1Px(p8QlNa&$~+v!RI#!-Wwcy?u9Eh@gOd|6 z<KT@x<%u6R-65=^B8+882xcg%uNGH^;t(uVvp|=AhRAh0aX<Kzt{>bjh-gmcCG%LI zpPtrR<^DPg={(uHXBRI7GTV}>Jc}o9e(<#jH3C74AtdX0x;Qb;@#|es*z)FMlDw{a z^w%&n&7nRw8=dE_!zpB`1roHd0ZXN>k7obfo}CuT*NKsW=3|t<RYU+g<#jTL`12fe zdDZn;hUl_<M`b-M0T$@R9Ib*E6~}W7AVW#-#f#?EVrqI;dwQ3CKnOC25MjvU?&~|$ zjO<+dj?Py#-)}>kh|ITNVi~4$wC}Zuok0fkC150UA1_#!lgZuX4eOD!m#QGI+ED(@ z`($a8i@8#7b1`%bgb(^79uh<OUY~kzi*MW8o4Ww4R<<dQVyao)wmBcp{hX;nmk*bB z_rsTo*Mh5g`Dy{M*LL^);5}c6FlJO_DOf|(GVhrch@baw_Uo_t8-%hz`6)*d<Q|~R zx-ls`ifRF+rOGBffvYZr|L#g7ReK7Qg|b3H)2e^TW$_prTcXt7S{Ef>E5F_G33K-l ztMbIXKH%I?XOoNB#?4&{*GjKgIlXk!{1+(m4wvth=!hb<aqFe`s*fVeSY4{&iP-c- zax{&$@>6=EEKu=bL2K%+WEV^}w&5Njz@SwNvVqG4Zi2GBq8EfX^L`?AvHp6Pp<TVz z(kN!~Qt9;IzZ{G2*QGB|67FmrM!r6sGa3VWuL&=00_Dz+G_Rr3`<y&~i!$Z_3fB=i zmWuM|A)uZandV&nSW(8yJ{!1iHL#ZP6Rhuct_8iMI*Z|MZl}KrAN~zSnWv<QcU~+Y zFYUOT7TvtRj+1F=ZjvR8-PaLJsJWaljhgG7r(uKYqJgH^#e51YKYZ;w*4Llb1})ON zii%yhdU>kFk{SR8?#{KRS=BP=wz5D63w36H{$&zYgxx_g97eRz9@4Ek!s&Kbx8T^f z#qhQj(%4(dw#8p6C=UTO+E|12D`Wh~`sjLg5xy;QeszUr3;Dq|Z}?;sdf32Je)wE> ztM`>QsQPE-Ph5(>U3P^_o1@{qfao^#d(2<Cjc%`?th<Y5DdR*TAm)Zb%5CZmAQNC& zn{6&iuYRUpfwDkbgvbWyO*jyr4~ki!h9{wtn=hhYd)gTi;v~o>10&Es9MtZ!EBg%q zR=kapB=JcOw^f4$=!n*s$B9vR=AEoB=A3(T(Gj5$WxR*Y=AT`81|b(OK_vw7!@^IP zZbaL-YfIserANef74H0*H7ToDp!GDhuC7hZe<|NEO+c|Npo!hcMWsCsIa!dz`oqxD zPbT+IE|M^@fLauDIan^3Eu#B<_Gd0SL~U^Gf|^Uu(2%B`=_n68D*pa<o_23D99=#t zwEz*3PWIOs>_-p$09?ox)RSA}iOF0CUv5ch12|=Aop4Jz)Og0~s+0@vB*SG$I2h&f zBBJ3Td6b~$YoxEbm%rPw_*5HqB8g|QzJgs=I}UKorL7IcEBAh>N*i`Smi*p5_doMV z4R-==>$CyIQ%7jDBX?xO_Ze;=kUO?1;z1i_tH7rLQli?6ZqOeqE+0^TK3vhgdvexB z+9J{|Ke;wJO597jvD#pghRJBz?GgZ$CoI$k;gTqKc03-~r6`39kfx3KvmYBn-T8`G zpn+1fO<(@`jWnl#zNLN~Nd79Du}`RB6T1ccVWxl^PB-etC$rHxhNI*j0S|1j9?xMk zyL|ZERJ{H0!<$=EwFw#5Ib8fCY!wA!s4=LQEgwh(cKf4q<jqa0XDC6sneW&*3Qt=W zhwRE6fil+Uh{P}O4>?Q$Dg4fBycivE({NTtHFkKLq}`kg9_43!O<1(Hsb_u*U|aMV zVwd9OMbqS{Le;Fa$d9$r2i`*CybSFW1})xNplTs9YxNpvWMoVk_*KI+^ZT`=kIz5u zNVWj?8JWtg_G$U6D96@&O0oKw07WV;WDi)Y&;CIv{Gilu)|5IScmC<>sUED7plX4O z{q=1(MrBUZSJTX(oyi1O#XaXo(b0fnXk@7w!qj8t;;l~@OL};DOUHKJs!f_^R0?mJ z76LTuKgn%{`TFIX`7B)^rS}?6unoMvP63xuawom{_NgNCKY<RS_3O48@``9PRR+eW z0k*cI9!wxxd^aB@90N(&%MZwI83{2)FPh8#os9cUG&EQkFf~J@3m{rWr3Wzm`ZH|S zCyw=_*nFXS>Uf3)>~AeYmD{k{9I11C!&12K$71~{d}*Sg1}q09F@dUS1DS!bqj#Rh z$qkAK2`yM*(dypBm#R-Xu)2>syZRt&8)pgF-x39fe_h*4vjDP;l~>(LeXr)T_&9$l z*u|$rZ_9SUdAiviw0Q8<T`!0hcQkbfEzIYY#+D@}@>?zY>Jl&)Z|3a)M7YIA8|2K# zC-v`^!=$vgP@^o(96gZUREqQ-gZJxAV9L>~dBhMpxjM-}2R$F}ojG3d1(77QaX!44 zph3Vm>ZAGF2qi!YDzSJDQD|}YvY1$|R`V?2RG;B#Kf2VWP0$kGOt_r>t{ziUzUMIp zb*2&8_ZQneWj+i$koDtQG<Ov3aINC>iNEqV7(z`nUF`24l>BEB&<Ou+H~w7QuXg|X z6Td%KV4#ZLzy8P=f3EJW`t$m~5C4&F@8A0~ki5SD$E#$B`Xs;o0`+P)PJ93U!{VX| zDJiK2Hy@vDLP7$Mu&~milK`#w^5`huK!1PO5Ld@uEj{;$M|ygC-%k(WJ0UdWw>-SO z?q7K0nHOyZNZ2?zS*zO5E|)y?pFfws@><>&8}T3`AyMC>j{SMVU5k^W6O(Pz-L56N zRv^?EBjkI`L!}4Y_ZM+@Pj{vj!`q%#PT$<9nYQ(50YdAvEX~0@;g7Jz0&~M1z-+_? z8wUqVu!gQKf2uMA3x}Aj&-q>+vGGrtA+alR(bMs<li$l~<$d^SA_{8aH;+WmXOB;o zA~@9@95^zC+|zbELYY)U2)!1;%C^!pxLf=CMMp<2)3ugWM;BSXM<p0yFKRk>zweUR zH)docdDKqX@dyaWA0Hp5ac=!?yY%JmeY(C*rCy2OL8LJeQe#^Eyr5y=>sLB$UEQ(U z8`Q+(w)-bvIyTnvki~6q%iL~hX$hK%5+{36^>TakDaoU;`7_+hrPPNlEL9=KjW5)y zern3xQ6KfTYoCNXc-X@CDY+xhwh;dTJ`eGa%E&s;wQ*B5Iuy}mjhXitccQypZkAJu zWG`9@qcr1`zFr-AwQ)73RSLh#Rm(0fT6izK0b4J|85B$-Tu+R_M?&&QggY&Ai-_bB zC^k2T@+C$}M<nFQMG#Og8YjBl<*s&qtf(+z{#|eQs1}Dp&_$Zy8<9)vTv|d?Nr|<P zUkh7aFs&Y#OH@>ao}S(rgS~I#aJfM8b{z^8M&=N@n;4dJBt|*Zc{g=VS&^4fsjff% zONycb4UrhzdSySSxOhj!Ob}fWQV@i~EeGj&{u0EGiUjpR35w9;h_|t|-CRvMXF_?# zf-b^=I6A`8bamyvxVcRXaER%qeRugbk~Q+;dS|9FyIiO2h-8%6nXQ~JU9{}0R5JX) zZ{p|Ae8jTHe72AD<rOLvs`qH2m8dbsfrZDh_2nwf9e2@INncR~-{d<uTLhojkM%-Z ztVt_<5kB;D_?%bao9MIX1V(}{m=BPU>4bkR#dX^qk4;%-dGS?zqa-#E%8d3Ed!dMK zvnTVj{c1ImGrqZron18N(Tsw7739+kFE5$iAl?MzpemElJh8=w#p9W|xlFE}Ab7rx zSajIZWli8i=5JfVSd;PYokgjO!umKk$uX7&4>#leE+Z3Sj_HqEuJtcl^HM^tC01QQ zNKh!rMQF^ru+`zFIQE5*YoSPq+L>1k=g={t;cfGW56`?_WwGEc7F|s-QF0-hxw&ag zAINZQ$jQo5L-k}&--mLDLK~l~Q5%ZHAc1S%I*&_L&6o9AT?mLf;!O5CDpQQ}lYLe} z1|HV+YoKoBQqM|B#>@6O#!n*H^dwTX8G|9^>}eNmL`0O@-k$LnbUX(1s>yJts>FWN z#Rk<MrG_}M<6XzN4s1^t3t%_Dozod~dKDYt(#gr2nv4{B^i;OTYvi;y6Z3g&hH!;# z0GD_$s;sm%HPg>>bPNWRICl%r&OA!gPL&j+E!`LU7mxeFjUQt(=>7D}YTGdzS)pyY z`dlIBnF7vu;CTA$fsusqMIp|Xkk@VSM}sIbaSjN5Q21I1ErXEYlW-F~V1YVR&buB~ zeRG$m2(?77m`LeGFV0Y`Rdc^Xa!k$(Au%zIo3yRHy*F?}<h_z#G$JJ3<MZ<%P>+-6 zi-@x0cwy?xITVYunEcmMdu|wzPXP^may(T87je}|Z5Z#10R>+Afm5TMr6sZG-8F`u zI?fR#-SvuS+@8fATCW?)jH<-X>8<!_6>N|~4E*3(xf#(pPV7o;kslqs%x2FQ1qcEQ zH@3cOU&ycN9028fJ+ZCr%+d2h`PZJVtsNcy5Cq>^$iX~oO-PLdY?KyCo~eor>Urk* zzCZLGJ2SKFr)O*V1w2@NZ{YcilT=UR`j)!~9s=<b<>BG6@z3?5!5{aUn%Wf^SttSH z&4~w9VUUPY<HVkzLBzFwZBv2cy&lVoGP6p*`1C>zQ?u6ksvP*^>h!h#*1-}bApgfN zWns_H(58w~vGJi|k>}UcaQ6<*s;H=p&(6}kn|Wx?EtORjw}Xl4wSW`Toz4eZRQP_K zY98cMT3Tki0nD3MUFmD*JiB1VZw1xS;^?8i?FbvWDd$#39%d+cR`=IQE+E-{%>#Wt zJ2Sg<fbE|A%=!QksJXQ;>dZZoE~9;y_Qc9md`@#lwlVV~tJ0HCG~w&FdGtC*ua58M zEG2IvvdzjrcS&~joj26gX+Uv&Zk#!s+KsboNDOMc$&Zd>m{_q2q+m@*$`3`P-w|W} zl8jw%qsyD~*!6x|>G~cWr0^Zti+wh*hX^OSYY`4N!<pkg?xn<HHYz>+@W$6V?R^G2 zSmWoms^ZmwMo-a0#!W_9-BF$G%ivf>pw`mSw^Ox+XYVks6{)2#%N%;FV>^uu9rGO> z9~X$vS$>)79rLZgK<Il`MMX!en$xpReY4e0;>a<^fyiH?1g%Ti7ZKxt<0&cKP72Kh z2KO4MAz=?ur2RJN{IRk7Q8r_KZ~zRL>2&s!MRv6Evhl1hkk#=R*d%d+CtJV1keka{ z>Xk7b;x%!kC^2W4QP5T$d<*vGLzho<5>VDD(~gr!Wi`F<6@$n>#E^IMvVnx1rJ~7g zP=wl!(m<)$tJPmVJyklAgf*xRDZ@Jq=b@+90qwcrMD%-k_sxBIAbn15uB5(6mngI0 zPe#+wiPTgQA(xe~I@8tgi77Vd$g!}H5QDoX1#vn~Y(Ejsp885b12uG-q0yG7WckL_ zUb&boH3V)3hcjVk06?%1<##geC&b(x5bjAqM0W2%=8tTMEj<DEEjJB@rb>DObahqL z%EV<+mwec!QI7>Ee95CVNsydtI%>wG^(`7`Bm^#f-VHDc9Gs|5lvVqJ=(@^xCl$Sg z`69}1;dH2!$*1yC**w;MBfLRmz${4K<uM6Kl1Bf*mNpw|34A>X!8GovH$OG?+e2Z< z4P@f^I6cz!rk{Jr!G}u-Sy~v}`IIyYxc95<_X-C4ay*U#FXb;Dy5q!t4P)aR%QRPI z&R!I5v6v0Jk3`_urt*bTp|l<epAPeC6DsPmPiF!qxRW*D@S2>YkJ&W_9hvSJ2sCO` zRFnja=iy!SRa}lXzK_)P#C+!HeHtu{M|*81`QYC@q7t+CHUI%!BDit-kXa^jN8A0? z7at7-(`QewUzs$}NBd+nrnjFF2naGA26B+=Zzumw;W;VTN@p2akMWdMYx9~D=0Gs9 z=GhcAH2j`MkzpvK1%!}AzjxvWG++g+Hm%CYfm03M>n+1-KE{IIO9R&)@$e=?dmJ1{ z*a@XFB+QV~<IKh;)Gq50fHdSF6EXK1N-!7+;Q*Rybi7OEKT}G)xByIy0@uu$2;<<` zqeD2K#UhS+ad5oY*x1K}k8KMGzU;H}D0yYhDDL(G44g{}=82fyWyE{&`PYryHgNn0 z^ac)t;mLl-VWV{6=U)$no5jJUb*ls6`Pnq;O}$KTy;nBhMcjJ)GZUjW`<FWsef=R} zK@0R4xZbZNmX3OSBJNusz-D>LgYQAUm1Y@^Y+dPo;7(BkQPFmsSe{O${oC^rZ)TJO z+CgJ;+Gb(ZK0Vw`)DR+wd<Z1W|EpA0;sMF+-iE{~0GG&MFlb7Q?a}G!sm8Q&)uiK< z02De+h%*R~wFcg73@}Y-NQquSBlSq<p$aPIxNvKYRzo=@p>h0cJ3z;{fkMM^^$m0H zgs3g=9xoT8CXoTH3<QE~c6D-c!gTc-@%$}++!7Ty7w9p@e>nIpF(XT3eJZw2&=Bxf z3#e?Qfud_<DYGrR-^~r9f<`{V+1RrSKK*Pds9QK)N=sE)+_JnU<H&Ro$U!N(yIWiF zG*lU;-HJ=|qLkqHRB-2Hug<yG8#vwIhHuz>eERRvR-iR1*m;1vy0f+Slk449I{JVD zry@0UCNOmWCa*)c_m*m8QMY9F4mhO^#KJ5bC{CoAs#PcY2rE|q%<%B=plCF3t{-TT zfPlcR<To6+_Za&F4fO69sz&B6rypDb#9ATdJ)SqCw+fK3@5p9+<T+HN`UU-0zYZvQ z_CAA4`Thmy8aWUkFYUjVlr$nV$|lkd@Sj5DEg+Dhk`fYdd}%0(<l}i->z>(+L5%aA zUsq?{vVy{80c%>K?2Ly!0?2g!G)jGv5XOz~;MzLT7frj_4wSHO|AH2diCv$Tno1q< zO_B3co1FJk?`zMJ(TCyS`^@#)EST$kDgldEn;OnfT#5^Iy5QuJ?p-=#?yAM}i<#U7 zT3{DGYkLqVTuS8YzK=1{#bC`t?^EN<aTP{!*P5(r-2R(;;Sq3<oqpY*x~nS&g{Z!? zn&_#U2Kq=>=yAcW8&KFg;0S_YpfKXZ(skj7e$tqS7I<Fg)o<tS)4ICnzet}>;1fpz zyEuDh$xZ#D18AkhJLRnGvLl=EiLv_wQb1s(-}neN!N^ESX=<CJ0g}s_4rVxJ_H;gc zijMqtbdU_0?gHFd_I!1nDvocz=#%)F(<2Dt%sMSCZ*qT9NsnQ2b;>tzxXZ{?1AU?o zi_}VpAOxNdgL!hMa4d-2l;y<C8$3@TI1C%SDkeF8wIq1IDngYI=k~$pnlEKQIag8l z@j)edB&)8qHdblGS!f4Qm64%mXG3I$F)6`pY-|z*(R&_c2PzZblugLy<(ZCpf5oEg z$DNdT434MUt9Mgmh5}D6uk`d?H_R-2KFxrA^~R$)1PWEa!^tw`23nfF-L8`<%~Q8c zke^1rX+<05wkyzk-0wVUaA#FtSMl#~e@n|E4UsG%cYQBTJ*9OAUe30U5&HW22}g9w z$?$xda5nx72hgIcC6A7hZA6O@1~MI*rxb1rO*d0PSUGuC^tLEf`F`AyKNVXIoq6SF zRU(|^Xi4YU7ld3F(|#@ailIU~ThB04zxx#r1GNnXtI>mbnzOXee^B09n_Rvd2u>+4 zaKY~Z`ofZ(<Hb|&1dn-uV&LM0tncnj)#@r595}0}s!GD>y4oRJ?-1A!5(vll*X<sc zYXxjQeM%i!BxyhaVuH3+DNZ1GZaxnyItpvCuhw>_8$|1sn0sSQkledoz5ydlr}p)} zn0c{oO(=x~OoI{n$WgNA6?2}bXU+pin8@?TVl?P5lHe6?_CwC}-Y%cpqEfx-kDNf% zk@F{(i^QL|<nL;Hnkew_(z8%wlKcY?$l!RQLn}Kw<*5q*NOfSpxibWuHT2V)3^^cS zbiYd)BVQf$&Tg?glIn_X#U0J3?2M_0s_hB(d4N*&!kCs0TW&5BBT&~fFY1?meotsg z0nX3<&3=J#o4eZwz0$UNecO_-I%cTi7jAATpqb7{<ny{%P3hS`mxAF1t#A02)hH-R zc&XXXBrgO=7|u{7k6(2v-SuX0CJ%tQ_^5K#GTriJL_Ae{)XI!{pZ*8py`4&DN3#j@ z^BsxAlYi(bap*l5>&gYf>15L<tI9>_@`}qB)(YW1GjjO^4Z7<S@<#Fe1}H&3VrH1l zGh0q&oQZ-xd`|;e9^E4);0mElL{ATWXqN;xcP;Y^eIjtYKggtWF{~yhKhk4y)ejXl z6beN<@xT5y&tA~fwp^z<mEj=l8N_4gE<YIGhAJ#a4NZqY9Qk_E`3p5fJVQ^0!ngB$ zJ#A(t|D0dFM+L9_hh-Cr_<%yby$gq1$-&-_jHp|eRUEc|K1W72+deQRcTCXwO?*bz zK)t@dy|N>5bhym-PTspIE(+XvY-XIDD@au}Rg~wb%bNfcrHH=w>!3fG8UH@Tcp7M^ zyGyF86{d8h%V4lkM(FiQW(qucLd<pn6^ti7YXHp~Zd-Fw>68)2MrqZOH0f8H!OWwC zAY_nN7BKx3lCb6}ZfLvh?iqB{t7z0e;Z%_Q&3tw|^a&OmEZ6g@di3A`f)e;8-;Nvt z>Y)Ug{1%#OzcOdu?V9{`QilqzLAf9D^=Pyv<{q0^zUb_(WkOzKUB%RhUiY~qV*V6Z zqYmrPA7Sz{?k2;2oS0P<AmmfxY{R$b_wpaM(d}uMHASgqiO68dwR0s}n3z!0I)Wkc z-Y7wv8ykrY{18V&G*Ec<v~$%_ozMvQWZ=HS;>Wrux21k4*G@JQ@f(r_HEYMab(DRU z{?zC;dU%UQ`W_><6pRFeL7^^3ofxefpWg)b&SM(NV_{(dJ;1a1J3FHC84e|wr#}Yq zXpeH~jIcJi^VPSqoSqg7VPRovsIyB-hm0b1Z>vRLi<p;q7*HWKqPM9AjUkAK;G@)p zQw`$;V$6?f{bt`50MYC|qh5g)skPdK2=~8z34UpB&)#fk&m$&Qxl{e2Kw(**5XYg+ zjuu$Ovt7)4E!DChBSO^YOhY>f3yc>?9S}S32^*9)J8sh5sumsNVp?sQH+l)obYBHv z04}5~-%sMZ-fHp1cURiF`TJnP(y*qAHsk#k!XOVkfM-D<;u7^U6r<h}W_E7xcfm*4 z3Njmv(KAU=$mX3=Mfnx|6X`$OQ=<T-pX@`QYvd^1%6D*btQTPYJ$I-i7fNi*13Vwb zha7|k42w>SlLYwz24A}fF$(xfSMb}n!Tj0OxT;0d<dWQX9p>)WS7@PJ<rv^4W5(+? z$)x`94Jwv~VTexKU;FNXi~$Y8&BIe}#|8l@aLD97PSW=55UrApBboA2a;UHC*_fHj z6a{waBH^%uxJe2Nbt7dXE1BY7hu#-fvq<<sf?lR7DoBB*ZG3l^k%D;+MR@K)#(k#2 zN1{d>_WrgRItMLbw6l*H<Dt8kQ17WD6q*XK;i{VNWO|YS2e*F}!ZB4eqYge=3zT(1 zZD`c;<imiNx?klFqAvOtw8a6lslRTxr+PgQkjeD)bipnr7^F8eRB9xwD3<G0>IG;b zpxJGNPgUFI2MHUWfTB{8blm$<8t|lm16={~<-ewaLJf6E#R}PUzd9AxfX%<Ii(YFy z)DoLPp<|)`=I79&wN(Gb{>;>rm7R?}Z~A|(3OhrQW=<{=9X)&a23~$(rg;~gh>f-X z+uz#>5A1^L8U2WAx$Jx^UlBo7VML%867&xnfrTF+2W9t8+wlP)zSbF`$oUzl+=Ilu z83qoGKu@54)&R7)p*?ozfSOiU7dbZy`b#R1!MV;rbK@ABkwFd#Lsq<E%qJL4&CuPi z$W>kVF}SIUk3$q}R7qVTN`0+==dhD!4jjyfrlXjh@1-ykDDH;H1IYR3(WPtPPXYr2 zPgWAtBw%<e(PM)Y>{KJyUq*p_3&QU9&d-T4Zf;cEaw@-}phdGsM*|>?4l}P>XtDDR zKUaEImg=VS`3ZvA%!q^d582jxfc>qsv=pe7u&!}7qna0}AiX&OXI7=7J!w$5B0@Z~ zU9l>zykR}Zh>aRZ->@~HtR-rQ2#}vL3tMo+s%8qYuQtia0T2xsi0}d^ruSm75l*cA zt^cKw5$cMm%2@-p6l@937_(q7$y~p?-~?0azMSiIzqifmA;*dt0XApHZ;jq}sL2mW z%1)i$te#)}z1u^l{g*7~4||9}sgFW7(b32ToN;g8&|vs2HHq3^ysVZ{#PzN9%#_dQ z>)JB|nKUu3@UMB49EW-`Z<NMa-v^xMftt`N(6FM1nRZ7rSEVRl-+E2AzRpfuW@i&o z>~rSOg#cN+!vg|_bGb`PrZ}<eN50#!iMfZF7Yyd~6(5;q$CAQ7gWH##DiRe&S_CkD zWpV(`-|8WL-Yh0t6@oXO5)U{$Db4ECSZ?eXt0SG5NUj^=NcSMi(&gYo8=<#hWdl2b z>Ai0T@o+3$Tv*I~0?h*92dd+Z<h6>-kEuM)te5s5?6XoYAN%S~l1~O%K@jL~5O{M1 zj&Us1x~mh<j!(!-p90B0{dxOTk)5kauAr!he{Vkcxl`4<xxEjT*?y|iPdl!UC}mjw z>=48nO7XW>Z{S}QriKaHHNKB+k<(%hqVOK33bpw&UuhZA80Q7>A%UiP7di^eFKxW? zw9uOM<-_`x?`0He{EbuZl5fbI%X(T`%2HBN1}rC&L}C~i7~`X(ih%T#=xrxbnc3aw zXs$sC<WLPh3f(0V>`e511^B2QUGN(X_NS5Fd=s%~;XcxQ-^x#d-cYE)SA6s_-Ci<a zQ>ma>Y#j~U6V7-K@EfGvg#ajXu#BoIhaQ^_AZ9-`4?4#udHncU&_+Ru2ji+|G!<t7 z@M5pWzF$les8#z^@|W|_R1T;p_pwIuv(=>;LEgNQA&)k-!NPa^<WJ-H0n%-Un}u;- zEw#`VQ69>!Ng)H-mQO*1oZ6Maw?(*^R0QZz&-A89xE@C;KIc<ZQX*7eJXc%m6=u^D ziSq-Bd>uWsNHtTVimJl=<;y4A$U&i+$tfvPFpjtV&3M^js~=<(x^xSA4kd#CO3%1@ zyy_k!0c!wpLYx4w)<V0m3b$AC0ltb05bwOQGFI~hRZR+G7Ege|8|;EXBgt?p!P%J< zdvNDRauGnW#EHdx51czq>*Ce$7LPu$s(l^9-;<zzGOuH^;O0q!ys{KI5Smz!YOaVV zQWZilA_E=-jY!A6@6U>L3rg9`eE)vdBmEwag^gfMR(96b3i{aQ3>b*4GZW@-P;B+3 zMLzwYhy|syZT#EFs#yb>A81s_X6cc?^(61Hj(CV?_z@j&_+7qbQPR}PO2FFniAE;S zS|u%U-~wqCd!P41nL^$tOvq-KZC~c)=-At@!X75iw?A$R+A|Uo?CZQOpLQRi_o9YY zFJ8#<6TL4`MDVkuCz|I2I2c>Ee0)*d)FfbvA>psl=aX?@qYre4aVMd*Ma1CvFW^om zwWTpN@dqHiZvtC!To>1XCQmwy7;PoabMZ_wreCb>5bT!ky2U}J15LO41EUw6G<e%9 z_tSdM*X5|dUXQ;TxAjWRP-WbmK7A!i_@>Q-niIrk%d7+mBWGY_q=u4kKv{hPpBFTe zoi{Pq;*XhC*ZJO$Z&baj;5xtjm>oEhxltEKzWYPu-=0%bvF>kE*D|i$Z3!hFKf1>% z@E+!3QdySwmbD6TfQZ76MJJ}di(X_f4eDOhbfcp<GF>1Fowqp9rz_g?8>8))f5$jD zUK{{(PG$dQ@S81rIb&uVl<ZmQ{%p{gAQ;fH*(70jUzg5Cw7n)qkpa$r-SeZsi{v5F z4h|@sOKh)Dvq+WEPYqrXl5$>A!AoxsK}D9P+}+*9iG4(jV_{*De6};iS}^eY%R|lw zS=QHcBeVq@S5^4Ykr(|UBsaaYUonj5pLXO2fWb6xTAZocfnu5!6eco1UUhN+0unRr zO{lqwvhp)vJfe}Z8u{A2tVJk-hO)=k8yysfn$4KdQ!W@D47bY!#!J({TqS5VFDHk3 zxzcn#=kk)4f!TCF=B$N#>$bh9K}9jgr`x)S$t8svipNBimdolAHA)xcvkJ7H!}#|I znH~_fwzgK>(P7M7uBrXY`HO~zi{VtQ^mk-ei2T;#L}FUHK|aCkpPqwTRJ5YMd3vz= z$Yp^;H~r`t?U=wQH$%ZQf896C%V#FV*%{hd@qJ7#UR=C@fW!EZVYB|q4WL<ghx$Of zz~x{?hXn0IS@9)V^rG=-HPS0g2$k+J9C#P%eK5?)p<_0*51;||rv){kOtEDmK|oz) zB*#h^c}{W8P<VZ}ENITn%}wGpcci%ps4P8t-i<k&v@^eS6teGh>vwT*!UIAhzFir6 z!#GtWjcMuf^M^2juX};xK>-;lDc1gCFj`vLUUYpCt%&obU)m0y2qI#twn#?oFX16~ zQQ09iO*?a~DevCBOQLtv6YxBD+1r#~=Y$c(wzYL_M|%k`dLR+sj;v6-we=WTZ=#vY zW52)v>X4OB5$y~i5)n?vExuns`ao90@y4NNaYKWSp4H1;!Ii7@eZP)dz2P=vM_FQ? z*#`%gH{JyTN^~iQE_KH_k#>PnMy9=EXVNpj0CpRNI#@4JhJ!>><>QtP?%cm4McaRo zSZLzz`+{PFT$@h%`}(go`bqhgIP2?bFz{^6ukap)Bxd1JHary*>mY5^i0vO7WLDFt z*QY!7Ja_GGYd=_jSX~87T0MK_rDudG7L7A^753t}aD|QbIj_i%oDU42iZKAQiJHau zlFt;+p`o#{(qn6<mOGDq=IbhrCCQwA?A=o0RIx7edPNU<$e&*+HQ#;ZT|N3;;2Uk# zVgdfW3{1oT;`!$Vh5ozvzu7oIEdRXzoL;!U`rn6_2yu*i-Tjg$ExqXbh|M-T*<@;q z%{Jdk51Kzs`<V94iUxy>E}srhMW9Imtk^li=Cn4+=*EGuy(FIUOExucSQgF6Vgh;6 z++w-^YDx9;{v6M-|4<9Efa^L}m4(o4ziL8&QQ<2y7kch=OVxp|!H4z)jX{xP8Rwn- zihVzuJzrU_y*jMyLAmqeSza<o-yGn|EjbVz_?kHkoD6_J!iy!G5@5u}<$Xsd9YhdB zJT5JOkuy<FaHAMUrQf3n;zU1$TFUk)jtqRO(+$^vUNsMA;sx(1Uf1H&<UY^9Mague zXZ`k=n7d1{ZA?m0L^F`)fnp)!<+x{Jl_<~dUJmo?bH(p1RxafU46=e0inFvMbz{Hf zXPO_iTKN{6(?4M6;Tu*q4P57%UXZ8t!{lM(s^e={jq}Du#XJ?TdXnbQ8W#1irGjVp zTQ$?>y4!g8`=k@*r{Vi5<C7f>_VtS1M!e(8rG;5KwC)jZGGnivjZWphP~eu6Gs-Ar z;myqWuDE4YE|3y}ZnMslT=lg_P|AL=CTTn+&eljZB150*irJ<<JD=zZEp9aFr((&) z^>e}QBpy8_omYYl4BuEwmI*49@-8;Km<_{AVo4JT%GKD{A%c_i*%`d+>rW=CRCpO3 z1IhKn50{)DyG;B%MdgftU}L9<l|_8$7{WV}nSEo{{=77IikO>-*JrXQzLrz=%z@cG z$!D<OZS6UYm!9V0_72;he7TpS{_rSymeDc&s83jbGwF~10)uHJ97+)13f;f=hmqg6 zF$yZ4gFrd{U!MSUs3%Sa$DP2pSnm&b{CB(2u1U_SEui=RrxD$EU38*;OC2i<fQbJ8 zeUe*nI_eYfjr%|C?)~S0@&=3~=09?eK{z<#7zvuKz;P9r%m#*HW!JNYo=<a@k2s|H zL@Nt0z0+RZD0AWI>nk=zHR4x68c%f~oa~M_e$we2?2L`NoZbV7L7l3(2;AqQ0o=Ll zqbe(Hu1!rD*OZgN_J;h2K~-`{@odm_JoOqDn#I`ok2KUH2M)_46yMep%Xc0RwgwF` z=}j%pv^sP<$jGiS5aNdKMT%~_R`nv@<7LO<(r4kuna~?k(~kU3th!mr++iFtTTq;p zRGe++;T_ym=Mp4R;a7o32ofhJo+UkMOz>$^k?(De#BL4>t79QCBBN%_lhlz#O$*BB z8IkAlQ#Wz0EHv)HDJn9KOLFaeMZ7ShTVT#>#7F-iQ)g@6FfO^H-kP6v(@3SUOebGI zDaq=&ehZ=ANVd{(=|}0+g77?pI6|4{r9s8z176@RXC0=c(T0+yFad$0q&gwhinW!r zjOXE*nk^jc4a;Pf+E!`7{pAtCt~-)nN`%EF9e#ZG&Dr@l%yd+f^EspMU0eCrFOoGT zK#nDm3vn(jlumwi@^|5&^y5J_wa7dukD?JoHC_3f?2<!AF<b|C5<cGlti0T_1_EY> zo+H4Z9RHa2x8s|><su)OnGHbT>m4$Rv&|Ro%P@O<I()<zQXunU{S^tep}^GLcgf>I z@q|e7Ez)+Y5&fUss@cT$2g$QGoBLP5aXg#j%Vnm$loI`n!2K=#4Vy#m8Lz4`tpC@@ zmB&N*w);jZqO!HAY+2GE`@T$;$QmkS43T}1eP;?~U$bPyFIloqmTV!(GRhLtlx1vV zCds}IgL4n>dCxhY_n-6pGd|Be_wrn>xwh~3x`)1%<@;>gx+q*(;CS<?-l{d?h9zrn zky*os0%2l3-j(CsCi3I&bEE{7Ig-A@>=!B0VzB1i?@!wZcJvv(;5xoq_eCV?v`_qi zL9EF3k{GmU{oA(ltV;=r2(qi|3!Z~-Wy@{pJI^xX^xBu$g5NhLl@AlWS)r+)O~sgy z#;^f0(RoH-LC7*=M#_vluH*P+N;{2UFW9TjL&|$RO*>=vu*|Om4P)oYldWEVCyT*) z#BTNRO>Ei)H;mfcl@YBg`@Z1?6?9(w=Z&z4-b_YG%9nP|?{^6f7_^7FA&VYQD3;Ul z_nZBn#@_v-_Vdx?53-hQPU%-9UAI=#|Kj=?%GAt7qVZne-p#tlxo~lrL{A~Ba&F%O zFgE-rD{J&OlE&nAG;j0b+{Rqd&~$<sVgD20{rxIT*~SOC)`<#V$^zB<dCG1`Wql6* zaZBQN&(#w;xQzfs9-TEcwYdV)qQx=(KWjY#`OT9Yg#%CMw<{f{b<X^*U3)ps)3(2} zeNOyC@JPr$8OyU<J*<JzU1>6wmW<G5f0T_nazs4E?Y?w=qgM9@rMz6ig=We;^4ldF zwq*E`^BeJt7a(LyPtAdG84gI-JiA^otvlZGu4eu&tN9=1ipVM1vn0C@G%F^7zHm(F zSFw`s56woO6`l~7RclWRS5e5>1jW}P{{YvoN>T=rr}79C7>w!#6IuKyE2lJd6OVTZ z{_!l-gZW+11NwLm@m^f<kpLatnbiKLsHLTXyVajS>EpLR$NkLH5z~P0Rrt1LEFKlR z1(>*>wgT-o+#c`M9*tq#lyAK6;WmVBxA$-Gx6)C%rwBhoLjzngs`RxzKhvtCT;==5 zNfhFuK(+{^D8U#e3%6=lcrBN5j9?c>hwUpKF&aL{39aZ?=i0cHwePjzcpt{$_Gf$` z@Eww0o@A}a1Tefwtp^H^-LQ*u^3!Rc?t=odtBg)LngU*e3`>eojTy0=7f7X9DQ=Q4 zj`nQ+;zRq$V24f#C(kCK_%fghM?^IEA)ZeU!)UDOvHMZhqIld#Q-s&4_P_3td|czj z$au0cSb6~DrKwSC%UL!Y8?3Pv+joT^<iADR;UmwD6^LU4O%tFMNH2mYJQhl2Id=5V zV?sKiy1}=C@P52c6Xq9&rI&vl7yM|SmF>iFhZqR=tdlO!A$eZxdt7Qt<B{%XaFJ9P zDiWy@O(kn<DHjE-)TgXeIhm-EcvERwCzt1|CVx&7Yp-%G8*%eGRN<O;!>_)Uj^pD> zqvfY_i!i0B{3>;M(|P%e$^P5LI61*ghOx%-itvy#l>Xt=v~h!xVA#r0!$h~j^WnBu zz9WyjaUT(M?ugBw8tFAegup`mB%-1R@jNicUtbIGhf6#T`e+`}Qch&%#H+Fs_-mmR z)?7niE4I2eN+8~M(1GQCkFp6hkA3Z0n>s9^58K*g#lUM`1uhvGZk<6+J1S$O&pNlt z-KbDtj$M2}%Fd7>U62WG3UnH_#s`Av3jzUMfQ_?kixx*56VdpWFjW%Y6`EE9Ck5-j z4<V5L0+i?pbx6Z(8|iYGc=fdu+Ps_aPRuxFd?Og!q-JhwCH)WMWW(>^$^;U*yL~r6 z=v;!dtMc<1z?A?x2E_PNZi!WuE^HKzwnQ(vw$3s!^}ez_g<jw}4e2jOF_Od9zBHkQ zW39OQ_*adquW@~p@a6Zqfj70v{k8N%nx`yhl!Ev7ed7N$=d<uaOkYf(bCpngM(k+_ z1neI6qveCD8av^cz(4#AmpmJ231`L9M1fpPV3`FZYoYo^vat`K&FRXrc+QS-UU(qg z#7_=T9;kZX<O(!xC*eU2#jI{D-G)}_aI<0{u{-9Nm}OD^I=oM(f%cKDtX3IQ6v$-5 zKqb>~FX^@SAa2*^-f98nwG_l(utWVZM`nA<(!OR;dCy*Gj`Hl!fk$hP=pq>p-#+mc z?`3W0)4q(~j{c}A{Sp@M8i4(UPFqUO4BKl<uh1<-Jq|G(teM1vn%q1+ok8YaS-s7m zKLcg_x{c8LQa%X1kVwC#j<kxUig?X+YeNZQoWGKcUZ;xvQ6O7dT2!eWx1@pe?#;^C z(_AdmIX#rP>H%S{#+aIrwxf{#x2UDZuZr$uoc4|r4D4-_5E5mvK_sWqstc4i^$@F; zdI<%~sk`ca%|n{nNHoXJn0u-CF`yDOG%fKh5^`GJXK!3(v5_GRSo1PMqPV#hyD@R~ zNT|va<<NvM<T)l0hkBeqHgDxuA0C=YAv}6BcFV%T9)4*|!}nOu$&O|LAY@LVSMIfa zMwdO=rBh1WOr$&E$9>&<^5&K1(PwZC;yA6Vdw1?L(DjXJx34o$Uy0HFZ6U`1mz+zl zxM7~KJ>`885&}wy5i1`$Uu4JYrHgrQEL?!p1B$!JmEtJqJ_|_zAPC3E*dVQ6w!71v zF6Mu_rpRYl-Lq3nX<9u+rd&AjQc87o)nyyA*)J37*A^xh*3s8j7FJC<P4y{V#3!X7 zQInZgQVFf`o<1WAtk*l%$=uvAv(rEmCh^Zo>y(YSxfFZ%N@n83VtVz*De+8+WrUEO z4TichI=UO<Uz)C%5ZG(If~Y<%I8DTsugEWokITI4d34zb3)5cH7V3@tAg*~bGOF>C zkU+OuoAgfoCR?T;Tc?<9F$&4|QTqLK!r{VZu|kPe8+3U$oi@J33Mh2kEL4S^OYbvE zPmD1&T0YAy*dMG1@Kx4CX-p0v4Z4wkDw{bK{t@d-OVDAUX;s_vGj8rd?0nkJJ{4MH zQH|q6uVpnF5eO5!)G9L2%D?cZPt1x-MvposUO?}mczl==w~mG9$f|&1!{79GzYr(= zEkJdZ?Ihj#DNcOr@`}iYZ<deIY)e~>%%|_b_vCHssgRU+HAo&yS)egN+GTsyQhx9s z_$D>VrV8)sOOC||NiF@DUG*Pu&LS43XX);7_x>UR>+WAXO$)glhsx*-Mr%)g5rsC1 z3jlz?b-lX`{o+*=4GVK;AIYx@x0~H;yXx%V;56tH*rPnwz#Rd8?9{zqJN^L)oXW*N z?vHxble8fZi#3(Jx|(|g^7bohUg00Za^BN;VDeKCk59Fys;B*p(}Z1rUTD2wx_>7a z^L;4R8vMqD5^94_26WU4se9+@SypvPVfW)UDL)xQ`ZlkWjjVZ6n#(1i$HLPe#BWlT zcBuyjpsr|@O!Ma5^avXKY~~r9_W<VS*gKvvEVKI(*Jdilu!F*~G8tUcm1)n|{{+og z#-FL=<sI8WQGWg&UfXqJCM5(;HZmmXtzs^0_DcCnNixH+@{mu;hc@R$emk99Y<=SK zqE(gC1FG0FkYB*+Hk!1V+x!J+3lNv6t(q~~wWG6s4TYF>!FoYnvf&V=`M%?iTVS{u zv^8;FENyybshRt~rF8CT$RDR4#`ea1Jc1zhmPa4k3C%NxUBF)=+zaI90-RX{*F;po zUIr<QVbg;fYR~$Y{&pcsaroyAmk>3@$+^&3o|Jy>!!Cx~D4F>wm6k=pQZ?S0Ce1ml zm|V&-P3604T}$ObI!HeXY&Q3-fnTU?tWT(Cycm%}2l{%Eeuix8-hu#iX-~WU3<Lzg ztnfkx>ttp^|5hm}K0z}S>7HkLwrL#se)udcuM|z|lK*y!?0Cif_JEPsPL+DdeTh6B zm_DO!!A$mUdHKsU>EBY?&rt7vF1lXAOET!_{L6dYFpxR}W9KEYcDfk#8OnpR4_20T zKGM+S(jVXq*_kyNBm!V(didAKoWBly8|!bC(BYS9foY@{UOnAz*Cx=rqcd_H!YasX zmqvr`NgyVj<vN&*4#OC6_K=kmz%#0hG~{Q$@j6L24Vt4*L<<3`8y(%}9jABUZSp4; zMI;UPkz7}4^Be=>5w)SKLqiMYj)l+LD_jI{Z9nhrF2*zX-XopGf>w|wG7GjBAJfY% zmosZ6OH@_>=w4^m=c9-ItfO^~@Uie4qhsRbY}zb6n$`=NN>u6}UF0p=aI<KeTDRUn zhB*fZk++VJ$)`KM#Q2`)3TKA|KeW1~3!tTQM)yv0U#ptL9_w5$xu9cI6%GPdo57hN zviERf$aXleA(;0V8{YU6n*WmCH6@8BE(wd8BFYdytC)5KKOJ2{!pFiImrgpZUlVzi zmyx+q?;(~vpy+#Z?^W^7ri|LO;nZM>YS0B}-)Zg<hi)d>#O=~Ib+*7!B7I`W2NaTb zg2j^O=e;{{9V5$B6SdF^U#J2uA*P17sv^&s3-BJ0;KYf<O#9BeOewl2*npla_}714 z%%zh`4%9>|--yj0gOb$h(bPej<JaX_X~SQ#X$+-`MYkcD6J<C=uZh3Z@;h@f<j*Tz zD)e>5z5CVH_uHDIt7nabxfGWJ1|zO)%%wItvOFPWP+;RMRdGC**v3Xn{C}O}__5@H z4LSv{G~nFqgA13Z>stnS`dHIzt?ja&+K&TZ2MGNfAI2b+Lf?56P!#jEK?L6Qx_k?u zTaO?~Nw_GUcS9*bkcW1yNp-x0cyW6;OR_d(k}Om~)S%=R=zR$^8*9#Rc{FZC@6x>C z-`+B};+*197F61HtEuWq-KHDx43$Rw{<4C=Rvz(@r95AlI~zw0_ZK|v%TS_<ywfE! z6&N(svm}+i5p);bc;$$_4s`kXgmJEg^_BCRG~JySh$-5TA{J7BMA1yW=Kb5A9(Csl z#Hk)zQsGefDGk(q+;f{<V0~7C-o|X)z5H!({IZgHvq{J$n`TB@T99cR$qesYTV-O_ z3Tte9z-G8Wo4sxS6fE8xT*aercJXbq%<Hkb6k#s-H$)nNY*2KL$xby3osibHFh(VE z^Pm~e>gJ=`GPU++Q`XHJlx>zhc8H&w%CS-d6a1@nTMab^-QQ|UGE-mckGz6zI2(Vc zTwC;6NO4{E1h@}qFrub9W=pIxe;<g*j7l)+x8~`U(bIj-U4ONDQWXDsr-LTNXhMS} z>qH6?GMS5Mmnh7tlHtFtKETb@{gd)k{Jh`~CmjmguJt86_!n*49sSbrs_5@Mg7aqP zg)^2MaW<_AH=4e7?(44plgRsg1xAtz^gch9wFUyyS?E;2^iG(DI~i$h)czG(rG-ec z2}e;|ces>qZL=4(-;dVnwyITvVp6xeE(TP%Y~>ckh$-6gT)?l97y`#eu0N|gGJX3; zqsO<sUgqM9tJ))w5G?2DT1LXAftEk#9wUV<({eFi5AUY%YfxErQ0&<cz!^t3-<p$_ zVIfRO{#afnHJK(@<l^9sURy+&U`~-AN0azwH@_Es>e3re_kA>eGH8FP-j%H~^g*Na zjj*p6Pt(y$_Ug=im2>8iyx*aIVoAinh;g-z^{+`yxtvs08qhVi5F5JJ7^~Io5Go-e zbOc;LnPqc;e=#fBP-Ew{?<IA#Q_q;CDgfzogn0N(*UQh~(cx-!b=0SU049Pup2LAM zx)0?PRM}TJ-=N+Hrn@vu;FM1-JNKz%iSNb<F@WU+%4O8UsvI4YGKD(1z<mj&=>NGd z(8$z6>(y29XTxUippFLSK(>|oUIu|3sNU4Qqs|M~v%2aB8jQn68NGfzeh2~gfL&_2 zwN_W$RiJ><iuHA(JAaP)=)rJn-qLOpEt4-NI)2{_>}*gZ$fk!zQU?3|`xW7Rvk&wH zlsrPREap~j*w-e9db0QGOgpu0CKT`gctbQy>g+WbjPU;=rQTP4YH%=XgE_$NjaTeI zRf)eyW^bzEjg_a#V#~W1cHh`Wav(3}fulexw%56r-OkiTM=o+sR-Y~*<DB;9*$XuL zzS@-d!wFF}NuJD|Yk62>=d1BiAC;Q|8vE4~cFf$7{ffBv$)wa+sHG*-uY9{K1iWWK z%D+A^c%!rn?<zANQ((`xqj9>FIB{#%+qgHAu%QP}RNGC_UQs`d;Sbe|FD<Z=ir~?d zJ4!OD&YXH8DAjo!SNKRO->JYvLPOx$eF?=f0^yxzPtj1;Il)WyqV~5Mz3jaBW^78B z$4%5Fh;Ou|5XDAQ#&1~rbIu>NAJyy_x{E2W3$pwCJ-#nG60>koysYDIcE0>(7Ry(4 z$tp0+U^~?m*Cst9u%j_`N8Dh	co}=ksw#Hpd6M!@uRy`IFL44g9f)(z(6#w7RT7 ziQO_$UPLQWUZWxRWxeQF)!d-O`JSiA_@On6MA7vflh*wY&OSFOl=`*EHP^)Ep|!qO zUt5k}WW%UjYd%fxvo*bK+JmKN-y&Uw(yKcl!(uT}3YinRnNdT!9;z{t-iU(pvO1Di zri6-@g|cFNEz+>HHxE?Ky3%VyD7dNkB_g;5hEaC7yTYD?BW8W&<H7V5A<}g`onJIQ z@r*S7kjWlkjIW3LWEg)CNhhIG;oK`}SEovn<r{KgdGF%!t<2+=W=y*>G0C-&aR2YB zZVFEMwNZ<hsmT4{d;OVg=BaRDk2vfIdB;XNKvR;>hY$BSUg7tHq&fBS8)q%$1pcIs za(TSLelU=qEpX76n^odjWc9}+AK#vEWM1BVE^8a-<Z9OQyiamKQ(ZZrAWHc`b8<pd z5S+luQ+r<$O6D!BeCf(s-&Cp5Q|MK;R#bd$yBcf1UIt~}->7$Bba7e`t?4JliEKYj z_DPZkr<&;SSl%7DX?bpcFZGYl_OKH;OE@mmLH;*-YOYqjS-6=*F>nzGwwD^0DkF#_ zEn<i#h@Rxv_0D|W7He;$$Wi&`T?S>O6$$f%<eV5vD_+ev2D2GS8Nfpa)IPG1-(%g{ z_K6g5$}!JAX=3dfdDm&ddrgoWh7DealBb>acvtL`c3wfrC7xDNyKAt|+Iv4_{~;{K zg{^HC+zhxwcwNBF%#G&RM{*dgh!)!NB~-t&ihrA2q#m^Yc1xz$rreM_1M1((*H#&K z^--mZZr9+{jy+BT`v$u@ugY#xr9;q2N*|86<^#`2R~Y3{WmAZ_R&Hlm$n?3Kp6|qm zH|`j_WRHM?7li1`e=Kez#@VhcpqshKJeuk!x0O_nn0R=#T+MUiYu9f4g0m?RWEMOt z*LzVh-6+YppV5El#VHISHrXuc;&o2B^ys0x<poY&X<p8`oYUR({;Mg5U0I2>sdq8A z<3?_%&%<?Dp<)Kz&?56VjW+puX$ZFiv;xyn!N1PaTQreL8y<Nq995Rr#R}Jh(V0lz zlq$<+s#hebm$=-k9FEX(XRFUNyN&B^)&6lZk>}1sz9#2^+RTtp^_~`|;~LMxv5YzC zNk{ArvAt7rzg~W<BgCFCMW%@ywDZDriC1I1j18|G(0&e?TO;QZySO${R?{X_OW5`a zw0mP7lK%}@0NOl220vr!G!MG<x%l&sra)I92WZ40(M0+fFVoG%6I7c$MR>B!alrRH zgezEB60s}+DpZfmBw#7z7LNKC3<72y0gOwPG%?Cas>fKK0QJxH2*5-C_s(jBxe!7h z89-`=@^f6@o;{^1a<Jav6Tiw)TVnf155^jOQwY&l{@-6dLxrb<fxtyYrtBcc{*BQ9 zj;J||U-WRC`6P)7<NkX|@Ku4Tj@P+^RF>)(4!p?WA7G}#3;2-33%t_d1=cyd{yz}p ze?EMT5;~(4=)1bcBMheD^U^T&di2oCR^G<L7JM8L7ZsBd7L^tj6T2%WE-xV=FDVKY r6_*zk<rSzw{ht9YZjT)8{Qq-+gxukPF9NC?)Q#TO&{r>4wR-wrnC--? literal 0 HcmV?d00001 -- GitLab From 9fc69ea197f1c6a3af2d367198fd3f4721d7bbc2 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Thu, 28 Mar 2019 17:55:12 +0100 Subject: [PATCH 308/308] CI: putting back stronger constraints on TDD-5MHz tests Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml | 4 ++-- ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml index 9cdd7523ad..d5a25c7fa7 100644 --- a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml @@ -65,7 +65,7 @@ <class>Ping</class> <desc>ping (5MHz - 20 sec)</desc> <ping_args>-c 20</ping_args> - <ping_packetloss_threshold>50</ping_packetloss_threshold> + <ping_packetloss_threshold>25</ping_packetloss_threshold> </testCase> <testCase id="040601"> @@ -112,7 +112,7 @@ <class>Iperf</class> <desc>iperf (5MHz - UL/2Mbps/UDP)(30 sec)(unbalanced)</desc> <iperf_args>-u -b 2M -t 30 -i 1 -R</iperf_args> - <iperf_packetloss_threshold>80</iperf_packetloss_threshold> + <iperf_packetloss_threshold>50</iperf_packetloss_threshold> <iperf_profile>unbalanced</iperf_profile> </testCase> diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml index d3b4561876..5e7f4e48c8 100644 --- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml @@ -81,7 +81,7 @@ <class>Ping</class> <desc>ping (5MHz - 20 sec)</desc> <ping_args>-c 20</ping_args> - <ping_packetloss_threshold>50</ping_packetloss_threshold> + <ping_packetloss_threshold>25</ping_packetloss_threshold> </testCase> <testCase id="040602"> -- GitLab